Clean Video Metadata Summary Using FFprobe
This article explains how to extract a clean, concise summary of video metadata using FFprobe without sifting through overwhelming console output. By utilizing targeted flags to suppress debug logs, filter specific stream properties, and format the output into structured data like JSON or flat text, you can quickly retrieve essential video details such as codecs, resolution, frame rate, and duration for personal inspection or automated workflows.
The Default FFprobe Problem
Running standard commands like ffprobe input.mp4 prints
a wall of diagnostic text, library build configurations, and
unstructured metadata. To clean this up, you must instruct FFprobe to
hide logging information and display only the specific metadata
containers you need.
The Foundation: Hiding Unnecessary Output
The primary flag to silence FFprobe's default banner and logging is
-v error. Combining this with -hide_banner
produces a silent command that prints only the data you explicitly
request.
ffprobe -v error -hide_banner input.mp4Extracting a Clean Summary of Streams and Format
To get a structured overview of both the container format and the
audio/video streams, use -show_format and
-show_streams.
ffprobe -v error -show_format -show_streams input.mp4This returns all properties categorized into blocks. While cleaner, it often contains dozens of lines of obscure stream tags.
Selecting Specific Metadata Fields
To create a truly minimal summary containing only key details (such
as codec name, dimensions, frame rate, and duration), use the
-show_entries flag:
ffprobe -v error -select_streams v:0 \
-show_entries stream=codec_name,width,height,r_frame_rate,duration,bit_rate \
-of default=noprint_wrappers=1 input.mp4Explanation of Arguments:
-select_streams v:0: Targets only the first video stream, ignoring audio tracks, subtitle tracks, and attachments.-show_entries stream=...: Whitelists only the specified keys.-of default=noprint_wrappers=1: Uses the default output format but removes the opening[STREAM]and closing[/STREAM]labels.
Choosing the Best Output Format
FFprobe's -of (or -print_format) flag
allows you to format the output to fit your needs:
1. Key-Value Pairs (Human-Readable)
ffprobe -v error -select_streams v:0 \
-show_entries stream=codec_name,width,height,duration \
-of default=noprint_wrappers=1:nokey=0 input.mp4Output:
codec_name=h264
width=1920
height=1080
duration=120.040000
2. JSON (Ideal for Scripts and Automation)
ffprobe -v error -select_streams v:0 \
-show_entries stream=codec_name,width,height,duration \
-of json input.mp4Output:
{
"programs": [
],
"streams": [
{
"codec_name": "h264",
"width": 1920,
"height": 1080,
"duration": "120.040000"
}
]
}3. Flat Format (Easy Parsing in Bash)
ffprobe -v error -select_streams v:0 \
-show_entries stream=codec_name,width,height \
-of flat input.mp4Output:
streams.stream.0.codec_name="h264"
streams.stream.0.width=1920
streams.stream.0.height=1080
4. CSV / Compact Format
ffprobe -v error -select_streams v:0 \
-show_entries stream=codec_name,width,height \
-of csv=p=0 input.mp4Output:
h264,1920,1080
A Complete Production One-Liner
To retrieve an all-in-one summary of both video and audio streams along with container duration, use:
ffprobe -v error \
-show_entries format=duration,size,bit_rate \
-show_entries stream=codec_type,codec_name,width,height,r_frame_rate \
-of json input.mp4This command strips all extraneous debugging noise and produces a lightweight, parseable JSON payload containing every vital property of the media file.