so I have a video (could be MKV or MP4) with multiple audio tracks and multiple subtitles (different languages).

What I want is to remux into a new video and:

  1. selecting just 1 or 2 audio tracks
  2. selecting just 1 or 2 subtitle tracks
  3. making 1 audio track and 1 subtitle track (if available) as default so they are automatically selected when the video is played using VLC.

I've searched the net but cannot find what I'm looking for. I've also looked at the "man ffmpeg". I think I may have to use the -map parameter but the examples given seems to be limited to copying just the audio.

Thanks a lot! :)

enter image description here


Suppose your input has 3 audio and subtitle tracks alongside a video track, then to mux the video, the 2nd audio track, and the 1st + 3rd subtitle track, you would use

ffmpeg -i in.mkv -c copy -map 0:v -map 0:a:1 -map 0:s:0 -map 0:s:2 out.mkv

FFmpeg, afaik, does not properly set default flags for streams, so your best bet is to mux your intended default track first. Suppose, in the above example, you wanted the 3rd subtitle stream to be the default, you would then use

ffmpeg -i in.mkv -c copy -map 0:v -map 0:a:1 -map 0:s:2 -map 0:s:0 out.mkv

(The order of the map arguments sets the order of the streams in the output)

| improve this answer | |

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.