Embedding thumbnails for .mkv output
See original GitHub issueChecklist
- I’m reporting a site feature request
- I’ve verified that I’m running youtube-dl version 2021.03.31
- I’ve searched the bugtracker for similar site feature requests including closed ones
Description
It appears that thumbnail embedding is only supported in .mp4 output, though this need not be the case. MKV has thumbnail support (it has arbitrary file attachment support), and the spec defines the names for these thumbnails that players should attempt to load (which they call covers): MKV spec (attachments).
The most supported one is just cover.jpg
placed in the root of the attachments filesystem. This is done for mkv using ffmpeg with the following command:
ffmpeg.exe -i video.mkv -c copy -attach ".\cover.jpg" -metadata:s:t mimetype=image/jpeg videowithumb.mkv
Note that ffmpeg doesn’t appear to support attaching a file with a different name in the MKV than it has in the real filesystem outside the MKV, so the file does actually have to be named ‘cover.jpg’. For playlists and the like, it would require name-swapping the thumbnails.
I tested that media players actually support this embedding method (specifically with jpg files), and I confirmed that various common ones do, including VLC, WMP, etc. Note that the spec only suggests support for JPG and PNG formats. It doesn’t preclude or suggest other formats (webp, etc). ffmpeg can also convert from other thumb formats to jpg for getting the most compatibility. Changing a webp to a jpg for embedding is as easy as ffmpeg -i whatever.webp whatever.jpg
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (1 by maintainers)
Top GitHub Comments
@nicolaasjan that code wont work, coz
get_stream_number
function is not implemented inyoutube-dl
Instead, here’s the PRs on which the above posted code was built on https://github.com/ytdl-org/youtube-dl/pull/22659, https://github.com/ytdl-org/youtube-dl/pull/15445. As you can see these have been mostly ignored by the maintainers Hope that answers your question @macr2hoyipbjtn @rautamiekka
That ain’t how it works.