ffprobe
Get multimedia file information
TLDR
Display all available stream info for a media file
Display media duration
Display the frame rate of a video
Display the width or height of a video
Display the average bit rate of a video
SYNOPSIS
ffprobe [options] [input_file]
Common usage examples:
ffprobe -v error -show_streams -show_format -print_format json input.mp4
ffprobe -hide_banner -pretty -print_format json video.mkv
PARAMETERS
-i <input>
Specify the input multimedia file or URL. Although often implied as the last argument, it explicitly sets the input.
-v <loglevel>
Set the logging level. Common levels include quiet, error, warning, info, verbose, and debug.
-hide_banner
Suppress printing of the FFmpeg copyright and build configuration banner.
-show_streams
Show information about each stream (video, audio, subtitle, data) present in the input.
-show_format
Show information about the container format of the input file.
-show_chapters
Show information about chapters defined in the input file.
-show_packets
Show information about each packet read from the input.
-show_frames
Show information about each frame decoded from the input.
-print_format <format>
or -of <format>
Set the output printing format. Supported formats include json, xml, flat, ini, and csv. Defaults to compact text if not specified.
-pretty
When using json or xml output format, pretty-print the output with indentation for better readability.
-count_frames
Count the number of frames in each stream and report it.
-count_packets
Count the number of packets in each stream and report it.
-select_streams <stream_specifier>
Select which streams to show information for. For example, v for video, a for audio, s for subtitle, or a stream index like v:0.
-duration_estimations
Enable duration estimations for formats that do not explicitly provide it (can be slower).
DESCRIPTION
ffprobe is a command-line tool that gathers information from multimedia streams and containers. It is part of the FFmpeg project, a comprehensive suite of libraries and programs for handling video, audio, and other multimedia files and streams.
Unlike ffmpeg, which focuses on encoding and decoding, ffprobe is designed purely for analysis. It can output detailed information about various aspects of a media file, including: container format properties (e.g., duration, bitrate, metadata), stream-specific details (e.g., video resolution, frame rate, audio sample rate, codec name, language), chapter markers, and even packet and frame information for deeper analysis.
The output can be customized to various formats like plain text, JSON, XML, CSV, or INI, making it highly suitable for scripting and automated media processing workflows. It's an essential tool for developers, system administrators, and media professionals who need to programmatically inspect the characteristics of media files.
CAVEATS
While powerful, ffprobe can consume significant CPU and memory, especially when analyzing large or complex files with options like -show_frames or -show_packets. Its detailed output, particularly in JSON or XML format, might be very verbose and requires careful parsing for specific data points. The interpretation of some low-level fields often requires familiarity with multimedia container and codec specifications.
Also, the exact structure of the JSON/XML output can sometimes have minor variations between different ffprobe versions, which might affect scripts relying on very specific paths.
COMMON OUTPUT FORMATS
ffprobe's strength lies in its flexible output formats, specified by -print_format or -of. For programmatic use, json and xml are highly recommended as they provide structured data that is easy to parse with scripting languages like Python or Node.js. The flat format provides a simplified key=value pair output, useful for simple parsing, while csv and ini offer other structured alternatives.
EXTRACTING SPECIFIC INFORMATION
To get specific information like video resolution or audio bitrate efficiently, it's common practice to combine -show_streams and -show_format with -print_format json. Then, use a JSON parsing tool like jq (a command-line JSON processor) or a scripting language to extract the desired fields from the output. For example, to get video resolution, you would typically parse the 'streams' array in the JSON output and extract the 'width' and 'height' properties of the video stream object.
HISTORY
ffprobe emerged as an essential component of the FFmpeg project, which began development in 2000. It was created to provide programmatic access to the rich metadata and stream information that FFmpeg's decoders could extract. As the project evolved and supported an ever-growing number of multimedia formats and codecs, ffprobe's capabilities expanded in parallel. Its ability to output structured data (initially XML, later JSON) made it a cornerstone for automated media analysis and processing pipelines, particularly in web services, content management systems, and media production environments.