yt-dlp/yt-dlp

ERROR: Postprocessing: Conversion failed! (yt_dlp.postprocessor.ffmpeg.FFmpegPostProcessorError)

Jeeaaasus opened this issue ยท 22 comments

Checklist

  • I'm reporting a bug unrelated to a specific site
  • I've verified that I'm running yt-dlp version 2021.09.02
  • I've checked that all provided URLs are alive and playable in a browser
  • The provided URLs do not contain any DRM to the best of my knowledge
  • I've checked that all URLs and arguments with special characters are properly quoted or escaped
  • I've searched the bugtracker for similar bug reports including closed ones
  • I've read bugs section in FAQ

Verbose log

[debug] Custom config file: /config/args.conf
[debug] Custom config: ['--sponsorblock-mark', 'all', '--sponsorblock-remove', 'sponsor', '--output', '/downloads/%(uploader)s/%(title)s.%(ext)s', '--geo-bypass', '--playlist-end', '1', '--match-filter', '! is_live', '--abort-on-unavailable-fragment', '--playlist-reverse', '--windows-filenames', '--no-part', '--no-write-playlist-metafiles', '--no-cache-dir', '--cookies', '/config/cookies.txt', '--no-progress', '--merge-output-format', 'mp4', '--sub-langs', 'all,-live_chat', '--embed-subs', '--embed-thumbnail', '--add-metadata', '--convert-subs', 'srt']
[debug] Command-line config: ['--verbose', '--download-archive', '/config/archive.txt', '--config-location', '/config/args.conf', '--batch-file', '/config/channels.txt', '--format', '((bv*[fps>30]/bv*)[height<=1440]/(wv*[fps>30]/wv*)) + ba / (b[fps>30]/b)[height<=1440]/(w[fps>30]/w)']
[debug] Batch file urls: ['https://www.youtube.com/watch?v=8NK1I6S_vFs']
[debug] Loading archive file '/config/archive.txt'

