How to Get Video Bitrate with FFmpeg (video, audio & total)

In this tutorial, we will learn how to get the total bitrate of a video and the audio and video bitrates separately using the ffprobe utility of FFmpeg.

 

Get the Total Bitrate of a Video

To get the total bitrate of a video, use the following ffprobe command:

 

ffprobe -i sample_5.mp4 -v quiet -show_entries stream=bit_rate -hide_banner
[STREAM]
bit_rate=2293882
[/STREAM]
[STREAM]
bit_rate=209716
[/STREAM]

 

The first bit_rate value is the video stream and the second is the audio stream. The bite_rate value is in bits per second so 2293882 + 209716  would be about 2.5 Megabits per second total.

 

To return only the numerical values set the output format to noprint_wrappers=1:nokey=1 using the -of flag like this:

 

ffprobe -i sample_5.mp4 -v quiet -show_entries stream=bit_rate -hide_banner -of default=noprint_wrappers=1:nokey=1
2293882
209716

 

If you need the output data in JSON, add the -print_format flag and set its value to json:

 

ffprobe -i sample_5.mp4 -v quiet -show_entries stream=bit_rate -hide_banner -print_format json
{
 "programs": [

 ],
 "streams": [
   {
     "bit_rate": "2293882"
   },
   {
     "bit_rate": "209716"
   }
 ]
}

 

Getting the Audio Bitrate Only

To get the audio bitrate only, add -select_streams a:0 to your ffprobe command like this:

 

ffprobe -i sample_5.mp4 -v quiet -select_streams a:0 -show_entries stream=bit_rate -hide_banner
[STREAM]
bit_rate=209716
[/STREAM]

 

Getting the Video Bitrate Only

To get the video bitrate only, add -select_streams v:0 to your ffprobe command like this:

 

ffprobe -i sample_5.mp4 -v quiet -select_streams v:0 -show_entries stream=bit_rate -hide_banner
[STREAM]
bit_rate=2293882
[/STREAM]
video bitrate ffmpeg