ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
132.41k stars 10.04k forks source link

Post Processor Args Should not be passed to every post process, it breaks image conversion and slows down metadata embed #27593

Open Neurognostic opened 3 years ago

Neurognostic commented 3 years ago

Checklist

Verbose log

youtube-dl --keep-video --keep-fragments --verbose 'https://www.youtube.com/watch?v=IOcOf_UAs20'
[debug] System config: []
[debug] User config: ['--output', '%(uploader)s/%(title)s_%(id)s.%(ext)s', '--yes-playlist', '--write-sub', '--all-subs', '--format', 'bestvideo+bestaudio/best', '--merge-output-format', 'mp4', '--prefer-ffmpeg', '--embed-thumbnail', '--add-metadata', '--postprocessor-args=-c:v h264_nvenc -preset slow']
[debug] Custom config: []
[debug] Command-line args: ['--keep-video', '--keep-fragments', '--verbose', 'https://www.youtube.com/watch?v=IOcOf_UAs20']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2020.12.29
[debug] Python version 3.8.6 (CPython) - Linux-5.8.0-7630-generic-x86_64-with-glibc2.32
[debug] exe versions: ffmpeg 4.3.1, ffprobe 4.3.1, rtmpdump 2.4
[debug] Proxy map: {}
[youtube] IOcOf_UAs20: Downloading webpage
WARNING: video doesn't have subtitles
[youtube] IOcOf_UAs20: Downloading thumbnail ...
[youtube] IOcOf_UAs20: Writing thumbnail to: Mark Passio/Mark Passio - Morality And Disclosure_IOcOf_UAs20.webp
[debug] Invoking downloader on 'https://r2---sn-qxoedn7k.googlevideo.com/videoplayback?expire=1609381743&ei=DuPsX-_pO5CU2_gPmNSryAM&ip=212.102.44.53&id=20e70e7ff500b36d&itag=137&aitags=133%2C134%2C135%2C136%2C137%2C160%2C242%2C243%2C244%2C247%2C248%2C278&source=youtube&requiressl=yes&mh=SM&mm=31%2C29&mn=sn-qxoedn7k%2Csn-qxo7rn7e&ms=au%2Crdu&mv=m&mvi=2&pl=23&initcwndbps=1538750&vprv=1&mime=video%2Fmp4&ns=fCq1SwsY2IvhSoN1wr0Wad4F&gir=yes&clen=457902328&dur=3799.366&lmt=1520138594942963&mt=1609359880&fvip=2&keepalive=yes&c=WEB&n=4FGRA7yi6GrCDFIe&sparams=expire%2Cei%2Cip%2Cid%2Caitags%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRgIhAPeEeWbUALji2ih4QUbrT6deDYkiawlVcJYoIfzKJbe0AiEAxcqZp5h_nHnBPO7sDQ4zytPoHize6uk6ZXoYUF8oPG8%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIhAP3OdnLAFiqRW2aU8DEhTJ9nDZqoZ-VPSBy6NaN21kfiAiAfRbU2sj1nPJ4zu_jzk1codBbbNNx0SDlhSaJSGHOUow%3D%3D&ratebypass=yes'
[download] Destination: Mark Passio/Mark Passio - Morality And Disclosure_IOcOf_UAs20.f137.mp4
[download] 100% of 436.69MiB in 00:57
[debug] Invoking downloader on 'https://r2---sn-qxoedn7k.googlevideo.com/videoplayback?expire=1609381743&ei=DuPsX-_pO5CU2_gPmNSryAM&ip=212.102.44.53&id=20e70e7ff500b36d&itag=140&source=youtube&requiressl=yes&mh=SM&mm=31%2C29&mn=sn-qxoedn7k%2Csn-qxo7rn7e&ms=au%2Crdu&mv=m&mvi=2&pl=23&initcwndbps=1538750&vprv=1&mime=audio%2Fmp4&ns=fCq1SwsY2IvhSoN1wr0Wad4F&gir=yes&clen=60344775&dur=3799.434&lmt=1520139261295329&mt=1609359880&fvip=2&keepalive=yes&c=WEB&n=4FGRA7yi6GrCDFIe&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRQIhAP6VKnRfZB2ragStnRDnjeVYWnweIa2gA6fvslgydJ2jAiAINf4lknGLYdiFeMvUUJFCY984kg3rJDtIek7IXj2xwA%3D%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIhAP3OdnLAFiqRW2aU8DEhTJ9nDZqoZ-VPSBy6NaN21kfiAiAfRbU2sj1nPJ4zu_jzk1codBbbNNx0SDlhSaJSGHOUow%3D%3D&ratebypass=yes'
[download] Destination: Mark Passio/Mark Passio - Morality And Disclosure_IOcOf_UAs20.f140.m4a
[download] 100% of 57.55MiB in 00:07
[ffmpeg] Merging formats into "Mark Passio/Mark Passio - Morality And Disclosure_IOcOf_UAs20.mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:Mark Passio/Mark Passio - Morality And Disclosure_IOcOf_UAs20.f137.mp4' -i 'file:Mark Passio/Mark Passio - Morality And Disclosure_IOcOf_UAs20.f140.m4a' -c copy -map 0:v:0 -map 1:a:0 -c:v h264_nvenc -preset slow 'file:Mark Passio/Mark Passio - Morality And Disclosure_IOcOf_UAs20.temp.mp4'
[ffmpeg] Adding metadata to 'Mark Passio/Mark Passio - Morality And Disclosure_IOcOf_UAs20.mp4'
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:Mark Passio/Mark Passio - Morality And Disclosure_IOcOf_UAs20.mp4' -c copy -metadata 'title=Mark Passio - Morality And Disclosure' -metadata date=20130319 -metadata 'description=This presentation by Mark Passio was given at the MUFON PA (Mutual UFO Network) East Coast Conference on September 30, 2012.  Mark spoke about the moral issues involved in the on-going coverup of extraterrestrial phenomena throughout the world, and how this coverup is perpetuated.

