Repository: yt-dlp
Issue: Cannot download Twitch VOD with initialization fragments after media fragments
Labels: site-bug,triage

### DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

- [X] I understand that I will be **blocked** if I *intentionally* remove or skip any mandatory\* field

### Checklist

- [X] I'm reporting that yt-dlp is broken on a **supported** site
- [X] I've verified that I have **updated yt-dlp to nightly or master** ([update instructions](https://github.com/yt-dlp/yt-dlp#update-channels))
- [X] I've checked that all provided URLs are playable in a browser with the same IP and same login details
- [X] I've checked that all URLs and arguments with special characters are [properly quoted or escaped](https://github.com/yt-dlp/yt-dlp/wiki/FAQ#video-url-contains-an-ampersand--and-im-getting-some-strange-output-1-2839-or-v-is-not-recognized-as-an-internal-or-external-command)
- [X] I've searched [known issues](https://github.com/yt-dlp/yt-dlp/issues/3766) and the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar issues **including closed ones**. DO NOT post duplicates
- [X] I've read the [guidelines for opening an issue](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#opening-an-issue)
- [ ] I've read about [sharing account credentials](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#are-you-willing-to-share-account-details-if-needed) and I'm willing to share it if required

### Region

United States

### Provide a description that is worded well enough to be understood

When downloading https://www.twitch.tv/videos/2223719525 in any format other than 1440p60 (Source) or Audio_Only, yt-dlp fails to extract with `ERROR: Initialization fragment found after media fragments, unable to download`.

Formats table:
```
[info] Available formats for v2223719525:
ID         EXT RESOLUTION FPS │   FILESIZE    TBR PROTO │ VCODEC        ACODEC     ABR MORE INFO
────────────────────────────────────────────────────────────────────────────────────────────────
Audio_Only mp4 audio only     │ ~192.42MiB   201k m3u8  │ audio only    mp4a.40.2 201k
480p       mp4 854x480     30 │ ~  1.13GiB  1206k m3u8  │ avc1.64001F   mp4a.40.2
720p60     mp4 1280x720    60 │ ~  3.49GiB  3729k m3u8  │ avc1.640020   mp4a.40.2
1080p60    mp4 1920x1080   60 │ ~  5.83GiB  6231k m3u8  │ hvc1.1.2.L123 mp4a.40.2
1440p60    mp4 2560x1440   60 │ ~ 10.52GiB 11240k m3u8  │ av01.0.12M.08 mp4a.40.2      Source
```

### Provide verbose output that clearly demonstrates the problem

- [X] Run **your** yt-dlp command with **-vU** flag added (`yt-dlp -vU <your command line>`)
- [ ] If using API, add `'verbose': True` to `YoutubeDL` params instead
- [X] Copy the WHOLE output (starting with `[debug] Command-line config`) and insert it below

### Complete Verbose Output

