Using avconv and keeping Audiostreams and Subtitles

7,395

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.

Share:
7,395

Related videos on Youtube

ports
Author by

ports

Updated on September 18, 2022

Comments

  • ports
    ports over 1 year

    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?

    • Mantra
      Mantra over 11 years
      Just curious: Do you specifically need MPEG2 video? You'd get much better quality with H.264 or even MPEG-4 Visual.
  • andrew.46
    andrew.46 almost 10 years
    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...
  • Mantra
    Mantra almost 10 years
    Good suggestion, thank you @andrew.46