Closed ngmtine closed 3 years ago
Presumably this doesn't happen with files that have both audio and video?
yt-dl thinks that ffmpeg should skip copying video streams when the extension is m4a
(postprocessor/ffmpeg.py
l.484 ff.), but the cover art is stored as a video stream:
Stream #0:1: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 1280x720, 90k tbr, 90k tbn, 90k tbc (attached pic)
I guess there may also be an issue with extracting audio where a previously embedded thumbnail is discarded.
A fix could involve extending the FFmpegPostProcessor.get_audio_codec()
method so that (perhaps with a additional parameter set to a non-default value) it returns a list of audio_codec, metadata codec, ...
Meanwhile, the solution is to make sure that the thumbnail is set after setting other metadata, as in your first test program, and that may equally apply to the order of command-line options for the yt-dl program itself.
The ffmpeg postprocessors have specific order requirements. I recommend always putting them in the same order as used by the CLI (See __init__.py
). While it may be possible to detect thumbnails and ensure they are preserved, I dont think such an improvement is warranted since (1) it is non-trivial to fix the interactions between all the PPs and (2) it is easily fixable by calling the PPs in the specific order
That seems entirely reasonable, and of course the processing in __init__.py
ensures that such an issue doesn't affect the CLI.
Thank you for all your comments. I now understand that this behavior is a specification. I will take care of the order of the post processors as I did in my original code.
Checklist
Description
When passing FFmpegMetadata and EmbedThumbnail to postprocessors, thumbnail setting fails depending on the order.
I ran the script sequentially in the debugger, and it seems that even the code that doesn't work sets the thumbnail at least once. (After that, the information is overwritten in the postprocessor of FFmpegMetadata?)
If this is a spec and not a bug, please let me know.
thank you.
↓Correct code (thumbnail will be set)
↓Stuck code (thumbnail not set)
Verbose log
Output from a stuck code.