Open Neurognostic opened 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)
@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.
Thanks. I'll check it out.
Checklist
Verbose log
Running the failed
ffmpeg(1)
command that converts the.webp
image to.jpg
directly with-loglevel debug
: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 useffmpeg(1)
'smjpeg2jpeg
bitstream filter with the NVENC encoder's--postprocessor-args
to convert the.webp
image to a.jpg
with theh264_nvenc
encoder, which obviously fails. When I do not pass--postprocessor-args
the--embed-thumbnail
post-processor correctly usesAtomicParsley
to embed the thumbail and does not useffmpeg(1)
.What I want is (1)
youtube-dl
to be able to utilize theffmpeg(1)
h264_nvenc
encoder for the initial video encoding, (2) correctly embed the metadata without reencoding the entire video, (3) correctly useAtomicParsley
or not passing--postprocessor-args
toffmpeg(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.