```shell
-------------------
Attempt 1 - 480p30
-------------------

[debug] Command-line config: ['https://www.twitch.tv/videos/2223719525', '-f', 'worst', '-vU']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version nightly@2024.08.26.232811 from yt-dlp/yt-dlp-nightly-builds [41be32e78] (win_exe)
[debug] Python 3.8.10 (CPython AMD64 64bit) - Windows-10-10.0.19045-SP0 (OpenSSL 1.1.1k  25 Mar 2021)
[debug] exe versions: ffmpeg 7.0.2-full_build-www.gyan.dev (setts), ffprobe 7.0.2-full_build-www.gyan.dev
[debug] Optional libraries: Cryptodome-3.20.0, brotli-1.1.0, certifi-2024.07.04, curl_cffi-0.5.10, mutagen-1.47.0, requests-2.32.3, sqlite3-3.35.5, urllib3-2.2.2, websockets-13.0
[debug] Proxy map: {}
[debug] Request Handlers: urllib, requests, websockets, curl_cffi
[debug] Loaded 1831 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp-nightly-builds/releases/latest
Latest version: nightly@2024.08.26.232811 from yt-dlp/yt-dlp-nightly-builds
yt-dlp is up to date (nightly@2024.08.26.232811 from yt-dlp/yt-dlp-nightly-builds)
[twitch:vod] Extracting URL: https://www.twitch.tv/videos/2223719525
[twitch:vod] 2223719525: Downloading stream metadata GraphQL
[twitch:vod] 2223719525: Downloading video access token GraphQL
[twitch:vod] 2223719525: Downloading m3u8 information
[twitch:vod] 2223719525: Downloading storyboard metadata JSON
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, hdr:12(7), vcodec:vp9.2(10), channels, acodec, size, br, asr, proto, vext, aext, hasaud, source, id
[info] v2223719525: Downloading 1 format(s): 480p
[debug] Invoking hlsnative downloader on "https://dgeft87wbj63p.cloudfront.net/09b88c14ef8300ea9fc4_r0dn3y_42737372968_1723598775/480p30/index-dvr.m3u8"
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 805
[download] Destination: [QSV AV1 1440p] Minecraft + Sable [v2223719525].mp4
[debug] File locking is not supported. Proceeding without locking
ERROR: Initialization fragment found after media fragments, unable to download
  File "yt_dlp\__main__.py", line 17, in <module>
  File "yt_dlp\__init__.py", line 1081, in main
  File "yt_dlp\__init__.py", line 1071, in _real_main
  File "yt_dlp\YoutubeDL.py", line 3607, in download
  File "yt_dlp\YoutubeDL.py", line 3582, in wrapper
  File "yt_dlp\YoutubeDL.py", line 1615, in extract_info
  File "yt_dlp\YoutubeDL.py", line 1626, in wrapper
  File "yt_dlp\YoutubeDL.py", line 1782, in __extract_info
  File "yt_dlp\YoutubeDL.py", line 1841, in process_ie_result
  File "yt_dlp\YoutubeDL.py", line 3015, in process_video_result
  File "yt_dlp\YoutubeDL.py", line 179, in wrapper
  File "yt_dlp\YoutubeDL.py", line 3483, in process_info
  File "yt_dlp\YoutubeDL.py", line 3203, in dl
  File "yt_dlp\downloader\common.py", line 466, in download
  File "yt_dlp\downloader\hls.py", line 211, in real_download
  File "yt_dlp\YoutubeDL.py", line 1092, in report_error
  File "yt_dlp\YoutubeDL.py", line 1020, in trouble

-------------------
Attempt 2 - 1080p60
-------------------

[debug] Command-line config: ['https://www.twitch.tv/videos/2223719525', '-f', '1080p60', '-vU']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version nightly@2024.08.26.232811 from yt-dlp/yt-dlp-nightly-builds [41be32e78] (win_exe)
[debug] Python 3.8.10 (CPython AMD64 64bit) - Windows-10-10.0.19045-SP0 (OpenSSL 1.1.1k  25 Mar 2021)
[debug] exe versions: ffmpeg 7.0.2-full_build-www.gyan.dev (setts), ffprobe 7.0.2-full_build-www.gyan.dev
[debug] Optional libraries: Cryptodome-3.20.0, brotli-1.1.0, certifi-2024.07.04, curl_cffi-0.5.10, mutagen-1.47.0, requests-2.32.3, sqlite3-3.35.5, urllib3-2.2.2, websockets-13.0
[debug] Proxy map: {}
[debug] Request Handlers: urllib, requests, websockets, curl_cffi
[debug] Loaded 1831 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp-nightly-builds/releases/latest
Latest version: nightly@2024.08.26.232811 from yt-dlp/yt-dlp-nightly-builds
yt-dlp is up to date (nightly@2024.08.26.232811 from yt-dlp/yt-dlp-nightly-builds)
[twitch:vod] Extracting URL: https://www.twitch.tv/videos/2223719525
[twitch:vod] 2223719525: Downloading stream metadata GraphQL
[twitch:vod] 2223719525: Downloading video access token GraphQL
[twitch:vod] 2223719525: Downloading m3u8 information
[twitch:vod] 2223719525: Downloading storyboard metadata JSON
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, hdr:12(7), vcodec:vp9.2(10), channels, acodec, size, br, asr, proto, vext, aext, hasaud, source, id
[info] v2223719525: Downloading 1 format(s): 1080p60
[debug] Invoking hlsnative downloader on "https://dgeft87wbj63p.cloudfront.net/09b88c14ef8300ea9fc4_r0dn3y_42737372968_1723598775/1080p60/index-dvr.m3u8"
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 805
[download] Destination: [QSV AV1 1440p] Minecraft + Sable [v2223719525].mp4
[debug] File locking is not supported. Proceeding without locking
ERROR: Initialization fragment found after media fragments, unable to download
  File "yt_dlp\__main__.py", line 17, in <module>
  File "yt_dlp\__init__.py", line 1081, in main
  File "yt_dlp\__init__.py", line 1071, in _real_main
  File "yt_dlp\YoutubeDL.py", line 3607, in download
  File "yt_dlp\YoutubeDL.py", line 3582, in wrapper
  File "yt_dlp\YoutubeDL.py", line 1615, in extract_info
  File "yt_dlp\YoutubeDL.py", line 1626, in wrapper
  File "yt_dlp\YoutubeDL.py", line 1782, in __extract_info
  File "yt_dlp\YoutubeDL.py", line 1841, in process_ie_result
  File "yt_dlp\YoutubeDL.py", line 3015, in process_video_result
  File "yt_dlp\YoutubeDL.py", line 179, in wrapper
  File "yt_dlp\YoutubeDL.py", line 3483, in process_info
  File "yt_dlp\YoutubeDL.py", line 3203, in dl
  File "yt_dlp\downloader\common.py", line 466, in download
  File "yt_dlp\downloader\hls.py", line 211, in real_download
  File "yt_dlp\YoutubeDL.py", line 1092, in report_error
  File "yt_dlp\YoutubeDL.py", line 1020, in trouble
```