Repository: yt-dlp
Issue: --embed-subs causing specific videos to have video length/padding issues
Labels: bug,external issue,core:post-processor

### 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

I had downloaded videos yesterday with YT-DLP and [YT-DLG](https://github.com/yt-dlg/yt-dlg), so I decided to watch them today. However, I found that two episodes of the series I downloaded had video length issues. That is, the videos were showing themselves to be longer than they actually were and that when they reached the REAL cutoff point they froze up or crashed the playback depending on the method I used to play them ([MPV](https://mpv.io/) and [VLC](https://www.videolan.org/).

The two videos I have found this strange problem with are [Shephard's Mind Episode 1](https://www.youtube.com/watch?v=GNaJX6gOYMA) and [Shephard's Mind Episode 2](https://www.youtube.com/watch?v=XNLodBPXxmo).

Thinking it might have been a problem with YT-DLG, as I've sometimes had a bug or two with it in the past, I downloaded the video using the same variables I had been using with YT-DLP alone. However, the downloaded videos had the same problems as the ones downloaded previously. Wondering what was going on, I decided to test the various possibilities by taking out various variables to see what exactly was the issue.

From my testing, I believe that there is some sort of issue with --embed-subs, as every other combination seems to produce videos without any video length issues, while any variations that contain --embed-subs have them. I'm pretty assured that only when YT-DLP tries to EMBED the subtitles do issues occur, as I used --all-subs and they downloaded just fine, leaving the separated video completely fine.

What I'm REALLY confused by is that this appears to ONLY be happening with the aforementioned videos, as the other videos that I downloaded from the same series didn't seem to have this issue. For example, [Shephard's Mind Episode 3](https://www.youtube.com/watch?v=sB_ivgremho) didn't have issues when using --embed-subs. I don't have any clue why the aforementioned videos would be any different from the others, maybe they're simply so old YT-DLP is having issues with them?

Attached to this will be my full collection of outputs from YT-DLP in a ZIP, with the specific output from the test where I ONLY used --embed-subs being the one featured below in this issue report.

Sorry in advance if I somehow formatted this incorrectly, but hopefully I at least gave enough information to help point in the right direction of why this is occurring.

[Outputs from YT-DLP.zip](https://github.com/yt-dlp/yt-dlp/files/14878321/Outputs.from.YT-DLP.zip)

### 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
[debug] Command-line config: ['-vU', '--embed-subs', 'https://www.youtube.com/watch?v=GNaJX6gOYMA']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version nightly@2024.04.04.232729 from yt-dlp/yt-dlp-nightly-builds [9073ae645] (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 N-114630-g591e27d1e7-20240403 (setts), ffprobe N-114630-g591e27d1e7-20240403
[debug] Optional libraries: Cryptodome-3.20.0, brotli-1.1.0, certifi-2024.02.02, curl_cffi-0.5.10, mutagen-1.47.0, requests-2.31.0, sqlite3-3.35.5, urllib3-2.2.1, websockets-12.0
[debug] Proxy map: {}
[debug] Request Handlers: urllib, requests, websockets, curl_cffi
[debug] Loaded 1809 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp-nightly-builds/releases/latest
Latest version: nightly@2024.04.04.232729 from yt-dlp/yt-dlp-nightly-builds
yt-dlp is up to date (nightly@2024.04.04.232729 from yt-dlp/yt-dlp-nightly-builds)
[youtube] Extracting URL: https://www.youtube.com/watch?v=GNaJX6gOYMA
[youtube] GNaJX6gOYMA: Downloading webpage
[youtube] GNaJX6gOYMA: Downloading ios player API JSON
[youtube] GNaJX6gOYMA: Downloading android player API JSON
[youtube] GNaJX6gOYMA: Downloading m3u8 information
[info] GNaJX6gOYMA: Downloading subtitles: en
[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, size, br, asr, vext, aext, hasaud, id
[debug] Default format spec: bestvideo*+bestaudio/best
[info] GNaJX6gOYMA: Downloading 1 format(s): 244+251
[info] Writing video subtitles to: Shephard's Mind Episode 1 [GNaJX6gOYMA].en.vtt
[debug] Invoking http downloader on "https://www.youtube.com/api/timedtext?v=GNaJX6gOYMA&ei=LD8PZvTEHJCO_9EP3caToAg&caps=asr&opi=112496729&xoaf=4&hl=en&ip=0.0.0.0&ipbits=0&expire=1712300444&sparams=ip%2Cipbits%2Cexpire%2Cv%2Cei%2Ccaps%2Copi%2Cxoaf&signature=62EB45D69BA0D1F0BF179A57CC8C537D6ADEF51C.274AD317F391C72E06AF681F82141D53D53AE13B&key=yt8&lang=en&fmt=vtt"
[debug] File locking is not supported. Proceeding without locking
[download] Destination: Shephard's Mind Episode 1 [GNaJX6gOYMA].en.vtt
[download] 100% of    9.06KiB in 00:00:00 at 130.44KiB/s
[debug] Invoking http downloader on "https://rr4---sn-ab5l6nrl.googlevideo.com/videoplayback?expire=1712296845&ei=LD8PZpyCO9-n_9EP346fuAY&ip=146.70.171.175&id=o-AM4LuqrSlZwIVr16BjqkrOvMYaVi-NGYNEhPN-t-cin2&itag=244&source=youtube&requiressl=yes&xpc=EgVo2aDSNQ%3D%3D&mh=OD&mm=31%2C29&mn=sn-ab5l6nrl%2Csn-ab5sznld&ms=au%2Crdu&mv=m&mvi=4&pl=24&initcwndbps=710000&vprv=1&svpuc=1&mime=video%2Fwebm&gir=yes&clen=33778234&dur=598.466&lmt=1496519193853681&mt=1712274296&fvip=2&keepalive=yes&fexp=51141542&c=IOS&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cxpc%2Cvprv%2Csvpuc%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&sig=AJfQdSswRQIhAMMqdV-2YSO25JyfdxDqzLCDg3OCiVkueRiEjkI_pP7gAiAIV0RhLN19pUROQek1xBnqZr2_p174afdz4r-Rp8-Bdg%3D%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=ALClDIEwRAIgGGXEkPyyRKmTIOST6C8WXAVCsKyL3j02kIum3hOvCdYCIA2h3xI_5lZg3nGmkXWjd90MDDDtJ7PMkR7XueWjkQpR"
[download] Destination: Shephard's Mind Episode 1 [GNaJX6gOYMA].f244.webm
[download] 100% of   32.21MiB in 00:00:21 at 1.47MiB/s
[debug] Invoking http downloader on "https://rr2---sn-ab5sznld.googlevideo.com/videoplayback?expire=1712296845&ei=LT8PZvygBoKF_9EP_ueioA4&ip=146.70.171.175&id=o-ABEPf9eO3iqOdC1Wre13pbEKeB88WPXTC56jmeDt3K_Q&itag=251&source=youtube&requiressl=yes&xpc=EgVo2aDSNQ%3D%3D&mh=OD&mm=31%2C29&mn=sn-ab5sznld%2Csn-ab5l6nrl&ms=au%2Crdu&mv=m&mvi=2&pl=24&initcwndbps=728750&spc=UWF9f4D6VFfEy0EeR8ZK6hy_q-VncZX2W__J&vprv=1&svpuc=1&mime=audio%2Fwebm&gir=yes&clen=10076170&dur=598.561&lmt=1496517559027508&mt=1712274296&fvip=4&keepalive=yes&fexp=51141541&c=ANDROID&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cxpc%2Cspc%2Cvprv%2Csvpuc%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&sig=AJfQdSswRQIhAIVw2HtnrBMd-Uz4aKaONo60xsju7-BvTBw_QwuWuHp9AiBNyYLBixzhBkZbfdD88nyHxJwUHBSl4WgW1_O37Ps-tA%3D%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=ALClDIEwRQIhAMfB7NPQg1jGYoxK0hYxTPxn_PAgksqTB1GGbhSE2m61AiAk2J_0-ClZc4B5wN67HNR9giuqbvqNYOWg0PrCItVOvQ%3D%3D"
[download] Destination: Shephard's Mind Episode 1 [GNaJX6gOYMA].f251.webm
[download] 100% of    9.61MiB in 00:00:06 at 1.42MiB/s
[Merger] Merging formats into "Shephard's Mind Episode 1 [GNaJX6gOYMA].webm"
[debug] ffmpeg command line: ffmpeg -y -loglevel "repeat+info" -i "file:Shephard's Mind Episode 1 [GNaJX6gOYMA].f244.webm" -i "file:Shephard's Mind Episode 1 [GNaJX6gOYMA].f251.webm" -c copy -map "0:v:0" -map "1:a:0" -movflags "+faststart" "file:Shephard's Mind Episode 1 [GNaJX6gOYMA].temp.webm"
Deleting original file Shephard's Mind Episode 1 [GNaJX6gOYMA].f244.webm (pass -k to keep)
Deleting original file Shephard's Mind Episode 1 [GNaJX6gOYMA].f251.webm (pass -k to keep)
[EmbedSubtitle] Embedding subtitles in "Shephard's Mind Episode 1 [GNaJX6gOYMA].webm"
[debug] ffmpeg command line: ffmpeg -y -loglevel "repeat+info" -i "file:Shephard's Mind Episode 1 [GNaJX6gOYMA].webm" -i "file:Shephard's Mind Episode 1 [GNaJX6gOYMA].en.vtt" -map 0 -dn -ignore_unknown -c copy -map "-0:s" -map "1:0" "-metadata:s:s:0" "language=eng" "-metadata:s:s:0" "handler_name=English" "-metadata:s:s:0" "title=English" -movflags "+faststart" "file:Shephard's Mind Episode 1 [GNaJX6gOYMA].temp.webm"
Deleting original file Shephard's Mind Episode 1 [GNaJX6gOYMA].en.vtt (pass -k to keep)
```