Recorded and edited by Tim Smith of Signs Of The Time Media.' -metadata 'comment=This presentation by Mark Passio was given at the MUFON PA (Mutual UFO Network) East Coast Conference on September 30, 2012.  Mark spoke about the moral issues involved in the on-going coverup of extraterrestrial phenomena throughout the world, and how this coverup is perpetuated.

Recorded and edited by Tim Smith of Signs Of The Time Media.' -metadata 'purl=https://www.youtube.com/watch?v=IOcOf_UAs20' -metadata 'artist=Mark Passio' -c:v h264_nvenc -preset slow 'file:Mark Passio/Mark Passio - Morality And Disclosure_IOcOf_UAs20.temp.mp4'
[ffmpeg] Converting thumbnail "Mark Passio/Mark Passio - Morality And Disclosure_IOcOf_UAs20.webp" to JPEG
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:Mark Passio/Mark Passio - Morality And Disclosure_IOcOf_UAs20.webp' -bsf:v mjpeg2jpeg -c:v h264_nvenc -preset slow 'file:Mark Passio/Mark Passio - Morality And Disclosure_IOcOf_UAs20.jpg'
ERROR: Conversion failed!
Traceback (most recent call last):
  File "/home/neurognostic/.local/lib/python3.8/site-packages/youtube_dl/YoutubeDL.py", line 2075, in post_process
    files_to_delete, info = pp.run(info)
  File "/home/neurognostic/.local/lib/python3.8/site-packages/youtube_dl/postprocessor/embedthumbnail.py", line 70, in run
    self.run_ffmpeg(escaped_thumbnail_filename, escaped_thumbnail_jpg_filename, ['-bsf:v', 'mjpeg2jpeg'])
  File "/home/neurognostic/.local/lib/python3.8/site-packages/youtube_dl/postprocessor/ffmpeg.py", line 239, in run_ffmpeg
    self.run_ffmpeg_multiple_files([path], out_path, opts)
  File "/home/neurognostic/.local/lib/python3.8/site-packages/youtube_dl/postprocessor/ffmpeg.py", line 235, in run_ffmpeg_multiple_files
    raise FFmpegPostProcessorError(msg)
youtube_dl.postprocessor.ffmpeg.FFmpegPostProcessorError: Conversion failed!

Running the failed ffmpeg(1) command that converts the .webp image to .jpg directly with -loglevel debug:

