question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Embedding thumbnails for .mkv output

See original GitHub issue

Checklist

  • 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:open
  • Created 2 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
pukkandancommented, Apr 6, 2021

@nicolaasjan that code wont work, coz get_stream_number function is not implemented in youtube-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

1reaction
rautamiekkacommented, Apr 3, 2021

Alternatively, use a --exec. @nicolaasjan Why not merge that into youtube-dl?

Because I don’t have the privilege

That ain’t how it works.

Read more comments on GitHub >

github_iconTop Results From Across the Web

--embed-thumbnail with mkv video ? : r/youtubedl - Reddit
there is no thumbnail in the final video, but when i change the f merge output to mp4 every thing woks. so i...
Read more >
Thumbnails for MKV files - VideoHelp Forum
I just want to be able to specify a thumbnail picture for an MKV file. ... -attach cover.jpg -metadata:s:t mimetype=image/jpeg <output.mkv>.
Read more >
ffmpeg - Is it possible to embed a thumbnail in a .mkv file?
The ffmpeg Formats documentation doesn't list thumbnail(s) as an option in the metadata section of the matroska muxer docs, which further ...
Read more >
Suddenly MKVToolNix GUI has started to remove thumbnails ...
When I open an MKV file in the MKVToolNIx GUI and click "Start Multiplexing" without making any changes, the output MKV file doesn't...
Read more >
SELinux + ffmpegthumbnailer = how to make it work?
I'd like to see embedded cover arts as thumbnails for mkv files. This is possible using ffmegtumbnailer with the flag -m .
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found