4

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?

ports
  • 41
  • Just curious: Do you specifically need MPEG2 video? You'd get much better quality with H.264 or even MPEG-4 Visual. – slhck Feb 04 '13 at 08:06

1 Answers1

5

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.

andrew.46
  • 38,003
  • 27
  • 156
  • 232
slhck
  • 940
  • My edit consisted of tidying the syntax a little to conform with the FFmpeg wiki answer and adding a -qscale option to hopefully make better quality video... – andrew.46 May 22 '14 at 03:25
  • Good suggestion, thank you @andrew.46 – slhck May 22 '14 at 07:54