ffmpeg -y -loglevel debug -i 'file:Mark Passio/Mark Passio - Morality And Disclosure_IOcOf_UAs20.webp' -bsf:v mjpeg2jpeg -c:v h264_nvenc -preset slow 'file:Mark Passio/Mark Passio - Morality And Disclosure_IOcOf_UAs20.jpg'

ffmpeg version 4.3.1-4ubuntu1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 10 (Ubuntu 10.2.0-9ubuntu2)
  configuration: --prefix=/usr --extra-version=4ubuntu1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Splitting the commandline.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Reading option '-i' ... matched as input url with argument 'file:Mark Passio/Mark Passio - Morality And Disclosure_IOcOf_UAs20.webp'.
Reading option '-bsf:v' ... matched as option 'bsf' (A comma-separated list of bitstream filters) with argument 'mjpeg2jpeg'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'h264_nvenc'.
Reading option '-preset' ... matched as AVOption 'preset' with argument 'slow'.
Reading option 'file:Mark Passio/Mark Passio - Morality And Disclosure_IOcOf_UAs20.jpg' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option y (overwrite output files) with argument 1.
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input url file:Mark Passio/Mark Passio - Morality And Disclosure_IOcOf_UAs20.webp.
Successfully parsed a group of options.
Opening an input file: file:Mark Passio/Mark Passio - Morality And Disclosure_IOcOf_UAs20.webp.
[NULL @ 0x556d89ca41c0] Opening 'file:Mark Passio/Mark Passio - Morality And Disclosure_IOcOf_UAs20.webp' for reading
[file @ 0x556d89ca4c80] Setting default whitelist 'file,crypto,data'
[webp_pipe @ 0x556d89ca41c0] Format webp_pipe probed with size=2048 and score=99
[webp_pipe @ 0x556d89ca41c0] Before avformat_find_stream_info() pos: 0 bytes read:32768 seeks:0 nb_streams:1
[webp_pipe @ 0x556d89ca41c0] After avformat_find_stream_info() pos: 67248 bytes read:67248 seeks:0 frames:1
Input #0, webp_pipe, from 'file:Mark Passio/Mark Passio - Morality And Disclosure_IOcOf_UAs20.webp':
  Duration: N/A, bitrate: N/A
    Stream #0:0, 1, 1/25: Video: webp, 1 reference frame, yuv420p(tv, bt470bg/unknown/unknown), 1280x720, 0/1, 25 tbr, 25 tbn, 25 tbc
Successfully opened the file.
Parsing a group of options: output url file:Mark Passio/Mark Passio - Morality And Disclosure_IOcOf_UAs20.jpg.
Applying option bsf:v (A comma-separated list of bitstream filters) with argument mjpeg2jpeg.
Applying option c:v (codec name) with argument h264_nvenc.
Successfully parsed a group of options.
Opening an output file: file:Mark Passio/Mark Passio - Morality And Disclosure_IOcOf_UAs20.jpg.
Successfully opened the file.
detected 12 logical cores
Stream mapping:
  Stream #0:0 -> #0:0 (webp (native) -> h264 (h264_nvenc))
Press [q] to stop, [?] for help
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
    Last message repeated 1 times
