FFMPEG 命令行工具-ffprobe
ffprobe 简介
ffprobe 是一个多媒体流分析工具。它从多媒体流中收集信息,并且以人类和机器可读的形式打印出来。
它可以用来检测多媒体流的容器类型,以及每一个多媒体流的格式和类型。它可以作为一个独立的应用来使用,也可以结合文本过滤器执行更复杂的处理。
英文手册
参数
命令形式:
ffprobe [options] [‘input_file’]
‘-f format’ 强制使用的格式
‘-unit’ 显示值的单位
‘-prefix’ 显示的值使用标准国际单位制词头
‘-byte_binary_prefix’ 对字节值强制使用二进制前缀
‘-sexagesimal’ 时间值使用六十进位的格式 HH:MM:SS.MICROSECONDS
‘-pretty’ 美化显示值的格式。它相当于 "-unit -prefix -byte_binary_prefix -sexagesimal"
‘-show_data’ 显示有效载荷数据,以十六进制和ASCII转储。与 ‘-show_packets’ 结合使用,它将
‘-show_error’ 显示探测输入文件时的错误信息
‘-show_format’ 显示输入多媒体流的容器格式信息
‘-show_packets’ 显示输入多媒体流中每一个包的信息
‘-show_frames’ 显示输入多媒体流中的每一帧以及字幕的信息
‘-show_streams’ 显示输入多媒体流中每一个流的信息
‘-show_programs’ 显示输入多媒体流中程序以及它们的流的信息
‘-show_chapters’ 显示格式中存储的章节信息
‘-count_frames’ 计算每一个流中的帧数,在相应的段中进行显示
‘-count_packets’ 计算每一个流中的包数,在相应的段中进行显示
‘-show_program_version’ 显示程序版本及配置相关信息
‘-show_library_versions’ 显示库版本相关信息
‘-show_versions’ 显示程序和库版本相关信息。相当于同时设置‘-show_program_version’ 和
‘-show_library_versions’
‘-i input_file’ 指定输入文件
举例:
ffprobe -print_format json -show_format -show_streams -i test.mp4
结果:
ffprobe version 4.1.3 Copyright (c) 2007-2019 the FFmpeg developers
built with gcc 8.3.1 (GCC) 20190414
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
{
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.20.100
Duration: 00:00:05.50, start: 0.000000, bitrate: 523 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 720x640 [SAR 512:309 DAR 192:103], 450 kb/s, 10 fps, 10 tbr, 10240 tbn, 20 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 69 kb/s (default)
Metadata:
handler_name : SoundHandler
"streams": [
{
"index": 0,
"codec_name": "h264",
"codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
"profile": "High",
"codec_type": "video",
"codec_time_base": "1/20",
"codec_tag_string": "avc1",
"codec_tag": "0x31637661",
"width": 720,
"height": 640,
"coded_width": 720,
"coded_height": 640,
"has_b_frames": 2,
"sample_aspect_ratio": "512:309",
"display_aspect_ratio": "192:103",
"pix_fmt": "yuv420p",
"level": 31,
"chroma_location": "left",
"refs": 1,
"is_avc": "true",
"nal_length_size": "4",
"r_frame_rate": "10/1",
"avg_frame_rate": "10/1",
"time_base": "1/10240",
"start_pts": 0,
"start_time": "0.000000",
"duration_ts": 56320,
"duration": "5.500000",
"bit_rate": "450280",
"bits_per_raw_sample": "8",
"nb_frames": "55",
"disposition": {
"default": 1,
"dub": 0,
"original": 0,
"comment": 0,
"lyrics": 0,
"karaoke": 0,
"forced": 0,
"hearing_impaired": 0,
"visual_impaired": 0,
"clean_effects": 0,
"attached_pic": 0,
"timed_thumbnails": 0
},
"tags": {
"language": "und",
"handler_name": "VideoHandler"
}
},
{
"index": 1,
"codec_name": "aac",
"codec_long_name": "AAC (Advanced Audio Coding)",
"profile": "LC",
"codec_type": "audio",
"codec_time_base": "1/44100",
"codec_tag_string": "mp4a",
"codec_tag": "0x6134706d",
"sample_fmt": "fltp",
"sample_rate": "44100",
"channels": 1,
"channel_layout": "mono",
"bits_per_sample": 0,
"r_frame_rate": "0/0",
"avg_frame_rate": "0/0",
"time_base": "1/44100",
"start_pts": 0,
"start_time": "0.000000",
"duration_ts": 232672,
"duration": "5.276009",
"bit_rate": "69929",
"max_bit_rate": "69929",
"nb_frames": "229",
"disposition": {
"default": 1,
"dub": 0,
"original": 0,
"comment": 0,
"lyrics": 0,
"karaoke": 0,
"forced": 0,
"hearing_impaired": 0,
"visual_impaired": 0,
"clean_effects": 0,
"attached_pic": 0,
"timed_thumbnails": 0
},
"tags": {
"language": "und",
"handler_name": "SoundHandler"
}
}
],
"format": {
"filename": "test.mp4",
"nb_streams": 2,
"nb_programs": 0,
"format_name": "mov,mp4,m4a,3gp,3g2,mj2",
"format_long_name": "QuickTime / MOV",
"start_time": "0.000000",
"duration": "5.500000",
"size": "359688",
"bit_rate": "523182",
"probe_score": 100,
"tags": {
"major_brand": "isom",
"minor_version": "512",
"compatible_brands": "isomiso2avc1mp41",
"encoder": "Lavf58.20.100"
}
}
}