How do I copy all audio and subtitle when scaling video with ffmpeg?

How do I copy all audio and subtitle when scaling video with ffmpeg?

Scaling the video with this command to half it's resolution works perfectly, but only one audio stream is copied and all subtitle are lost.

ffmpeg -hwaccel_device qsv -i $my_input_file.mkv -vf "scale=iw/2:ih/2" $my_output_file.mkv

I would like to alter the video stream only, as it is right now, but copy untouched all other streams, including audio, subtitle and covers if they exist, if they do not exist it should not throw an error.

答案1

You need to set map options. See http://ffmpeg.org/ffmpeg.html#Advanced-options

ffmpeg -hwaccel_device qsv -i $my_input_file.mkv -map 0 -c:a copy -c:s copy -vf "scale=iw/2:ih/2" $my_output_file.mkv

-map 0 tells ffmpeg to all streams from input 0 (the first input) in the output file. -c:a copy -c:s copy will copy over any audio and subtitle streams present.

相关内容