[graph 0 input from stream 0:0 @ 0x556d89ca9700] Setting 'video_size' to value '1280x720'
[graph 0 input from stream 0:0 @ 0x556d89ca9700] Setting 'pix_fmt' to value '0'
[graph 0 input from stream 0:0 @ 0x556d89ca9700] Setting 'time_base' to value '1/25'
[graph 0 input from stream 0:0 @ 0x556d89ca9700] Setting 'pixel_aspect' to value '0/1'
[graph 0 input from stream 0:0 @ 0x556d89ca9700] Setting 'frame_rate' to value '25/1'
[graph 0 input from stream 0:0 @ 0x556d89ca9700] w:1280 h:720 pixfmt:yuv420p tb:1/25 fr:25/1 sar:0/1
[format @ 0x556d89d09a00] Setting 'pix_fmts' to value 'yuv420p|nv12|p010le|yuv444p|p016le|yuv444p16le|bgr0|rgb0|cuda'
[AVFilterGraph @ 0x556d89cb9380] query_formats: 4 queried, 3 merged, 0 already done, 0 delayed
[h264_nvenc @ 0x556d89cb83c0] Loaded lib: libcuda.so.1
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuInit
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuDeviceGetCount
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuDeviceGet
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuDeviceGetAttribute
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuDeviceGetName
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuDeviceComputeCapability
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuCtxCreate_v2
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuCtxSetLimit
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuCtxPushCurrent_v2
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuCtxPopCurrent_v2
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuCtxDestroy_v2
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuMemAlloc_v2
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuMemAllocPitch_v2
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuMemsetD8Async
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuMemFree_v2
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuMemcpy2D_v2
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuMemcpy2DAsync_v2
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuGetErrorName
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuGetErrorString
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuCtxGetDevice
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuDevicePrimaryCtxRetain
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuDevicePrimaryCtxRelease
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuDevicePrimaryCtxSetFlags
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuDevicePrimaryCtxGetState
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuDevicePrimaryCtxReset
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuStreamCreate
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuStreamQuery
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuStreamSynchronize
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuStreamDestroy_v2
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuStreamAddCallback
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuEventCreate
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuEventDestroy_v2
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuEventSynchronize
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuEventQuery
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuEventRecord
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuLaunchKernel
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuModuleLoadData
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuModuleUnload
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuModuleGetFunction
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuTexObjectCreate
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuTexObjectDestroy
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuGLGetDevices_v2
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuGraphicsGLRegisterImage
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuGraphicsUnregisterResource
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuGraphicsMapResources
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuGraphicsUnmapResources
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuGraphicsSubResourceGetMappedArray
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuDeviceGetUuid
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuImportExternalMemory
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuDestroyExternalMemory
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuExternalMemoryGetMappedBuffer
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuExternalMemoryGetMappedMipmappedArray
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuMipmappedArrayGetLevel
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuMipmappedArrayDestroy
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuImportExternalSemaphore
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuDestroyExternalSemaphore
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuSignalExternalSemaphoresAsync
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: cuWaitExternalSemaphoresAsync
[h264_nvenc @ 0x556d89cb83c0] Loaded lib: libnvidia-encode.so.1
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: NvEncodeAPICreateInstance
[h264_nvenc @ 0x556d89cb83c0] Loaded sym: NvEncodeAPIGetMaxSupportedVersion
[h264_nvenc @ 0x556d89cb83c0] Loaded Nvenc version 11.0
[h264_nvenc @ 0x556d89cb83c0] Nvenc initialized successfully
[h264_nvenc @ 0x556d89cb83c0] 1 CUDA capable devices found
[h264_nvenc @ 0x556d89cb83c0] [ GPU #0 - < GeForce GTX 1650 with Max-Q Design > has Compute SM 7.5 ]
[h264_nvenc @ 0x556d89cb83c0] supports NVENC
[mjpeg2jpeg @ 0x556d89cb9440] Codec 'h264' (27) is not supported by the bitstream filter 'mjpeg2jpeg'. Supported codecs are: mjpeg (7)
Error initializing bitstream filter: mjpeg2jpeg
Error initializing output stream 0:0 --
[h264_nvenc @ 0x556d89cb83c0] Nvenc unloaded
[AVIOContext @ 0x556d89cad0c0] Statistics: 67248 bytes read, 0 seeks
Conversion failed!

Description

I am trying to utilize the NVENC encoder of my GPU in ffmpeg(1) for encoding the video by utilizing --postprocessor-args='-c:v h264_nvenc -preset slow'. The merged output successfully uses the NVENC encoder, however, (in the example) the --postprocessor-args get passed to the --add-metadata and --embed-thumbnail post processors as well.

Passing the --postprocessor-args to the --add-metadata post-processor causes the entire video to be reencoded a second time instead of simply adding the metadata to the already encoded file.

Passing the --postprocessor-args to the --embed-thumbnail post-processor tries to use ffmpeg(1)'s mjpeg2jpeg bitstream filter with the NVENC encoder's --postprocessor-args to convert the .webp image to a .jpg with the h264_nvenc encoder, which obviously fails. When I do not pass --postprocessor-args the --embed-thumbnail post-processor correctly uses AtomicParsley to embed the thumbail and does not use ffmpeg(1).

What I want is (1) youtube-dl to be able to utilize the ffmpeg(1) h264_nvenc encoder for the initial video encoding, (2) correctly embed the metadata without reencoding the entire video, (3) correctly use AtomicParsley or not passing --postprocessor-args to ffmpeg(1) for embedding the thumbnail.

I think what is needed is to be able to define the post-processor and post-processor arguments for each post-process task type (i.e., merging video+audio, recoding video/audio, embeding thumbnail/metadata/subtitles, converting images/subtitles) or perhaps adding post-processing options for using hardware encoding (like h264_nvenc) for the initial video encoding only.

Thank you.

section83 commented 3 years ago

I have a very similar problem with getting thumbnails into mp4 files from YouTube. This is the YTDL call:

[debug] Command-line args: [u'--ignore-errors', u'--newline', u'--recode-video', u'mp4', u'--postprocessor-args', u'-codec copy', u'--no-overwrites', u'--embed-thumbnail', u'--verbose', u'--no-playlist', u'-o', u'%(title)s.%(ext)s', u'https://www.youtube.com/watch?v=8IAZn7fHnvM&list=OLAK5uy_mETrjqIq-4C7w8RcyxAEGPdeFykNLlAKA&index=4'] [debug] Encodings: locale US-ASCII, fs utf-8, out None, pref US-ASCII [debug] youtube-dl version 2021.04.26 [debug] Python version 2.7.16 (CPython) - Darwin-19.6.0-x86_64-i386-64bit [debug] exe versions: ffmpeg 4.4-tessus, ffprobe 4.4-tessus

YTDL proceeds to write the webp thumbnail file and download the two webm files (one of video, the other for audio). The 2 files are them merged into a single webm file which in turn is remuxed into an mp4 file. That's all good.

It then tries to convert the webp file to jpg with FFmpeg and reports an error. Is there a way to avoid that error ?

[ffmpeg] Merging formats into "Shoot Out At The Fantasy Factory.webm"
[debug] ffmpeg command line: ffmpeg -y -loglevel 'repeat+info' -i 'file:Shoot Out At The Fantasy Factory.f248.webm' -i 'file:Shoot Out At The Fantasy Factory.f251.webm' -c copy -map '0:v:0' -map '1:a:0' -codec copy 'file:Shoot Out At The Fantasy Factory.temp.webm'
Deleting original file Shoot Out At The Fantasy Factory.f248.webm (pass -k to keep)
Deleting original file Shoot Out At The Fantasy Factory.f251.webm (pass -k to keep)
[ffmpeg] Converting video from webm to mp4, Destination: Shoot Out At The Fantasy Factory.mp4
[debug] ffmpeg command line: ffmpeg -y -loglevel 'repeat+info' -i 'file:Shoot Out At The Fantasy Factory.webm' -codec copy 'file:Shoot Out At The Fantasy Factory.mp4'
Deleting original file Shoot Out At The Fantasy Factory.webm (pass -k to keep)
[ffmpeg] Converting thumbnail "Shoot Out At The Fantasy Factory.webp" to JPEG
[debug] ffmpeg command line: ffmpeg -y -loglevel 'repeat+info' -i 'file:Shoot Out At The Fantasy Factory.webp' '-bsf:v' mjpeg2jpeg -codec copy 'file:Shoot Out At The Fantasy Factory.jpg'
ERROR:   Stream #0:0 -> #0:0 (copy)
Traceback (most recent call last):
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 2106, in post_process
    files_to_delete, info = pp.run(info)
  File "/usr/local/bin/youtube-dl/youtube_dl/postprocessor/embedthumbnail.py", line 70, in run
    self.run_ffmpeg(escaped_thumbnail_filename, escaped_thumbnail_jpg_filename, ['-bsf:v', 'mjpeg2jpeg'])
  File "/usr/local/bin/youtube-dl/youtube_dl/postprocessor/ffmpeg.py", line 239, in run_ffmpeg
    self.run_ffmpeg_multiple_files([path], out_path, opts)
  File "/usr/local/bin/youtube-dl/youtube_dl/postprocessor/ffmpeg.py", line 235, in run_ffmpeg_multiple_files
    raise FFmpegPostProcessorError(msg)
FFmpegPostProcessorError:   Stream #0:0 -> #0:0 (copy)
Neurognostic commented 3 years ago

@section83, yt-dlp is a fork that has implemented #27723, which I mostly got to work. You can define different parameters for each post processor.

section83 commented 3 years ago

Thanks. I'll check it out.