yt-dlp: [youtube] Invalid data found when processing input

DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

  • I understand that I will be blocked if I intentionally remove or skip any mandatory* field

Checklist

Region

Japan

Provide a description that is worded well enough to be understood

It looks like #7536 but youtube video. When trying to download a video, I encountered the error “Invalid data found when processing input”.

Provide verbose output that clearly demonstrates the problem

  • 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
  • Copy the WHOLE output (starting with [debug] Command-line config) and insert it below

Complete Verbose Output

[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8 (No ANSI), error utf-8 (No ANSI), screen utf-8 (No ANSI)
[debug] yt-dlp version stable@2023.07.06 [b532a3481] (pip) API
[debug] params: {'quiet': True, 'no_color': True, 'paths': {'home': '/tmp', 'temp': '/downloads'}, 'outtmpl': {'default': '[%(upload_date)s]%(title).50s[%(id)s].%(ext)s', 'chapter': '%(title)s - %(section_number)s %(section_title)s.%(ext)s'}, 'format': 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]', 'socket_timeout': 30, 'progress_hooks': [<function Download._download.<locals>.put_status at 0x7f8293ba5820>], 'postprocessor_hooks': [<function Download._download.<locals>.put_status_postprocessor at 0x7f8293ba58b0>], 'verbose': True, 'cookiefile': '/downloads/.metube/cookies.txt', 'ignoreerrors': True, 'postprocessors': [{'key': 'FFmpegMetadata', 'add_metadata': 'True'}, {'key': 'Exec', 'exec_cmd': 'sh /downloads/execafterdownload.sh', 'when': 'after_move'}], 'color': 'no_color', 'compat_opts': set()}
[debug] Python 3.8.16 (CPython x86_64 64bit) - Linux-6.1.8-0-virt-x86_64-with (OpenSSL 3.0.8 7 Feb 2023)
[debug] exe versions: ffmpeg 5.1.3 (setts), ffprobe 5.1.3
[debug] Optional libraries: Cryptodome-3.18.0, brotli-1.0.9, certifi-2023.05.07, mutagen-1.46.0, sqlite3-2.6.0, websockets-11.0.3
[debug] Proxy map: {}
[debug] Loaded 1855 extractors
[youtube] Extracting URL: https://www.youtube.com/watch?v=f5Uzch756nc
[youtube] f5Uzch756nc: Downloading webpage
[youtube] f5Uzch756nc: Downloading ios player API JSON
[youtube] f5Uzch756nc: Downloading android player API JSON
[youtube] f5Uzch756nc: Downloading m3u8 information
[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
[info] f5Uzch756nc: Downloading 1 format(s): 642+140
[debug] Invoking hlsnative downloader on "https://manifest.googlevideo.com/api/manifest/hls_playlist/expire/1688835826/ei/kkKpZO7BKvWi1d8PmtuG-Ak/ip/45.159.48.165/id/7f9533721ef9ea77/itag/642/source/youtube/requiressl/yes/ratebypass/yes/pfa/1/wft/1/sgovp/clen%3D1057155420%3Bdur%3D366.900%3Bgir%3Dyes%3Bitag%3D337%3Blmt%3D1688654233993805/hls_chunk_host/rr1---sn-oguesndr.googlevideo.com/mh/Xb/mm/31,26/mn/sn-oguesndr,sn-npoeenl7/ms/au,onr/mv/m/mvi/1/pl/24/force_finished/1/initcwndbps/51556250/bui/AYlvQAstEx-TmrBjHORvumFp8MB42nG8Wfwb5bluRwWaB_2Ze8q_sWSDsvu5WE5DO1CJcDC4sjhQ3aCo7GEjdCzIIggMulYN/vprv/1/playlist_type/DVR/dover/13/txp/5402434/mt/1688813824/fvip/2/short_key/1/keepalive/yes/fexp/24007246,51000012/sparams/expire,ei,ip,id,itag,source,requiressl,ratebypass,pfa,wft,sgovp,force_finished,bui,vprv,playlist_type/sig/AOq0QJ8wRAIgMRdLDRlu1mhwFoA4QbIFEc0ZZniUjadS_5qj8Dx7LxMCIFlRN1bH9txI_QjbmBm6t12iqVjWmbhPwg2PV9qUe1XE/lsparams/hls_chunk_host,mh,mm,mn,ms,mv,mvi,pl,initcwndbps/lsig/AG3C_xAwRgIhAMGYyOyH9tT1I6qrb3s-lBBYksVcFz7r5ZCfx88xE6zEAiEAnxXBagSTEhI-TOLpUbVuUPXLg5dHlPhVyPID1RV6Tds%3D/playlist/index.m3u8"
[download] /downloads/[20230706]君の太陽 - 山猿 Kimi no taiyou arrange cover by しまも 「僕は君[f5Uzch756nc].f642.mp4 has already been downloaded
[debug] Invoking http downloader on "https://rr1---sn-oguesndr.googlevideo.com/videoplayback?expire=1688835826&ei=kkKpZO7BKvWi1d8PmtuG-Ak&ip=45.159.48.165&id=o-AA02UKlV9VPJWK2FMaKpFF6GhxF8kjXzGiSD_t-LQbDS&itag=140&source=youtube&requiressl=yes&mh=Xb&mm=31%2C26&mn=sn-oguesndr%2Csn-npoeenl7&ms=au%2Conr&mv=m&mvi=1&pl=24&initcwndbps=51556250&bui=AYlvQAui09-gz_8Zf0b9JsxEFJFwlsJfy1M6sJ_MaviwhbcSR2pYtgg_589TThnBf5b2IL6ekja65RFyuT5OtxeD5dvkX4_q&vprv=1&svpuc=1&mime=audio%2Fmp4&gir=yes&clen=5939287&dur=366.944&lmt=1688647903583735&mt=1688813824&fvip=2&keepalive=yes&fexp=24007246%2C51000012&c=IOS&txp=5402434&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cbui%2Cvprv%2Csvpuc%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRAIgK6fEM14iRJoHev0eksANhsFfG5rXkAKDDt_H2qzlOFECIB68av3xP_E9CGVbZCWC1HmUIwbnDcAc3gTcqxQ6m9bs&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRgIhAOuLqtceq08_9N-Mo8aZ1Ys3cSCX-UAELRs1Gtv53uj2AiEA5FB3M55ZlGsKoQyHKY9wAItOv4rrR2FY-OZw5ZmQyGk%3D"
[download] /downloads/[20230706]君の太陽 - 山猿 Kimi no taiyou arrange cover by しまも 「僕は君[f5Uzch756nc].f140.m4a has already been downloaded
[Merger] Merging formats into "/downloads/[20230706]君の太陽 - 山猿 Kimi no taiyou arrange cover by しまも 「僕は君[f5Uzch756nc].mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:/downloads/[20230706]君の太陽 - 山猿 Kimi no taiyou arrange cover by しまも 「僕は君[f5Uzch756nc].f642.mp4' -i 'file:/downloads/[20230706]君の太陽 - 山猿 Kimi no taiyou arrange cover by しまも 「僕は君[f5Uzch756nc].f140.m4a' -c copy -map 0:v:0 -map 1:a:0 -movflags +faststart 'file:/downloads/[20230706]君の太陽 - 山猿 Kimi no taiyou arrange cover by しまも 「僕は君[f5Uzch756nc].temp.mp4'
[debug] ffmpeg version 5.1.3 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 12.2.1 (Alpine 12.2.1_git20220924-r4) 20220924
  configuration: --prefix=/usr --enable-avfilter --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-gnutls --enable-gpl --enable-libass --enable-libmp3lame --enable-libpulse --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libx264 --enable-libx265 --enable-libtheora --enable-libv4l2 --enable-libdav1d --enable-lto --enable-postproc --enable-pic --enable-pthreads --enable-shared --enable-libxcb --enable-librist --enable-libsrt --enable-libssh --enable-libvidstab --disable-stripping --disable-static --disable-librtmp --disable-lzma --enable-libaom --enable-libopus --enable-libsoxr --enable-libwebp --enable-vaapi --enable-vdpau --enable-vulkan --enable-libdrm --enable-libzmq --optflags=-O2 --disable-debug --enable-libsvtav1
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f1b8d86c100] error reading header
file:/downloads/[20230706]君の太陽 - 山猿 Kimi no taiyou arrange cover by しまも 「僕は君[f5Uzch756nc].f642.mp4: Invalid data found when processing input

ERROR: file:/downloads/[20230706]君の太陽 - 山猿 Kimi no taiyou arrange cover by しまも 「僕は君[f5Uzch756nc].f642.mp4: Invalid data found when processing input
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 3581, in run_pp
    files_to_delete, infodict = pp.run(infodict)
  File "/usr/local/lib/python3.8/site-packages/yt_dlp/postprocessor/common.py", line 24, in run
    ret = func(self, info, *args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/yt_dlp/postprocessor/common.py", line 129, in wrapper
    return func(self, info)
  File "/usr/local/lib/python3.8/site-packages/yt_dlp/postprocessor/ffmpeg.py", line 837, in run
    self.run_ffmpeg_multiple_files(info['__files_to_merge'], temp_filename, args)
  File "/usr/local/lib/python3.8/site-packages/yt_dlp/postprocessor/ffmpeg.py", line 329, in run_ffmpeg_multiple_files
    return self.real_run_ffmpeg(
  File "/usr/local/lib/python3.8/site-packages/yt_dlp/postprocessor/ffmpeg.py", line 367, in real_run_ffmpeg
    raise FFmpegPostProcessorError(stderr.strip().splitlines()[-1])
yt_dlp.postprocessor.ffmpeg.FFmpegPostProcessorError: file:/downloads/[20230706]君の太陽 - 山猿 Kimi no taiyou arrange cover by しまも 「僕は君[f5Uzch756nc].f642.mp4: Invalid data found when processing input

[Metadata] Adding metadata to "/downloads/[20230706]君の太陽 - 山猿 Kimi no taiyou arrange cover by しまも 「僕は君[f5Uzch756nc].mp4"
ERROR: [Errno 2] No such file or directory: '/downloads/[20230706]君の太陽 - 山猿 Kimi no taiyou arrange cover by しまも 「僕は君[f5Uzch756nc].mp4'
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 1560, in wrapper
    return func(self, *args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 1709, in __extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "/usr/local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 1768, in process_ie_result
    ie_result = self.process_video_result(ie_result, download=download)
  File "/usr/local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 2897, in process_video_result
    self.process_info(new_info)
  File "/usr/local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 3439, in process_info
    replace_info_dict(self.post_process(dl_filename, info_dict, files_to_move))
  File "/usr/local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 3621, in post_process
    info = self.run_all_pps('post_process', info, additional_pps=info.get('__postprocessors'))
  File "/usr/local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 3603, in run_all_pps
    info = self.run_pp(pp, info)
  File "/usr/local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 3581, in run_pp
    files_to_delete, infodict = pp.run(infodict)
  File "/usr/local/lib/python3.8/site-packages/yt_dlp/postprocessor/common.py", line 24, in run
    ret = func(self, info, *args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/yt_dlp/postprocessor/common.py", line 129, in wrapper
    return func(self, info)
  File "/usr/local/lib/python3.8/site-packages/yt_dlp/postprocessor/ffmpeg.py", line 711, in run
    self.run_ffmpeg_multiple_files(
  File "/usr/local/lib/python3.8/site-packages/yt_dlp/postprocessor/ffmpeg.py", line 329, in run_ffmpeg_multiple_files
    return self.real_run_ffmpeg(
  File "/usr/local/lib/python3.8/site-packages/yt_dlp/postprocessor/ffmpeg.py", line 336, in real_run_ffmpeg
    oldest_mtime = min(
  File "/usr/local/lib/python3.8/site-packages/yt_dlp/postprocessor/ffmpeg.py", line 337, in <genexpr>
    os.stat(encodeFilename(path)).st_mtime for path, _ in input_path_opts if path)
FileNotFoundError: [Errno 2] No such file or directory: '/downloads/[20230706]君の太陽 - 山猿 Kimi no taiyou arrange cover by しまも 「僕は君[f5Uzch756nc].mp4'

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Comments: 30 (10 by maintainers)

Most upvoted comments

This has been reported to ffmpeg’s bugtracker: https://trac.ffmpeg.org/ticket/10711

based on my experience videos that are in HDR have this problem, I use -S +hdr (if you gonna use this put it before -f just in case, it didn’t work for me until I did that) to download the best non HDR one

You can do something like -f bestvideo[ext=mp4] or -f bestvideo[ext!=webm]

This doesn’t work because of the vp9-in-mp4 and av1 formats that Youtube serves.

So is it possible to set the default download format to h264 instead of vp09?

-S vcodec:h264,res,acodec:m4a

The format you are downloading is vp9 in mp4, which old ffmpeg cannot handle. Try updating ffmpeg to 6.0 and let us know if issue still exists.

issue still exists with ffmpeg 6.0

ffmpeg version 6.0 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12.2.1 (Alpine 12.2.1_git20220924-r4) 20220924

Tad late to the party but I’m also seeing this occasionally.

--enable-vp9-highbitdepth is a config opt for libvpx, not for ffmpeg

I am using an ffmpeg build dynamically linked to a libvpx that was compiled with --enable-vp9-highbitdepth, and I still experience the error.

It’s worth noting that this issue only presents with HDR VP9 in mp4 container formats, not the HDR VP9 webm formats that youtube serves.

A user on the discord server shared this link, which seems potentially related, but the workarounds given in the answer do not work. MP4Box can remux the HDR VP9 mp4, but ffmpeg still cannot read the resulting file.

yes ffmpeg3.4 works

the latest master build from yt-dlp/FFmpeg-Builds has the fix, if anyone wants to test it

@PikuZheng I don’t really know, but I believe that the issue here is indeed ffmpeg. MediaInfo, PotPlayer, VLC, those mkv tools, mp4box, have absolutely no issue with format 636 from Youtube - HDR10 VP9 in an MP4 container.

Maybe not working. . . I’ve been using static ffmpeg from here, but it has --enable-vp9-highbitdepth https://github.com/wader/static-ffmpeg/blob/2b0f49bcddb7cb0a703a1991a291b68c44211301/Dockerfile#L652

any solution if wanting to download the HDR version?