Repository: yt-dlp
Issue: Error: "Invalid data found when processing input" on Bilibili after postprocessing when --embed-subs is used
Labels: 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)
- [X] 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

Downloading Bilibili anthology  with the `--embed-subs` flag appeared successful, but during post-processing of each video by ffmpeg, I received the following error message:

```
yt_dlp.postprocessor.ffmpeg.FFmpegPostProcessorError: Error opening input files: Invalid data found when processing input
```

### 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] 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: ['--embed-subs', 'https://www.bilibili.com/video/BV1TK421i72D/?spm_id_from=333.337.search-card.all.click', '-vvv']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2024.05.27 from yt-dlp/yt-dlp [12b248ce6] (pip)
[debug] Python 3.12.3 (CPython x86_64 64bit) - Linux-6.8.0-31-generic-x86_64-with-glibc2.39 (OpenSSL 3.0.13 30 Jan 2024, glibc 2.39)
[debug] exe versions: ffmpeg 6.1.1 (setts), ffprobe 6.1.1
[debug] Optional libraries: Cryptodome-3.20.0, brotli-1.1.0, certifi-2024.02.02, mutagen-1.47.0, requests-2.32.3, sqlite3-3.45.1, urllib3-2.2.1, websockets-12.0
[debug] Proxy map: {}
[debug] Request Handlers: urllib, requests, websockets
[debug] Loaded 1820 extractors
[BiliBili] Extracting URL: https://www.bilibili.com/video/BV1TK421i72D/?spm_id_from=333.337.search-card.all.click
[BiliBili] 1TK421i72D: Downloading webpage
[BiliBili] BV1TK421i72D: Extracting videos in anthology
[BiliBili] Downloading playlist BV1TK421i72D - add --no-playlist to download just the video BV1TK421i72D
[download] Downloading playlist: 【英语达人必看】TED-ED动画全系列：全球人文历史知识大揭秘（1-142集）
[BiliBili] Playlist 【英语达人必看】TED-ED动画全系列：全球人文历史知识大揭秘（1-142集）: Downloading 85 items of 85
[download] Downloading item 1 of 85
[BiliBili] Extracting URL: https://www.bilibili.com/video/BV1TK421i72D?p=1
[BiliBili] 1TK421i72D: Downloading webpage
[BiliBili] BV1TK421i72D: Extracting videos in anthology
[BiliBili] 1702017548: Extracting chapters
[BiliBili] BV1TK421i72D: Extracting subtitle info 1477217701
[BiliBili] Format(s) 1080P 高清, 720P 高清 are missing; you have to login or become premium member to download them. Use --cookies-from-browser or --cookies for the authentication. See  https://github.com/yt-dlp/yt-dlp/wiki/FAQ#how-do-i-pass-cookies-to-yt-dlp  for how to manually pass cookies
[info] BV1TK421i72D_p1: Downloading subtitles: danmaku
[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
[debug] Default format spec: bestvideo*+bestaudio/best
[info] BV1TK421i72D_p1: Downloading 1 format(s): 30033+30280
[info] Writing video subtitles to: 【英语达人必看】TED-ED动画全系列：全球人文历史知识大揭秘（1-142集） p01 001-酒精的简史【双语字幕】 [BV1TK421i72D_p1].danmaku.xml
[debug] Invoking http downloader on "https://comment.bilibili.com/1477217701.xml"
[download] Destination: 【英语达人必看】TED-ED动画全系列：全球人文历史知识大揭秘（1-142集） p01 001-酒精的简史【双语字幕】 [BV1TK421i72D_p1].danmaku.xml
[download] 100% of    1.74KiB in 00:00:01 at 1.19KiB/s
[debug] Invoking http downloader on "https://upos-hz-mirrorakam.akamaized.net/upgcxcode/01/77/1477217701/1477217701-1-30033.m4s?e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M=&uipk=5&nbs=1&deadline=1717681103&gen=playurlv2&os=akam&oi=1107929280&trid=0c19aef39fbb482fa4008fc7fbdabd3du&mid=0&platform=pc&og=cos&upsig=de71088dd7236fda1fced9e0ebf9918e&uparams=e,uipk,nbs,deadline,gen,os,oi,trid,mid,platform,og&hdnts=exp=1717681103~hmac=f3f74ad136c23ae7dd2e0fee636b14658c3c81068815701a5ff65773b552bbd1&bvc=vod&nettype=0&orderid=0,1&buvid=6CC42E15-4FE8-18A6-FDB8-F516BDEF54ED01083infoc&build=0&f=u_0_0&agrr=0&bw=19569&logo=80000000"
[download] Destination: 【英语达人必看】TED-ED动画全系列：全球人文历史知识大揭秘（1-142集） p01 001-酒精的简史【双语字幕】 [BV1TK421i72D_p1].f30033.mp4
[download] 100% of    5.92MiB in 00:00:06 at 997.54KiB/s
[debug] Invoking http downloader on "https://upos-sz-mirroraliov.bilivideo.com/upgcxcode/01/77/1477217701/1477217701-1-30280.m4s?e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M=&uipk=5&nbs=1&deadline=1717681103&gen=playurlv2&os=aliovbv&oi=1107929280&trid=0c19aef39fbb482fa4008fc7fbdabd3du&mid=0&platform=pc&og=cos&upsig=90c33b314dafd8199b485ee0960fb639&uparams=e,uipk,nbs,deadline,gen,os,oi,trid,mid,platform,og&bvc=vod&nettype=0&orderid=0,1&buvid=6CC42E15-4FE8-18A6-FDB8-F516BDEF54ED01083infoc&build=0&f=u_0_0&agrr=0&bw=20885&logo=80000000"
[download] Destination: 【英语达人必看】TED-ED动画全系列：全球人文历史知识大揭秘（1-142集） p01 001-酒精的简史【双语字幕】 [BV1TK421i72D_p1].f30280.m4a
[download] 100% of    6.31MiB in 00:00:06 at 1016.84KiB/s
[Merger] Merging formats into "【英语达人必看】TED-ED动画全系列：全球人文历史知识大揭秘（1-142集） p01 001-酒精的简史【双语字幕】 [BV1TK421i72D_p1].mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:【英语达人必看】TED-ED动画全系列：全球人文历史知识大揭秘（1-142集） p01 001-酒精的简史【双语字幕】 [BV1TK421i72D_p1].f30033.mp4' -i 'file:【英语达人必看】TED-ED动画全系列：全球人文历史知识大揭秘（1-142集） p01 001-酒精的简史【双语字幕】 [BV1TK421i72D_p1].f30280.m4a' -c copy -map 0:v:0 -map 1:a:0 -movflags +faststart 'file:【英语达人必看】TED-ED动画全系列：全球人文历史知识大揭秘（1-142集） p01 001-酒精的简史【双语字幕】 [BV1TK421i72D_p1].temp.mp4'
Deleting original file 【英语达人必看】TED-ED动画全系列：全球人文历史知识大揭秘（1-142集） p01 001-酒精的简史【双语字幕】 [BV1TK421i72D_p1].f30280.m4a (pass -k to keep)
Deleting original file 【英语达人必看】TED-ED动画全系列：全球人文历史知识大揭秘（1-142集） p01 001-酒精的简史【双语字幕】 [BV1TK421i72D_p1].f30033.mp4 (pass -k to keep)
[EmbedSubtitle] Embedding subtitles in "【英语达人必看】TED-ED动画全系列：全球人文历史知识大揭秘（1-142集） p01 001-酒精的简史【双语字幕】 [BV1TK421i72D_p1].mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:【英语达人必看】TED-ED动画全系列：全球人文历史知识大揭秘（1-142集） p01 001-酒精的简史【双语字幕】 [BV1TK421i72D_p1].mp4' -i 'file:【英语达人必看】TED-ED动画全系列：全球人文历史知识大揭秘（1-142集） p01 001-酒精的简史【双语字幕】 [BV1TK421i72D_p1].danmaku.xml' -map 0 -dn -ignore_unknown -c copy -c:s mov_text -map -0:s -map 1:0 -metadata:s:s:0 language=dan -movflags +faststart 'file:【英语达人必 看】TED-ED动画全系列：全球人文历史知识大揭秘（1-142集） p01 001-酒精的简史【双语字幕】 [BV1TK421i72D_p1].temp.mp4'
[debug] ffmpeg version 6.1.1-3ubuntu5 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 13 (Ubuntu 13.2.0-23ubuntu3)
  configuration: --prefix=/usr --extra-version=3ubuntu5 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --disable-omx --enable-gnutls --enable-libaom --enable-libass --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libharfbuzz --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-openal --enable-opencl --enable-opengl --disable-sndio --enable-libvpl --disable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-ladspa --enable-libbluray --enable-libjack --enable-libpulse --enable-librabbitmq --enable-librist --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libx264 --enable-libzmq --enable-libzvbi --enable-lv2 --enable-sdl2 --enable-libplacebo --enable-librav1e --enable-pocketsphinx --enable-librsvg --enable-libjxl --enable-shared
  libavutil      58. 29.100 / 58. 29.100
  libavcodec     60. 31.102 / 60. 31.102
  libavformat    60. 16.100 / 60. 16.100
  libavdevice    60.  3.100 / 60.  3.100
  libavfilter     9. 12.100 /  9. 12.100
  libswscale      7.  5.100 /  7.  5.100
  libswresample   4. 12.100 /  4. 12.100
  libpostproc    57.  3.100 / 57.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'file:【英语达人必看】TED-ED动画全系列：全球人文历史知识大揭秘（1-142集） p01 001-酒精的简史【双语字幕】 [BV1TK421i72D_p1].mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf60.16.100
    description     : Packed by Bilibili XCoder v2.0.2
  Duration: 00:05:17.43, start: 0.000000, bitrate: 328 kb/s
  Stream #0:0[0x1](und): Video: hevc (Main) (hev1 / 0x31766568), yuv420p(tv, bt709), 852x480, 153 kb/s, 30 fps, 30 tbr, 16k tbn (default)
    Metadata:
      handler_name    : Bento4 Video Handler
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 165 kb/s (default)
    Metadata:
      handler_name    : Bento4 Sound Handler
      vendor_id       : [0][0][0][0]
[in#1 @ 0x6047cbfd4700] Error opening input: Invalid data found when processing input
Error opening input file file:【英语达人必看】TED-ED动画全系列：全球人文历史知识大揭秘（1-142集） p01 001-酒精的简史【双语字幕】 [BV1TK421i72D_p1].danmaku.xml.
Error opening input files: Invalid data found when processing input

ERROR: Postprocessing: Error opening input files: Invalid data found when processing input
Traceback (most recent call last):
  File "/root/.local/share/pipx/venvs/xklb/lib/python3.12/site-packages/yt_dlp/YoutubeDL.py", line 3537, in process_info
    replace_info_dict(self.post_process(dl_filename, info_dict, files_to_move))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/share/pipx/venvs/xklb/lib/python3.12/site-packages/yt_dlp/YoutubeDL.py", line 3719, in post_process
    info = self.run_all_pps('post_process', info, additional_pps=info.get('__postprocessors'))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/share/pipx/venvs/xklb/lib/python3.12/site-packages/yt_dlp/YoutubeDL.py", line 3701, in run_all_pps
    info = self.run_pp(pp, info)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/share/pipx/venvs/xklb/lib/python3.12/site-packages/yt_dlp/YoutubeDL.py", line 3679, in run_pp
    files_to_delete, infodict = pp.run(infodict)
                                ^^^^^^^^^^^^^^^^
  File "/root/.local/share/pipx/venvs/xklb/lib/python3.12/site-packages/yt_dlp/postprocessor/common.py", line 23, in run
    ret = func(self, info, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/share/pipx/venvs/xklb/lib/python3.12/site-packages/yt_dlp/postprocessor/common.py", line 128, in wrapper
    return func(self, info)
           ^^^^^^^^^^^^^^^^
  File "/root/.local/share/pipx/venvs/xklb/lib/python3.12/site-packages/yt_dlp/postprocessor/ffmpeg.py", line 662, in run
    self.run_ffmpeg_multiple_files(input_files, temp_filename, opts)
  File "/root/.local/share/pipx/venvs/xklb/lib/python3.12/site-packages/yt_dlp/postprocessor/ffmpeg.py", line 329, in run_ffmpeg_multiple_files
    return self.real_run_ffmpeg(
           ^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/share/pipx/venvs/xklb/lib/python3.12/site-packages/yt_dlp/postprocessor/ffmpeg.py", line 367, in real_run_ffmpeg
    raise FFmpegPostProcessorError(stderr.strip().splitlines()[-1])
yt_dlp.postprocessor.ffmpeg.FFmpegPostProcessorError: Error opening input files: Invalid data found when processing input
```
```