When I add a cover.jpg attachment to a video file in ffmpeg, it has the following structure (with ffprobe):
Stream #0:1: Attachment: none
Metadata:
filename : cover.jpg
mimetype : image/jpg
ffmpeg -y -i input.mkv -attach cover.jpg -map 0 -c copy -metadata:s:t mimetype="image/jpg" -metadata:s:t:0 filename=cover.jpg input_cover.mkv was used to add the cover.
This plays well with further encoding steps, because the cover image gets transferred with -map 0:t and doesn’t interfere with the rest.
When I add a cover with mkvtoolnix-gui as attachment and default options, it is recognized differently:
Stream #0:7: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 640x360 [SAR 96:96 DAR 16:9], 90k tbr, 90k tbn (attached pic)
Metadata:
filename : cover.jpg
mimetype : image/jpeg
This doesn’t work will with ffmpeg, since it is treated as a second video stream with all kinds of ugly side effects after a reencode and can’t be transferred via -map 0:t.
What’s the best way to make mkvtoolnix-gui attach a cover image the way ffmpeg does?