I've been trying to convert an .mkv file into .mp4. With VLC the subtitles got lost.

Then I've been trying ffmpeg:

ffmpeg -i video.mkv -codec copy video.mp4

The conversion has been very fast, the file size has been almost the same, but the subtitles were lost, too.

  • 1
    It really depends whether your video and audio codecs will sit well in an mp4 container. You would be best to show these details in your question by running ffmpeg -i video.mkv. To copy all streams (including subtitles) try the following: ffmpeg -i video.mkv -map 0 -codec copy video.mp4. – andrew.46 Mar 12 at 2:52

I've found an answer by Mokubai on this question on Superuser

I believe you need to specify the mapping of the audio and subtitle streams to ensure that all of them are copied through rather than the first. To do so you need to add -map 0:a? -map 0:s? -map 0:v before your -c:v

This should make your command

ffmpeg -i "01.mkv" -map 0:a? -map 0:s? -map 0:v -c:v copy -c:a ac3 -c:s copy "test.mkv"

The map command is used to tell it that you definitely want those things to be pulled through to the output. -map 0:a:1 would specify only to copy audio stream number 1, while -map 0:a? should effectively wildcard it and copy them all.

It worked, but the .mp4 file is larger.

  • 1
    How much larger? Double? You are transcoding the audio. That could cause some increase. – vanadium Mar 12 at 8:01

The subtitles are lost, since mp4 containers cannot hold subtitles.

Easiest way to copy all into a "mov" container, which is very close to the mp4 container:

ffmepg -i 01.mkv -acodec copy -vcodec copy -scodec copy output.m4v

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.