Ubuntu – Using avconv and keeping Audiostreams and Subtitles

avconv

I am trying to encode a mkv-file while keeping the audiostreams and the subtitles. This is the command I am using:

avconv -i inputfile.mkv -c:v mpeg2video -acodec copy - scodec copy -b:v 5000k -maxrate:v 6000k -bufsize 1835k outputfile.mkv

The problem is that my mkv contains more than one audiostream and subtitle. And using the upper command the output file only contains the default marked audiostream and subtitle. Is there any additional command to copy all containing audiostreams and subtitles?

Best Answer

To force FFmpeg/Libav to copy all input streams to the output, use the -map 0 option.

ffmpeg -i in.mkv \
       -map 0 -c copy \
       -c:v mpeg2video -qscale:v 2 \
       out.mkv

FFmpeg and Libav should behave the same way here. See How to use -map option on the FFmpeg wiki. Try the suggested '-qscale:v 2' option in this commandline, it should give excellent results, or simply keep the bitrate options as specified in your own post.