[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] yt-dlp version 2021.09.02 (zip)
[debug] Python version 3.9.5 (CPython 64bit) - Linux-5.4.0-74-generic-x86_64-with
[debug] exe versions: ffmpeg 4.4, ffprobe 4.4
[debug] Optional libraries: mutagen, sqlite
[debug] Proxy map: {}
[debug] [youtube] Extracting URL: https://www.youtube.com/watch?v=8NK1I6S_vFs
[youtube] 8NK1I6S_vFs: Downloading webpage
[debug] [youtube] Extracted SAPISID cookie
[youtube] 8NK1I6S_vFs: Downloading android player API JSON
[debug] Sort order given by extractor: quality, res, fps, source, codec:vp9.2, lang
[debug] Formats sorted by: hasvid, ie_pref, quality, res, fps, source, vcodec:vp9.2(10), acodec, lang, filesize, fs_approx, tbr, vbr, abr, asr, proto, vext, aext, hasaud, id
[debug] Testing thumbnail 41
[debug] SponsorBlock query: https://sponsor.ajay.app/api/skipSegments/4c28?service=YouTube&categories=%5B%22sponsor%22%2C+%22music_offtopic%22%2C+%22interaction%22%2C+%22intro%22%2C+%22outro%22%2C+%22preview%22%2C+%22selfpromo%22%5D
[SponsorBlock] Found 5 segments in the SponsorBlock database
[info] 8NK1I6S_vFs: Downloading 1 format(s): 271+251
[debug] Testing thumbnail 39
[debug] Testing thumbnail 38
[debug] Testing thumbnail 37
[debug] Testing thumbnail 35
[debug] Testing thumbnail 34
[debug] Testing thumbnail 33
[debug] Testing thumbnail 32
[debug] Testing thumbnail 31
[debug] Testing thumbnail 30
[youtube] 8NK1I6S_vFs: Downloading thumbnail  ...
[youtube] 8NK1I6S_vFs: Writing thumbnail to: /downloads/Linus Tech Tips/Steam Deck Competitors are ALREADY Here.webp
[SubtitlesConvertor] There aren't any subtitles to convert
[debug] Invoking downloader on "https://r8---sn-uxaxovg-5god.googlevideo.com/videoplayback?expire=1630603835&ei=27UwYZGmC8v--gbGobzYAQ&ip=85.225.40.88&id=o-AOILCfE0RbSHRvT1V98oGy8PPbC6ap4haHXQEVrQfXHy&itag=271&source=youtube&requiressl=yes&mh=oq&mm=31%2C29&mn=sn-uxaxovg-5god%2Csn-5go7yne6&ms=au%2Crdu&mv=m&mvi=8&pl=22&pcm2=yes&initcwndbps=1920000&vprv=1&mime=video%2Fwebm&gir=yes&clen=584543772&dur=1132.398&lmt=1630531523085979&mt=1630581886&fvip=4&keepalive=yes&fexp=24001373%2C24007246&c=ANDROID&txp=5516222&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cpcm2%2Cvprv%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRAIhAPeb1ffaBEIwaYSEtJOK67z3voPJmScdFH7ycohP6EaPAh9rCfsMgZEhJ02OVh_jlIBbgJb0vqQW9tTujNKJO9IP&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIgabFH0Tj6do15NP9-nw6o-42xGRTAHZrlMEJ-Aee0jb0CIQD95PzdhTYfJGYfeLPdUEBhyR3mss_plQY-KXcIjIJc2w%3D%3D"
[download] Destination: /downloads/Linus Tech Tips/Steam Deck Competitors are ALREADY Here.f271.webm
[download] Download completed
[debug] Invoking downloader on "https://r8---sn-uxaxovg-5god.googlevideo.com/videoplayback?expire=1630603835&ei=27UwYZGmC8v--gbGobzYAQ&ip=85.225.40.88&id=o-AOILCfE0RbSHRvT1V98oGy8PPbC6ap4haHXQEVrQfXHy&itag=251&source=youtube&requiressl=yes&mh=oq&mm=31%2C29&mn=sn-uxaxovg-5god%2Csn-5go7yne6&ms=au%2Crdu&mv=m&mvi=8&pl=22&pcm2=yes&initcwndbps=1920000&vprv=1&mime=audio%2Fwebm&gir=yes&clen=15174355&dur=1132.441&lmt=1630531497030616&mt=1630581886&fvip=4&keepalive=yes&fexp=24001373%2C24007246&c=ANDROID&txp=5511222&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cpcm2%2Cvprv%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRQIhAMM-jf-RLDEddjOAZ-G1i4EdzDPVksMQPbXJ2wHsWD9_AiBJt-P8Ac7vM3hJEeyJRyHcscRBo-Z9WbQEz1LE01Y5Iw%3D%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIgabFH0Tj6do15NP9-nw6o-42xGRTAHZrlMEJ-Aee0jb0CIQD95PzdhTYfJGYfeLPdUEBhyR3mss_plQY-KXcIjIJc2w%3D%3D"
[download] Destination: /downloads/Linus Tech Tips/Steam Deck Competitors are ALREADY Here.f251.webm
[download] Download completed
[Merger] Merging formats into "/downloads/Linus Tech Tips/Steam Deck Competitors are ALREADY Here.mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:/downloads/Linus Tech Tips/Steam Deck Competitors are ALREADY Here.f271.webm' -i 'file:/downloads/Linus Tech Tips/Steam Deck Competitors are ALREADY Here.f251.webm' -c copy -map 0:v:0 -map 1:a:0 'file:/downloads/Linus Tech Tips/Steam Deck Competitors are ALREADY Here.temp.mp4'
Deleting original file /downloads/Linus Tech Tips/Steam Deck Competitors are ALREADY Here.f271.webm (pass -k to keep)
Deleting original file /downloads/Linus Tech Tips/Steam Deck Competitors are ALREADY Here.f251.webm (pass -k to keep)
[EmbedSubtitle] There aren't any subtitles to embed
[debug] ffprobe command line: ffprobe -hide_banner -show_format -show_streams -print_format json 'file:/downloads/Linus Tech Tips/Steam Deck Competitors are ALREADY Here.mp4'
[debug] Writing concat spec to /downloads/Linus Tech Tips/Steam Deck Competitors are ALREADY Here.temp.mp4.concat
[ModifyChapters] Removing chapters from /downloads/Linus Tech Tips/Steam Deck Competitors are ALREADY Here.mp4
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -hide_banner -nostdin -f concat -safe 0 -i 'file:/downloads/Linus Tech Tips/Steam Deck Competitors are ALREADY Here.temp.mp4.concat' -c copy -c:s mov_text -movflags +faststart 'file:/downloads/Linus Tech Tips/Steam Deck Competitors are ALREADY Here.temp.mp4'
ERROR: Input #0, concat, from 'file:/downloads/Linus Tech Tips/Steam Deck Competitors are ALREADY Here.temp.mp4.concat':
  Duration: N/A, start: 0.000000, bitrate: 4232 kb/s
  Stream #0:0(eng): Video: vp9 (Profile 0) (vp09 / 0x39307076), yuv420p(tv, bt709), 2560x1280, 4127 kb/s, SAR 1:1 DAR 2:1, 29.97 fps, 29.97 tbr, 16k tbn, 16k tbc
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1(eng): Audio: opus (Opus / 0x7375704F), 48000 Hz, stereo, fltp, 104 kb/s
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
[mp4 @ 0x7f7ec228d100] track 1: codec frame size is not set
Output #0, mp4, to 'file:/downloads/Linus Tech Tips/Steam Deck Competitors are ALREADY Here.temp.mp4':
  Metadata:
    encoder         : Lavf58.76.100
  Stream #0:0(eng): Video: vp9 (Profile 0) (vp09 / 0x39307076), yuv420p(tv, bt709), 2560x1280 [SAR 1:1 DAR 2:1], q=2-31, 4127 kb/s, 29.97 fps, 29.97 tbr, 16k tbn, 16k tbc
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1(eng): Audio: opus (Opus / 0x7375704F), 48000 Hz, stereo, fltp, 104 kb/s
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
[mp4 @ 0x7f7ec228d100] Non-monotonous DTS in output stream 0:1; previous: 2949168, current: 2941824; changing to 2949169. This may result in incorrect timestamps in the output file.
[concat @ 0x7f7ec3771640] DTS 980816 < 982848 out of order
[mp4 @ 0x7f7ec228d100] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 982848 >= 980816
av_interleaved_write_frame(): Invalid argument
[mp4 @ 0x7f7ec228d100] Starting second pass: moving the moov atom to the beginning of the file
frame= 1843 fps=0.0 q=-1.0 Lsize=   36332kB time=00:01:01.44 bitrate=4844.2kbits/s speed=64.7x
video:35425kB audio:853kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.149294%
Conversion failed!
  File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/usr/bin/yt-dlp/__main__.py", line 19, in <module>
    yt_dlp.main()
  File "/usr/bin/yt-dlp/yt_dlp/__init__.py", line 776, in main
    _real_main(argv)
  File "/usr/bin/yt-dlp/yt_dlp/__init__.py", line 766, in _real_main
    retcode = ydl.download(all_urls)
  File "/usr/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 2894, in download
    res = self.extract_info(
  File "/usr/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 1207, in extract_info
    return self.__extract_info(url, self.get_info_extractor(ie_key), download, extra_info, process)
  File "/usr/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 1214, in wrapper
    return func(self, *args, **kwargs)
  File "/usr/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 1252, in __extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "/usr/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 1298, in process_ie_result
    ie_result = self.process_video_result(ie_result, download=download)
  File "/usr/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 2320, in process_video_result
    self.process_info(new_info)
  File "/usr/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 2864, in process_info
    info_dict = self.post_process(dl_filename, info_dict, files_to_move)
  File "/usr/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 3015, in post_process
    info = self.run_pp(pp, info)
  File "/usr/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 2964, in run_pp
    files_to_delete, infodict = pp.run(infodict)
  File "/usr/bin/yt-dlp/yt_dlp/postprocessor/common.py", line 83, in wrapper
    return func(self, info)
  File "/usr/bin/yt-dlp/yt_dlp/postprocessor/modify_chapters.py", line 64, in run
    in_out_files = [remove_chapters(info['filepath'], False)]
  File "/usr/bin/yt-dlp/yt_dlp/postprocessor/modify_chapters.py", line 62, in remove_chapters
    return file, self.remove_chapters(file, cuts, concat_opts, self._force_keyframes and not is_sub)
  File "/usr/bin/yt-dlp/yt_dlp/postprocessor/modify_chapters.py", line 316, in remove_chapters
    self.concat_files([in_file] * len(concat_opts), out_file, concat_opts)
  File "/usr/bin/yt-dlp/yt_dlp/postprocessor/ffmpeg.py", line 332, in concat_files
    self.real_run_ffmpeg(
  File "/usr/bin/yt-dlp/yt_dlp/postprocessor/ffmpeg.py", line 274, in real_run_ffmpeg
    self.report_error(stderr)
  File "/usr/bin/yt-dlp/yt_dlp/postprocessor/common.py", line 56, in report_error
    return self._downloader.report_error(text, *args, **kwargs)
  File "/usr/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 818, in report_error
    self.trouble(error_message, tb)
  File "/usr/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 774, in trouble
    tb_data = traceback.format_list(traceback.extract_stack())

ERROR: Postprocessing: Conversion failed!
Traceback (most recent call last):
  File "/usr/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 2864, in process_info
    info_dict = self.post_process(dl_filename, info_dict, files_to_move)
  File "/usr/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 3015, in post_process
    info = self.run_pp(pp, info)
  File "/usr/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 2964, in run_pp
    files_to_delete, infodict = pp.run(infodict)
  File "/usr/bin/yt-dlp/yt_dlp/postprocessor/common.py", line 83, in wrapper
    return func(self, info)
  File "/usr/bin/yt-dlp/yt_dlp/postprocessor/modify_chapters.py", line 64, in run
    in_out_files = [remove_chapters(info['filepath'], False)]
  File "/usr/bin/yt-dlp/yt_dlp/postprocessor/modify_chapters.py", line 62, in remove_chapters
    return file, self.remove_chapters(file, cuts, concat_opts, self._force_keyframes and not is_sub)
  File "/usr/bin/yt-dlp/yt_dlp/postprocessor/modify_chapters.py", line 316, in remove_chapters
    self.concat_files([in_file] * len(concat_opts), out_file, concat_opts)
  File "/usr/bin/yt-dlp/yt_dlp/postprocessor/ffmpeg.py", line 332, in concat_files
    self.real_run_ffmpeg(
  File "/usr/bin/yt-dlp/yt_dlp/postprocessor/ffmpeg.py", line 275, in real_run_ffmpeg
    raise FFmpegPostProcessorError(stderr.split('\n')[-1])
yt_dlp.postprocessor.ffmpeg.FFmpegPostProcessorError: Conversion failed!

Another url

[debug] Custom config file: /config/args.conf
[debug] Custom config: ['--sponsorblock-mark', 'all', '--sponsorblock-remove', 'sponsor', '--output', '/downloads/%(uploader)s/%(title)s.%(ext)s', '--geo-bypass', '--playlist-end', '1', '--match-filter', '! is_live', '--abort-on-unavailable-fragment', '--playlist-reverse', '--windows-filenames', '--no-part', '--no-write-playlist-metafiles', '--no-cache-dir', '--cookies', '/config/cookies.txt', '--no-progress', '--merge-output-format', 'mp4', '--sub-langs', 'all,-live_chat', '--embed-subs', '--embed-thumbnail', '--add-metadata', '--convert-subs', 'srt']
[debug] Command-line config: ['--verbose', '--download-archive', '/config/archive.txt', '--config-location', '/config/args.conf', '--batch-file', '/config/channels.txt', '--format', '((bv*[fps>30]/bv*)[height<=1440]/(wv*[fps>30]/wv*)) + ba / (b[fps>30]/b)[height<=1440]/(w[fps>30]/w)']
[debug] Batch file urls: ['https://www.youtube.com/watch?v=1uu9VWBgcBU']
[debug] Loading archive file '/config/archive.txt'

[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] yt-dlp version 2021.09.02 (zip)
[debug] Python version 3.9.5 (CPython 64bit) - Linux-5.4.0-74-generic-x86_64-with
[debug] exe versions: ffmpeg 4.4, ffprobe 4.4
[debug] Optional libraries: mutagen, sqlite
[debug] Proxy map: {}
[debug] [youtube] Extracting URL: https://www.youtube.com/watch?v=1uu9VWBgcBU
[youtube] 1uu9VWBgcBU: Downloading webpage
[debug] [youtube] Extracted SAPISID cookie
[youtube] 1uu9VWBgcBU: Downloading android player API JSON
[debug] Sort order given by extractor: quality, res, fps, source, codec:vp9.2, lang
[debug] Formats sorted by: hasvid, ie_pref, quality, res, fps, source, vcodec:vp9.2(10), acodec, lang, filesize, fs_approx, tbr, vbr, abr, asr, proto, vext, aext, hasaud, id
[debug] Testing thumbnail 41
[debug] Downloading subtitles: en-US
[debug] SponsorBlock query: https://sponsor.ajay.app/api/skipSegments/de9c?service=YouTube&categories=%5B%22sponsor%22%2C+%22intro%22%2C+%22outro%22%2C+%22preview%22%2C+%22music_offtopic%22%2C+%22selfpromo%22%2C+%22interaction%22%5D
[SponsorBlock] Found 5 segments in the SponsorBlock database
[info] 1uu9VWBgcBU: Downloading 1 format(s): 271+251
...
[ModifyChapters] Removing chapters from /downloads/Marques Brownlee/Samsung Z Flip 3 Review - The First Big Step!.mp4
[debug] Writing concat spec to /downloads/Marques Brownlee/Samsung Z Flip 3 Review - The First Big Step!.temp.mp4.concat
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -hide_banner -nostdin -f concat -safe 0 -i 'file:/downloads/Marques Brownlee/Samsung Z Flip 3 Review - The First Big Step!.temp.mp4.concat' -c copy -c:s mov_text -movflags +faststart 'file:/downloads/Marques Brownlee/Samsung Z Flip 3 Review - The First Big Step!.temp.mp4'
ERROR: Input #0, concat, from 'file:/downloads/Marques Brownlee/Samsung Z Flip 3 Review - The First Big Step!.temp.mp4.concat':
  Duration: N/A, start: 0.000000, bitrate: 2634 kb/s
  Stream #0:0(eng): Video: vp9 (Profile 0) (vp09 / 0x39307076), yuv420p(tv, bt709), 2560x1280, 2518 kb/s, SAR 1:1 DAR 2:1, 29.97 fps, 29.97 tbr, 16k tbn, 16k tbc
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1(eng): Audio: opus (Opus / 0x7375704F), 48000 Hz, stereo, fltp, 115 kb/s
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
  Stream #0:2(eng): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
    Metadata:
      handler_name    : SubtitleHandler
Multiple -c, -codec, -acodec, -vcodec, -scodec or -dcodec options specified for stream 2, only the last option '-c:s mov_text' will be used.
[mp4 @ 0x7f338f99b2c0] track 1: codec frame size is not set
Output #0, mp4, to 'file:/downloads/Marques Brownlee/Samsung Z Flip 3 Review - The First Big Step!.temp.mp4':
  Metadata:
    encoder         : Lavf58.76.100
  Stream #0:0(eng): Video: vp9 (Profile 0) (vp09 / 0x39307076), yuv420p(tv, bt709), 2560x1280 [SAR 1:1 DAR 2:1], q=2-31, 2518 kb/s, 29.97 fps, 29.97 tbr, 16k tbn, 16k tbc
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1(eng): Audio: opus (Opus / 0x7375704F), 48000 Hz, stereo, fltp, 115 kb/s
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
  Stream #0:2(eng): Subtitle: mov_text (tx3g / 0x67337874)
    Metadata:
      handler_name    : SubtitleHandler
      encoder         : Lavc58.134.100 mov_text
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
  Stream #0:2 -> #0:2 (mov_text (native) -> mov_text (native))
[mp4 @ 0x7f338f99b2c0] Non-monotonous DTS in output stream 0:1; previous: 5065968, current: 5064942; changing to 5065969. This may result in incorrect timestamps in the output file.
[concat @ 0x7f3390f40640] DTS 1688602 < 1688624 out of order
[mp4 @ 0x7f338f99b2c0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 1688624 >= 1688602
av_interleaved_write_frame(): Invalid argument
[mp4 @ 0x7f338f99b2c0] Starting second pass: moving the moov atom to the beginning of the file
frame= 3165 fps=2735 q=-1.0 Lsize=   34806kB time=00:01:45.54 bitrate=2701.6kbits/s speed=91.2x
video:33270kB audio:1524kB subtitle:2kB other streams:0kB global headers:0kB muxing overhead: 0.027754%
Conversion failed!
  File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/usr/bin/yt-dlp/__main__.py", line 19, in <module>
    yt_dlp.main()
  File "/usr/bin/yt-dlp/yt_dlp/__init__.py", line 776, in main
    _real_main(argv)
  File "/usr/bin/yt-dlp/yt_dlp/__init__.py", line 766, in _real_main
    retcode = ydl.download(all_urls)
  File "/usr/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 2894, in download
    res = self.extract_info(
  File "/usr/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 1207, in extract_info
    return self.__extract_info(url, self.get_info_extractor(ie_key), download, extra_info, process)
  File "/usr/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 1214, in wrapper
    return func(self, *args, **kwargs)
  File "/usr/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 1252, in __extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "/usr/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 1298, in process_ie_result
    ie_result = self.process_video_result(ie_result, download=download)
  File "/usr/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 2320, in process_video_result
    self.process_info(new_info)
  File "/usr/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 2864, in process_info
    info_dict = self.post_process(dl_filename, info_dict, files_to_move)
  File "/usr/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 3015, in post_process
    info = self.run_pp(pp, info)
  File "/usr/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 2964, in run_pp
    files_to_delete, infodict = pp.run(infodict)
  File "/usr/bin/yt-dlp/yt_dlp/postprocessor/common.py", line 83, in wrapper
    return func(self, info)
  File "/usr/bin/yt-dlp/yt_dlp/postprocessor/modify_chapters.py", line 64, in run
    in_out_files = [remove_chapters(info['filepath'], False)]
  File "/usr/bin/yt-dlp/yt_dlp/postprocessor/modify_chapters.py", line 62, in remove_chapters
    return file, self.remove_chapters(file, cuts, concat_opts, self._force_keyframes and not is_sub)
  File "/usr/bin/yt-dlp/yt_dlp/postprocessor/modify_chapters.py", line 316, in remove_chapters
    self.concat_files([in_file] * len(concat_opts), out_file, concat_opts)
  File "/usr/bin/yt-dlp/yt_dlp/postprocessor/ffmpeg.py", line 332, in concat_files
    self.real_run_ffmpeg(
  File "/usr/bin/yt-dlp/yt_dlp/postprocessor/ffmpeg.py", line 274, in real_run_ffmpeg
    self.report_error(stderr)
  File "/usr/bin/yt-dlp/yt_dlp/postprocessor/common.py", line 56, in report_error
    return self._downloader.report_error(text, *args, **kwargs)
  File "/usr/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 818, in report_error
    self.trouble(error_message, tb)
  File "/usr/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 774, in trouble
    tb_data = traceback.format_list(traceback.extract_stack())

ERROR: Postprocessing: Conversion failed!
Traceback (most recent call last):
  File "/usr/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 2864, in process_info
    info_dict = self.post_process(dl_filename, info_dict, files_to_move)
  File "/usr/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 3015, in post_process
    info = self.run_pp(pp, info)
  File "/usr/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 2964, in run_pp
    files_to_delete, infodict = pp.run(infodict)
  File "/usr/bin/yt-dlp/yt_dlp/postprocessor/common.py", line 83, in wrapper
    return func(self, info)
  File "/usr/bin/yt-dlp/yt_dlp/postprocessor/modify_chapters.py", line 64, in run
    in_out_files = [remove_chapters(info['filepath'], False)]
  File "/usr/bin/yt-dlp/yt_dlp/postprocessor/modify_chapters.py", line 62, in remove_chapters
    return file, self.remove_chapters(file, cuts, concat_opts, self._force_keyframes and not is_sub)
  File "/usr/bin/yt-dlp/yt_dlp/postprocessor/modify_chapters.py", line 316, in remove_chapters
    self.concat_files([in_file] * len(concat_opts), out_file, concat_opts)
  File "/usr/bin/yt-dlp/yt_dlp/postprocessor/ffmpeg.py", line 332, in concat_files
    self.real_run_ffmpeg(
  File "/usr/bin/yt-dlp/yt_dlp/postprocessor/ffmpeg.py", line 275, in real_run_ffmpeg
    raise FFmpegPostProcessorError(stderr.split('\n')[-1])
yt_dlp.postprocessor.ffmpeg.FFmpegPostProcessorError: Conversion failed!

Description

Hello there! :)

I am trying out the new SponsorBlock implementation and are running into issues, marking chapters works for me but when adding --sponsorblock-remove sponsor or --sponsorblock-remove all this ffmpeg conversion error occurs.

Thank you for your help!

This is an ffmpeg issue. See ytdl-org/youtube-dl#28042, #360 (comment)

TLDR:
FFmpeg doesnot handle merging (or in this case, cutting) some vp9+aac formats from youtube correctly. This issue exists in all ffmpeg versions above 3.0.1. The possible solutions right now are:

  1. Use a custom patched version of ffmpeg like https://github.com/yt-dlp/FFmpeg-Builds#ffmpeg-static-auto-builds
  2. Download different formats
  3. Use ffmpeg 3.0.1
  4. --force-keyframes also work for sponsorblock, but is probably the worst of these fixes
  1. Use setts filter to correct timestamps. Requires master build of FFmpeg younger than July 4 (commit FFmpeg/FFmpeg@301d275 must be present).

If merging fails, add this to yt-dlp command line:

--ppa "Merger+ffmpeg:-bsf:v 'setts=pts=if(lt(DTS\, PREV_OUTDTS) * gte(PTS\, DTS)\, max(PTS\, PREV_OUTDTS)\, PTS):dts=max(DTS\, PREV_OUTDTS)'"

If SponsorBlock fails, add this (same as above, only post-processor name is different):

--ppa "ModifyChapters+ffmpeg:-bsf:v 'setts=pts=if(lt(DTS\, PREV_OUTDTS) * gte(PTS\, DTS)\, max(PTS\, PREV_OUTDTS)\, PTS):dts=max(DTS\, PREV_OUTDTS)'"

Filter was tested on WEBM & MKV, different containers may require changes.

We cannot use these settings by default, correct?

Thank you nihil-admirari! I have spent many hours trying to identify this issue. Your fixed FFmpeg works flawlessly

Works after install ffmpeg patch https://github.com/nihil-admirari/FFmpeg-With-VP9-Timestamp-Fix/releases
Issue see #871

Fix notes on Debian 11
Remove broken ffmpeg:
sudo apt remove -y ffmpeg && sudo apt purge -y && sudo apt autoremove -y

Download fixed ffmpeg from
https://github.com/nihil-admirari/FFmpeg-With-VP9-Timestamp-Fix/releases

Install fixed version:

extract archive (the one I tested below)
ffmpeg-n4.4-152-gdf288deb9b-linux64-nonfree-4.4.tar.xz

Copy files from
./ffmpeg-n4.4-152-gdf288deb9b-linux64-nonfree-4.4/bin
to
/usr/local/bin

My test run finally worked :D
yt-dlp --output '/media/jjenkx/easystore/youtube-dl/%(channel)s_%(channel_id)s/%(upload_date>%Y-%m-%d)s_%(title)s_%(average_rating)s_%(duration>%H-%M-%S)s_%(resolution)s.%(ext)s' --verbose --restrict-filenames --write-description --write-info-json --write-comments --write-thumbnail --write-desktop-link --prefer-free-formats --write-subs --write-auto-subs --convert-subs srt --embed-subs --remux-video mkv --embed-chapters --sponsorblock-remove "sponsor,selfpromo,interaction,intro,outro,preview" --download-archive /home/jjenkx/.yt-dlp-done.txt https://www.youtube.com/watch?v=XSGBVzeBUbk

We cannot use these settings by default, correct?

If there are no timestamp anomalies, it should set PTS to PTS and DTS to DTS, but I won't enable this filter by default. setts filter is container-dependent, above expressions were tested on WEBM & MKV. If container is strict PREV_OUTDTS must be replaced with PREV_OUTDTS + 1 everywhere. The -bsf fix is not in any FFmpeg release yet.

@nihil-admirari's patched ffmpeg builds have now been transferred over to https://github.com/yt-dlp/FFmpeg-Builds

Is this still an issue with ffmpeg 5.0? is it still necessary to download the patched ffmpeg builds (v5.0)?
I mean, can we update ffmpeg automatically and keep the oficial version untouched, without having to replace it again with the custom builds?

Thanks.

Yes, u can see the issue https://trac.ffmpeg.org/ticket/9086 has not yet been adressed

https://trac.ffmpeg.org/ticket/9086 is now closed by FFmpeg/FFmpeg@68595b4.

Sorry I'm not clear. With the latest version of ffmpeg (not the patched version linked here does it work? i.e. the ffmpeg bug is now fixed?

  1. Use a custom patched version of ffmpeg like https://github.com/yt-dlp/FFmpeg-Builds#ffmpeg-static-auto-builds

The bug is fixed in ffmpeg master, but there hasn't been a new release yet

The latest ffmpeg build of 5.0.x was 5.0.1 (11 days ago on April 04th), however my current yt-dlp (using homebrew on macOS, tested with this video) still declares "Conversion failed" when using Sponsorblock. Did the mentioned fix only go into the ffmpeg master (and not the 5.x branch), does yt-dlp not use the newest ffmpeg... or where is the current problem?

Can confirm ffmpeg n5.0.1-3-gb655beb025-20220415 still has the issue

Here's the changelog for 5.0.1: https://github.com/FFmpeg/FFmpeg/blob/release/5.0/Changelog. A quick look shows that only problems like ... signed overflow in displayWindow are getting fixed in minor releases.

Most likely, VP9 fix won't be released until FFmpeg 6.

Would be nice if #3766 mentioned that using "Use https://github.com/yt-dlp/FFmpeg-Builds" is not a solution for using yt-dlp on macOS, since there's no custom macOS-build as far as I can see. It's a bit confusing to see this ticket as being closed with no solution for macOS users.

VP9 fix was released as part of FFmpeg 5.1.

Great... fyi i think this can be removed from #3766

I'm still seeing minor issue where audio / video goes out of sync after removed sponsor segment. Depending of video player, typically skipping ahead or back synchronizes the audio again.

ffmpeg 5.1 and yt-dlp 2022.7.18.

@tonilampela

I believe this is because keyframes were removed and to fix it you'd have to re-encode the video.

--force-keyframes-at-cuts

Force keyframes at cuts when
downloading/splitting/removing sections.
This is slow due to needing a re-encode, but
the resulting video may have fewer artifacts
around the cuts

@Jeeaaasus Thanks! This indeed fixed the sync issue, but boy oh boy it took ages to re-encode even on M1 Mac... I might just try to live without sponsor-block for now.

live without sponsor-block for now.

In case you aren't familiar there are other sponsorblock solutions like https://github.com/asakura42/sponsorblock-mpv-local/blob/main/main.lua which don't modify the downloaded files. It's what I use and it works very well for me

I use Plex as my client and looks there is no solution for it. I figured as workaround to mark sponsor segments as chapters for easy skipping, and that works alright too...