ffprobe:bitrate
This is an old revision of the document!
Table of Contents
ffprobe - Bitrate
The bit rate of a video influences both the video quality and file size.
- Understanding the bit rate of a video is critical for encoding decisions, ensuring compatibility with bandwidth limits, or addressing quality issues caused by insufficient bit rates.
- It also helps when re-encoding videos for specific distribution channels.
Determine the bit rate
# For MP4 ffprobe -v quiet -select_streams v:0 -show_entries stream=bit_rate -of default=noprint_wrappers=1:nokey=1 input.mp4 # For MKV ffprobe -v quiet -select_streams v:0 -show_entries format=bit_rate -of default=noprint_wrappers=1:nokey=1 input.mkv
returns:
4717811
NOTE: The command pulls the bit rate from the video stream header metadata.
- That data is not required to be written to the stream, and MKV does not support it.
- MKV stores that info in the container, meaning you need to replace stream=bit_rate with format=bit_rate for MKV containers.
Options:
- -v error: Limits output to errors to avoid any unnecessary information display.
- -select_streams v:0: Directs the command to focus on the first video stream.
- -show_entries stream=bit_rate: Extracts the average bit rate information from the specified stream (for MP4 files).
- -show_entries format=bit_rate: Extracts the average bit rate information from the specified stream (for MKV files).
- -of default=noprint_wrappers=1:nokey=1: Formats output to ensure only the core bit rate value is shown.
- input.mp4: The file under examination.
Determine the bit rate manually
ffprobe -v quiet -select_streams v -show_entries packet=size -of compact=p=0:nk=1 input.mp4 | awk '{s+=$1} END {print s}' 1772586389 ffprobe -v quiet -select_streams v -show_entries stream=duration -of compact=p=0:nk=1 video.mp4 # format=duration if MKV 3592.544000 echo 1772586389/3592.544000 | bc # B/s 493407 echo '1772586389/3592.544000/1024' | bc # kB/s 481
ffprobe/bitrate.1736722374.txt.gz · Last modified: 2025/01/12 22:52 by peter