ffmpeg — copy attached cover image (cover.jpg) of video file during encode?

I am trying to encode a video with ffmpeg which has a cover file attached. This cover file should end up in the encoded video as well.

I can do this with mkvextract attachments movie.mkv 1 && && mkvpropedit movie_new.mkv --add-attachment cover.jpg. Both old and new show up in mediainfo with the two lines

Cover                                    : Yes
Attachments                              : cover.jpg

But when I try to integrate this into a ffmpeg command, ffmpeg insists on detecting a second video stream and either dropping it or encoding it as a second video stream which completely confuses the player.

What I tried:
-map 0:t –> error, cannot find attachments; -map 0:t? –> runs and encodes second video stream

All kinds of -map combinations, even a merge with a separate cover.jpg and ffmpeg -i movie.mkv -i cover.jpg ... -map 1 -map 0 -c copy -disposition:0 attached_pic fails.

Any ideas?

Read more here: Source link