Linux command
ffprobe 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Display information
ffprobe [path/to/file.mp4]
Show information in JSON format
ffprobe -v quiet -print_format json -show_format -show_streams [file.mp4]
Get video duration
ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 [file.mp4]
Get video resolution
ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=s=x:p=0 [file.mp4]
Get codec information
ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 [file.mp4]
Get audio sample rate
ffprobe -v error -select_streams a:0 -show_entries stream=sample_rate -of default=noprint_wrappers=1:nokey=1 [file.mp4]
Show all stream information
ffprobe -v error -show_streams [file.mp4]
Analyze a network stream
ffprobe [https://example.com/stream.m3u8]
说明
ffprobe is a multimedia stream analyzer from the FFmpeg project. It examines media files and streams, reporting detailed technical information about container formats, codecs, bitrates, resolution, duration, metadata, and more. The tool reads media files without decoding them, making analysis fast. It supports virtually all audio and video formats that FFmpeg handles, including local files, network streams, and devices. Output can be formatted as human-readable text, JSON, XML, CSV, or other formats for scripting integration. The -show_entries option enables extracting specific values without parsing verbose output. Common uses include: verifying transcoding results, extracting metadata for media libraries, debugging playback issues, analyzing stream characteristics before processing, and building media management scripts. For network streams (HLS, DASH, RTSP, etc.), ffprobe can analyze remote content, useful for monitoring streaming infrastructure. Combined with FFmpeg's other tools, it enables complete media inspection and manipulation.
参数
- -v _level_
- Set logging verbosity (quiet, panic, fatal, error, warning, info, verbose, debug).
- -show_format
- Show container format information.
- -show_streams
- Show stream information (video, audio, subtitle tracks).
- -show_entries _section_
- Show only specified entries (e.g., stream=codec_name,bit_rate).
- -select_streams _specifier_
- Select specific streams (v:0 for first video, a:0 for first audio).
- -print_format, -of _format_
- Output format: default, json, xml, csv, flat, ini.
- -count_frames
- Count and report total frames (slow for large files).
- -count_packets
- Count packets in each stream.
- -show_chapters
- Show chapter information.
- -show_programs
- Show program information.
- -show_error
- Show information about any errors.
- -show_data
- Show payload data as hexadecimal and ASCII dump.
- -i _input_
- Input file (optional, can specify file directly).
- -hide_banner
- Suppress printing banner/configuration info.
- -pretty
- Prettify displayed values with SI prefixes and units.
- -sexagesimal
- Use sexagesimal format HH:MM:SS.MICROSECONDS for time values.
- -bitexact
- Force bitexact output, not dependent on the specific build.
FAQ
What is the ffprobe command used for?
ffprobe is a multimedia stream analyzer from the FFmpeg project. It examines media files and streams, reporting detailed technical information about container formats, codecs, bitrates, resolution, duration, metadata, and more. The tool reads media files without decoding them, making analysis fast. It supports virtually all audio and video formats that FFmpeg handles, including local files, network streams, and devices. Output can be formatted as human-readable text, JSON, XML, CSV, or other formats for scripting integration. The -show_entries option enables extracting specific values without parsing verbose output. Common uses include: verifying transcoding results, extracting metadata for media libraries, debugging playback issues, analyzing stream characteristics before processing, and building media management scripts. For network streams (HLS, DASH, RTSP, etc.), ffprobe can analyze remote content, useful for monitoring streaming infrastructure. Combined with FFmpeg's other tools, it enables complete media inspection and manipulation.
How do I run a basic ffprobe example?
Run `ffprobe [path/to/file.mp4]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -v _level_ do in ffprobe?
Set logging verbosity (quiet, panic, fatal, error, warning, info, verbose, debug).