How to Set Average Video & Audio Bitrate in FFmpeg

Typically video files have two streams; one audio and one video. With FFmpeg, we can set target bitrates on them to get a smaller output file.

 

In this tutorial, we will learn how to apply target bitrates to video and audio streams in FFmpeg.

 

Set the Video Stream Output Target

To set the video target bitrate, use the -b:v flag followed by the bitrate value. You can write the value in megabit/s with m or kilobit/s with k depending on what makes more sense. Typically for high definition video, you will be working in Mb/s.

 

ffmpeg -i input.wmv -b:v 1.2m output.mp4

 

Set the Audio Stream Output Target

To set the target audio bitrate, use the -b:a flag followed by the bitrate value. In most cases this value will be in kilobit/s.

 

ffmpeg -i input.wmv -b:a 120k output.mp4

 

Audio and Video Command

Here is an example setting both video and audio bitrate targets:

 

ffmpeg -i input.wmv -b:v 1.2m -b:a 120k output.mp4
ffmpeg