ffprobe
多媒体流分析工具
补充说明
ffprobe命令 是 FFmpeg 套件中的多媒体分析工具,用于收集多媒体文件或流的详细信息,包括编解码器、比特率、分辨率、时长、元数据等。
语法
ffprobe [选项] 输入文件
选项
-v, --verbose # 详细输出
-show_format # 显示容器格式信息
-show_streams # 显示每个流的信息
-show_packets # 显示包信息
-show_frames # 显示帧信息
-of, --print_format # 输出格式(default/json/csv/flat/ini/xml)
-select_streams # 选择特定流(v=视频,a=音频)
-sexagesimal # 时间以 HH:MM:SS.xxx 格式显示
-i # 输入文件
实例
# 查看文件基本信息
ffprobe video.mp4
# 查看容器格式信息
ffprobe -show_format video.mp4
# 查看所有流信息
ffprobe -show_streams video.mp4
# JSON 格式输出
ffprobe -v quiet -print_format json -show_format -show_streams video.mp4
# 仅查看视频流
ffprobe -v quiet -select_streams v -show_entries stream=codec_name,width,height,bit_rate video.mp4
# 查看视频时长
ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 video.mp4
# 查看元数据
ffprobe -v quiet -show_entries format_tags video.mp4
# 查看帧信息
ffprobe -show_frames video.mp4
# 检查音频流
ffprobe -v quiet -select_streams a -show_streams audio.mp3
# 输出到 CSV
ffprobe -v quiet -of csv -show_entries stream=index,codec_name,codec_type video.mp4