Compress video keeping subtitles

This method is generally used if you are targeting a specific output file size and output quality from frame to frame is of less importance. This is best explained with an example. Your video is 10 minutes (600 seconds) long and an output of 50 MB is desired. Since bitrate = file size / duration:
(50 MB * 8192 [converts MB to kilobits]) / 600 seconds = ~683 kilobits/s total bitrate
683k – 128k (desired audio bitrate) = 555k video bitrate

avconv -y -i video.mkv -c:v libx264 -preset medium -b:v 555k -pass 1 -an -sn -f matroska /dev/null && \
avconv -i video.mkv -c:v libx264 -preset medium -b:v 555k -pass 2 -c:a libmp3lame -ac 2 -b:a 128k \ 
 -c:s copy -map 0:0 -map 0:1 -map 0:2 -map 0:3 video_out.mkv
Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *