Repository: yt-dlp
Issue: Downloaded YouTube livestream missing hours of video
Labels: site-bug,triage,site:youtube

### DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

- [X] I understand that I will be **blocked** if I remove or skip any mandatory\* field

### Checklist

- [X] I'm reporting a bug unrelated to a specific site
- [X] I've verified that I'm running yt-dlp version **2023.01.06** ([update instructions](https://github.com/yt-dlp/yt-dlp#update)) or later (specify commit)
- [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 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)

### Provide a description that is worded well enough to be understood

The Merger seems to have silently discarded ~6 hours worth of video data after successfully downloading a YouTube livestream.

Actual livestream is 9h20m42s long (downloaded size 14.92 GiB + 695.11MiB)
Merged file is 3h15m45s long (5.26GB)

The VOD appears to skip a bit at the time the downloaded video ends.


I do not have a full run with verbose as I did obviously not anticipate the issue. I will update with a full debug run if the issue persists with the VOD.

### Provide verbose output that clearly demonstrates the problem

- [X] Run **your** yt-dlp command with **-vU** flag added (`yt-dlp -vU <your command line>`)
- [X] Copy the WHOLE output (starting with `[debug] Command-line config`) and insert it below

### Complete Verbose Output

=== Debug run after the stream ===
```shell
PS C:\Users\*****> yt-dlp -vU youtube.com/watch?v=_q1DhnbsTSc --live-from-start --wait-for-video 5-10 --cookies-from-browser firefox -o "DELETE"
[debug] Command-line config: ['-vU', 'youtube.com/watch?v=_q1DhnbsTSc', '--live-from-start', '--wait-for-video', '5-10', '--cookies-from-browser', 'firefox', '-o', 'DELETE']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version 2023.01.06 [6becd25] (pip)
[debug] Python 3.9.6 (CPython AMD64 64bit) - Windows-10-10.0.19045-SP0 (OpenSSL 1.1.1k  25 Mar 2021)
[debug] exe versions: ffmpeg 2022-11-03-git-5ccd4d3060-full_build-www.gyan.dev (setts), ffprobe 2022-11-03-git-5ccd4d3060-full_build-www.gyan.dev
[debug] Optional libraries: Cryptodome-3.16.0, brotli-1.0.9, certifi-2020.12.05, mutagen-1.46.0, sqlite3-2.6.0, websockets-10.4
[Cookies] Extracting cookies from firefox
[debug] Extracting cookies from: "C:\Users\*****\AppData\Roaming\Mozilla\Firefox\Profiles\********.default-release\cookies.sqlite"
[Cookies] Extracted 3034 cookies from firefox
[debug] Proxy map: {}
[debug] Loaded 1760 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Latest version: 2023.01.06, Current version: 2023.01.06
yt-dlp is up to date (2023.01.06)
[generic] Extracting URL: youtube.com/watch?v=_q1DhnbsTSc
WARNING: [generic] The url doesn't specify the protocol, trying with http
[youtube] Extracting URL: http://youtube.com/watch?v=_q1DhnbsTSc
[youtube] _q1DhnbsTSc: Downloading webpage
[debug] [youtube] Extracted SAPISID cookie
[youtube] _q1DhnbsTSc: Downloading android player API JSON
[youtube] _q1DhnbsTSc: Downloading MPD manifest
[youtube] _q1DhnbsTSc: Downloading MPD manifest
[debug] [youtube] _q1DhnbsTSc: Video is in Post-Live Manifestless mode
[debug] Sort order given by extractor: quality, res, fps, hdr:12, source, vcodec:vp9.2, channels, acodec, lang, proto
[debug] Formats sorted by: hasvid, ie_pref, quality, res, fps, hdr:12(7), source, vcodec:vp9.2(10), channels, acodec, lang, proto, filesize, fs_approx, tbr, vbr, abr, asr, vext, aext, hasaud, id
[debug] Default format spec: bestvideo*+bestaudio/best
[info] _q1DhnbsTSc: Downloading 1 format(s): 299+140
=== Censored anything potentially containing sensitive information, ask if you need anything specific ===
[debug] Invoking dashsegments downloader on "https://manifest.googlevideo.com/api/manifest/dash/expire/1675173654/ei/***/ip/*.*.*.*/id/_q1DhnbsTSc.1/source/yt_live_broadcast/requiressl/yes/tx/***/txs/***/hfr/1/as/fmp4_audio_clear%2Cwebm_audio_clear%2Cwebm2_audio_clear%2Cfmp4_sd_hd_clear%2Cwebm2_sd_hd_clear/force_finished/1/spc/***/vprv/1/pacing/0/itag_bl/***/keepalive/yes/fexp/24007246/itag/0/playlist_type/DVR/sparams/expire%2Cei%2Cip%2Cid%2Csource%2Crequiressl%2Ctx%2Ctxs%2Chfr%2Cas%2Cforce_finished%2Cspc%2Cvprv%2Citag%2Cplaylist_type/sig/***"
[debug] [youtube] [_q1DhnbsTSc] Generating fragments for format 299
[dashsegments] Total fragments: 33642
[download] Destination: DELETE.f299.mp4
[debug] File locking is not supported. Proceeding without locking
[download]   1.3% of ~  12.33GiB at    2.46MiB/s ETA 01:17:12 (frag 431/33642)
ERROR: Interrupted by user
```


=== Original Run ===
```shell
PS E:\> yt-dlp youtube.com/@yukoyurei/live --wait-for-video 5-10 --live-from-start --cookies-from-browser firefox
[Cookies] Extracting cookies from firefox
[Cookies] Extracted 3053 cookies from firefox
[generic] Extracting URL: youtube.com/@yukoyurei/live
WARNING: [generic] The url doesn't specify the protocol, trying with http
[youtube:tab] Extracting URL: http://youtube.com/@yukoyurei/live
[youtube:tab] @yukoyurei/live: Downloading webpage
[youtube] Extracting URL: https://www.youtube.com/watch?v=_q1DhnbsTSc
[youtube] _q1DhnbsTSc: Downloading webpage
[youtube] _q1DhnbsTSc: Downloading android player API JSON
[youtube] _q1DhnbsTSc: Downloading MPD manifest
[youtube] _q1DhnbsTSc: Downloading MPD manifest
[info] _q1DhnbsTSc: Downloading 1 format(s): 299+140
[dashsegments] Total fragments: unknown (live)
[download] Destination: 【48 HOUR DONOTHON!】let's have some fun!!! we have the whole day!! part ONE [_q1DhnbsTSc].f299.mp4
[dashsegments] Total fragments: unknown (live)
[download] Destination: 【48 HOUR DONOTHON!】let's have some fun!!! we have the whole day!! part ONE [_q1DhnbsTSc].f140.mp4
[download]  113.10MiB at    3.90MiB/s (00:00:53) (frag 317/2889)
[download]   13.24MiB at  170.25KiB/s (00:01:13) (frag 641/2889)[download] Got error: <urlopen error _ssl.c:1112: The ha[download]  607.34MiB at    2.36MiB/s (00:04:16) (frag 1447/2889)
[download]   50.66MiB at  255.06KiB/s (00:04:35) (frag 2452/2889)[download] Got error: <urlopen error [WinError 10054] A[download]    1.05GiB at    2.98MiB/s (00:07:29) (frag 2431/2889)
[download]   69.28MiB at  202.16KiB/s (00:07:47) (frag 3353/3353)[download] Got error: <urlopen error [WinError 10054] A[download]    1.72GiB at    1.70MiB/s (00:16:56) (frag 3902/3902)[download] Got error: <urlopen error [WinError 10054] An existing connection was forcibly closed by the remote host>. Retrying (1/10)...
[download]    3.15GiB at    1.13MiB/s (01:24:17) (frag 7945/7947)
[download]  164.56MiB at   86.44KiB/s (01:24:35) (frag 7965/7965)[download] Got error: <urlopen error [WinError 10054] A[download]    3.48GiB at    4.58MiB/s (01:32:59) (frag 8468/8468)[download] Got error: <urlopen error [WinError 10054] An existing connection was forcibly closed by the remote host>. Retrying (1/10)...
[download]    3.57GiB at    3.51MiB/s (01:36:04) (frag 8653/8654)
[download]  179.13MiB at  243.11KiB/s (01:36:21) (frag 8670/8670)[download] Got error: <urlopen error [WinError 10054] A[download]    4.17GiB at    1.73MiB/s (01:55:06) (frag 9796/9796)[download] Got error: <urlopen error [WinError 10054] An existing connection was forcibly closed by the remote host>. Retrying (1/10)...
[download]    4.38GiB at    1.10MiB/s (02:01:42) (frag 10192/10192)[download] Got error: <urlopen error [WinError 10054] An existing connection was forcibly closed by the remote host>. Retrying (1/10)...
[download]    5.08GiB at    2.61MiB/s (02:23:54) (frag 11524/11524)
[download]  238.55MiB at   43.39KiB/s (02:24:16) (frag 11546/11546)[download] Got error: <urlopen error [WinError 10054][download]    5.16GiB at  618.95KiB/s (02:27:53) (frag 11745/11746)[download] Got error: IncompleteRead(9838 bytes read). Retrying (1/10)...  at   25.19KiB/s (02:27:53) (frag 11745/11746)
[download] Got error: IncompleteRead(3641 bytes read). Retrying (1/10)...
[download]    5.69GiB at  456.11KiB/s (02:46:33) (frag 12849/12850)
[download]  265.48MiB at   17.33KiB/s (02:46:33) (frag 12849/12850)[download] Got error: IncompleteRead(62193 bytes read). Retrying (1/10)...
[download]    5.69GiB at    1.09MiB/s (02:46:38) (frag 12850/12851)[download] Got error: IncompleteRead(96284 bytes read). Retrying (1/10)... at   89.97KiB/s (02:46:38) (frag 12851/12851)
[download]    7.58GiB at    1.92MiB/s (04:03:12) (frag 17446/17446)[download] Got error: <urlopen error [WinError 10054] An existing connection was forcibly closed by the remote host>. Retrying (1/10)...
[download]    7.71GiB at   98.93KiB/s (04:09:02) (frag 17795/17799)
[download]  368.03MiB at  264.67KiB/s (04:09:17) (frag 17812/17812)[download] Got error: <urlopen error [WinError 10054][download]    7.79GiB at    1.64MiB/s (04:12:44) (frag 18018/18019)
[download]  372.71MiB at   83.26KiB/s (04:13:03) (frag 18038/18039)[download] Got error: <urlopen error [WinError 10054][download]    7.83GiB at    3.81MiB/s (04:14:44) (frag 18136/18140)
[download]  375.14MiB at  162.53KiB/s (04:15:03) (frag 18156/18157)[download] Got error: <urlopen error [WinError 10054][download]    8.27GiB at    2.45MiB/s (04:32:16) (frag 19189/19191)
[download]  396.92MiB at  240.61KiB/s (04:32:35) (frag 19210/19210)[download] Got error: <urlopen error [WinError 10054][download]    8.93GiB at    3.58MiB/s (04:59:59) (frag 20851/20854)[youtube] _q1DhnbsTSc: Downloading webpage
[youtube] _q1DhnbsTSc: Downloading android player API JSON 1/20851)
[youtube] _q1DhnbsTSc: Downloading MPD manifest
[youtube] _q1DhnbsTSc: Downloading MPD manifest
[download]    9.14GiB at  106.47KiB/s (05:09:20) (frag 21412/21412)[download] Got error: <urlopen error [WinError 10054] An existing connection was forcibly closed by the remote host>. Retrying (1/10)...
[download]    9.42GiB at    1.14MiB/s (05:22:13) (frag 22188/22188)
[download]  458.51MiB at  124.89KiB/s (05:22:15) (frag 22190/22191)[download] Got error: [WinError 10054] An existing co[download]    9.82GiB at    3.69MiB/s (05:33:34) (frag 22869/22869)[download] Got error: <urlopen error [WinError 10054] An existing connection was forcibly closed by the remote host>. Retrying (1/10)...
[download]    9.83GiB at    4.03MiB/s (05:33:59) (frag 22894/22894)[download] Got error: <urlopen error [WinError 10054] An existing connection was forcibly closed by the remote host>. Retrying (1/10)...
[download]   10.20GiB at    1.50MiB/s (05:45:35) (frag 23591/23591)[download] Got error: <urlopen error [WinError 10054] An existing connection was forcibly closed by the remote host>. Retrying (1/10)...
[download]   10.23GiB at    2.37MiB/s (05:46:35) (frag 23651/23651)[download] Got error: <urlopen error [WinError 10054] An existing connection was forcibly closed by the remote host>. Retrying (1/10)...
[download]   11.19GiB at    2.79MiB/s (06:17:18) (frag 25490/25493)
[download]  527.05MiB at  227.93KiB/s (06:17:37) (frag 25508/25508)[download] Got error: <urlopen error [WinError 10054][download]   12.45GiB at  106.46KiB/s (07:03:03) (frag 28234/28238)
[download]  583.77MiB at  194.06KiB/s (07:03:22) (frag 28253/28253)[download] Got error: <urlopen error [WinError 10054][download]   12.56GiB at    2.51MiB/s (07:07:09) (frag 28480/28480)[download] Got error: <urlopen error [WinError 10054] An existing connection was forcibly closed by the remote host>. Retrying (1/10)...
[download]   12.74GiB at    3.54MiB/s (07:13:55) (frag 28886/28886)[download] Got error: <urlopen error [WinError 10054] An existing connection was forcibly closed by the remote host>. Retrying (1/10)...
[download]   13.00GiB at  829.32KiB/s (07:24:20) (frag 29511/29513)
[download]  609.77MiB at    1.48KiB/s (07:24:23) (frag 29511/29513)[download] Got error: IncompleteRead(85116 bytes read[download]   13.00GiB at   17.12KiB/s (07:24:31) (frag 29511/29513)[download] Got error: IncompleteRead(2590 bytes read). Retrying (1/10)...

[download]  609.77MiB at    399.27B/s (07:24:39) (frag 29511/29513)[download] Got error: The read operation timed out. R[download]   13.00GiB at    6.57KiB/s (07:24:51) (frag 29511/29513)[download] Got error: IncompleteRead(5244 bytes read). Retrying (3/10)...
[download]   13.00GiB at    6.07KiB/s (07:24:54) (frag 29511/29513)[download] Got error: IncompleteRead(1566 bytes read). Retrying (2/10)...

[download]  609.79MiB at  209.04KiB/s (07:24:56) (frag 29513/29513)[download] Got error: IncompleteRead(2172 bytes read)[download]   13.00GiB at    7.41KiB/s (07:24:56) (frag 29512/29513)
[download]  609.90MiB at  223.11KiB/s (07:24:57) (frag 29518/29518)

ERROR: Did not get any data blocks
[download]   14.01GiB at    3.18MiB/s (08:00:54) (frag 31672/31673)
[download]  654.84MiB at  266.32KiB/s (08:01:16) (frag 31693/31693)[download] Got error: <urlopen error [WinError 10054][download]   14.09GiB at    3.61MiB/s (08:03:59) (frag 31855/31856)[download] Got error: <urlopen error [WinError 10054] An existing connection was forcibly closed by the remote host>. Retrying (1/10)...
[download]   14.58GiB at    3.13MiB/s (08:21:31) (frag 32907/32910)
[download]  680.30MiB at  224.33KiB/s (08:21:48) (frag 32925/32925)[download] Got error: <urlopen error [WinError 10054][download]   14.92GiB at    1.79MiB/s (08:33:47) (frag 33641/33644)[download] Got error: IncompleteRead(86401 bytes read). Retrying (1/10)... at  107.05KiB/s (08:33:44) (frag 33642/33644)
[download] Got error: IncompleteRead(60 bytes read). Retrying (1/10)...
[download]   14.92GiB at   18.56KiB/s (08:34:04) (frag 33641/33644)[download] Got error: IncompleteRead(21889 bytes read). Retrying (2/10)...
[download]   14.92GiB at   13.11KiB/s (08:34:12) (frag 33641/33644)[download] Got error: IncompleteRead(43 bytes read). Retrying (2/10)...
[download] Got error: The read operation timed out. Retrying (3/10)...
[download]   14.92GiB at    7.39KiB/s (08:34:32) (frag 33641/33644)[download] Got error: IncompleteRead(3457 bytes read). Retrying (4/10)...
[download]   14.92GiB at    6.99KiB/s (08:34:35) (frag 33641/33644)[download] Got error: The read operation timed out. Retrying (3/10)...
[download] Got error: IncompleteRead(60 bytes read). Retrying (4/10)...
[download] Got error: IncompleteRead(60 bytes read). Retrying (5/10)...
[download] Got error: IncompleteRead(385 bytes read). Retrying (5/10)...
[download] Got error: IncompleteRead(385 bytes read). Retrying (6/10)...
[download] Got error: IncompleteRead(43 bytes read). Retrying (6/10)...
[download] Got error: IncompleteRead(60 bytes read). Retrying (7/10)...
[download] Got error: IncompleteRead(385 bytes read). Retrying (7/10)...
[download] Got error: IncompleteRead(43 bytes read). Retrying (8/10)...
[download] Got error: IncompleteRead(385 bytes read). Retrying (8/10)...
[download] Got error: IncompleteRead(43 bytes read). Retrying (9/10)...
[download] Got error: IncompleteRead(385 bytes read). Retrying (9/10)...
[download] Got error: IncompleteRead(43 bytes read). Retrying (10/10)...
[download] Got error: IncompleteRead(385 bytes read). Retrying (10/10)...
[download] Got error: IncompleteRead(60 bytes read). Giving up after 10 retries
[download] fragment not found; Skipping fragment 33643 ...
[download] Got error: HTTP Error 404: Not Found. Retrying fragment 33644 (1/10)...
[download] Got error: HTTP Error 404: Not Found. Retrying fragment 33644 (2/10)...
[download] Got error: HTTP Error 404: Not Found. Retrying fragment 33644 (3/10)...
[download] Got error: HTTP Error 404: Not Found. Retrying fragment 33644 (4/10)...
[download] Got error: HTTP Error 404: Not Found. Retrying fragment 33644 (5/10)...
[download] Got error: IncompleteRead(385 bytes read). Giving up after 10 retries
[download] fragment not found; Skipping fragment 33643 ...
[download] Got error: HTTP Error 404: Not Found. Retrying fragment 33644 (6/10)...
[download] Got error: HTTP Error 404: Not Found. Retrying fragment 33644 (1/10)...
[download] Got error: HTTP Error 404: Not Found. Retrying fragment 33644 (7/10)...
[download] Got error: HTTP Error 404: Not Found. Retrying fragment 33644 (3/10)...
[download] Got error: HTTP Error 404: Not Found. Retrying fragment 33644 (8/10)...
[download] Got error: HTTP Error 404: Not Found. Retrying fragment 33644 (4/10)...
[download] Got error: HTTP Error 404: Not Found. Retrying fragment 33644 (9/10)...
[download] Got error: HTTP Error 404: Not Found. Retrying fragment 33644 (5/10)...
[download] Got error: HTTP Error 404: Not Found. Retrying fragment 33644 (10/10)...
[download] Got error: HTTP Error 404: Not Found. Retrying fragment 33644 (6/10)...
[download] fragment not found; Skipping fragment 33644 ...
[download] Got error: HTTP Error 404: Not Found. Retrying fragment 33644 (7/10)...
[download] Got error: HTTP Error 404: Not Found. Retrying fragment 33644 (8/10)...
[download] Got error: HTTP Error 404: Not Found. Retrying fragment 33644 (9/10)...
[download] Got error: HTTP Error 404: Not Found. Retrying fragment 33644 (10/10)...
[download] fragment not found; Skipping fragment 33644 ...
[youtube] _q1DhnbsTSc: Downloading webpage
[youtube] _q1DhnbsTSc: Downloading android player API JSON
[youtube] _q1DhnbsTSc: Downloading m3u8 information
[youtube] _q1DhnbsTSc: Downloading MPD manifest
[youtube] _q1DhnbsTSc: Downloading m3u8 information
[youtube] _q1DhnbsTSc: Downloading MPD manifest
[download] 100% of   14.92GiB in 08:35:36 at 505.76KiB/s
[download] 100% of  695.11MiB in 08:35:36 at 23.01KiB/s
[Merger] Merging formats into "【48 HOUR DONOTHON!】let's have some fun!!! we have the whole day!! part ONE [_q1DhnbsTSc].mp4"
Deleting original file 【48 HOUR DONOTHON!】let's have some fun!!! we have the whole day!! part ONE [_q1DhnbsTSc].f140.mp4 (pass -k to keep)
Deleting original file 【48 HOUR DONOTHON!】let's have some fun!!! we have the whole day!! part ONE [_q1DhnbsTSc].f299.mp4 (pass -k to keep)
```