FFmpeg命令行练习(5)

ffprobe工具


查看多媒体数据包信息
ffprobe -show_packets 1111.avi
[PACKET]
codec_type=audio
stream_index=1
pts=1496
pts_time=39.079184
dts=1496
dts_time=39.079184
duration=1
duration_time=0.026122
convergence_duration=N/A
convergence_duration_time=N/A
size=2240
pos=3205454
flags=K_
[/PACKET]

通过组合参数查看包中的具体数据
ffprobe -show_data -show_packets 1111.avi
[PACKET]
codec_type=audio
stream_index=1
pts=1495
pts_time=39.053061
dts=1495
dts_time=39.053061
duration=1
duration_time=0.026122
convergence_duration=N/A
convergence_duration_time=N/A
size=209
pos=3166268
flags=K_
data=
00000000: fffb 5264 b70f f171 0e3e 9718 6000 18a1  ..Rd...q.>..`...
00000010: 37a0 e304 0040 0001 a400 0000 2000 0034  7....@...... ..4
00000020: 8000 0004 5555 5555 5555 5555 5555 5555  ....UUUUUUUUUUUU
00000030: 5555 5555 5555 5555 5555 5555 5555 5555  UUUUUUUUUUUUUUUU
00000040: 5555 5555 5555 5555 5555 5555 5555 5555  UUUUUUUUUUUUUUUU
00000050: 5555 5555 5555 5555 5555 5555 5555 5555  UUUUUUUUUUUUUUUU
00000060: 5555 5555 5555 5555 5555 5555 5555 5555  UUUUUUUUUUUUUUUU
00000070: 5555 5555 5555 5555 5555 5555 5555 5555  UUUUUUUUUUUUUUUU
00000080: 5555 5555 5555 5555 5555 5555 5555 5555  UUUUUUUUUUUUUUUU
00000090: 5555 5555 5555 5555 5555 5555 5555 5555  UUUUUUUUUUUUUUUU
000000a0: 5555 5555 5555 5555 5555 5555 5555 5555  UUUUUUUUUUUUUUUU
000000b0: 5555 5555 5555 5555 5555 5555 5555 5555  UUUUUUUUUUUUUUUU
000000c0: 5555 5555 5555 5555 5555 5555 5555 5555  UUUUUUUUUUUUUUUU
000000d0: 55                                       U

[/PACKET]

查看多媒体的封装格式
ffprobe -show_format 1111.avi
[FORMAT]
filename=1111.avi
nb_streams=2
nb_programs=0
format_name=avi
format_long_name=AVI (Audio Video Interleaved)
start_time=0.000000
duration=39.157551
size=3211264
bit_rate=656070
probe_score=100
TAG:encoder=Lavf56.19.100
[/FORMAT]

查看视频文件中的帧信息
ffprobe -show_frames 1111.avi
[FRAME]
media_type=video
stream_index=0
key_frame=1
pkt_pts=N/A
pkt_pts_time=N/A
pkt_dts=171
pkt_dts_time=7.125000
best_effort_timestamp=171
best_effort_timestamp_time=7.125000
pkt_duration=1
pkt_duration_time=0.041667
pkt_pos=694810
pkt_size=12381
width=800
height=368
pix_fmt=yuv420p
sample_aspect_ratio=1:1
pict_type=I
coded_picture_number=169
display_picture_number=0
interlaced_frame=0
top_field_first=0
repeat_pict=0
color_range=unknown
color_space=unknown
color_primaries=unknown
color_transfer=unknown
chroma_location=left
[/FRAME]

查看视频文件中的流信息
ffprobe -show_streams 1111.avi
[STREAM]
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/48
codec_tag_string=H264
codec_tag=0x34363248
width=800
height=368
coded_width=800
coded_height=368
has_b_frames=2
sample_aspect_ratio=1:1
display_aspect_ratio=50:23
pix_fmt=yuv420p
level=30
color_range=unknown
color_space=unknown
color_transfer=unknown
color_primaries=unknown
chroma_location=left
field_order=progressive
timecode=N/A
refs=1
is_avc=false
nal_length_size=0
id=N/A
r_frame_rate=24/1
avg_frame_rate=24/1
time_base=1/24
start_pts=0
start_time=0.000000
duration_ts=936
duration=39.000000
bit_rate=579574
max_bit_rate=N/A
bits_per_raw_sample=8
nb_frames=936
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=0
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
[/STREAM]
[STREAM]
index=1
codec_name=mp3
codec_long_name=MP3 (MPEG audio layer 3)
profile=unknown
codec_type=audio
codec_time_base=1/44100
codec_tag_string=U[0][0][0]
codec_tag=0x0055
sample_fmt=fltp
sample_rate=44100
channels=2
channel_layout=stereo
bits_per_sample=0
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=32/1225
start_pts=0
start_time=0.000000
duration_ts=1499
duration=39.157551
bit_rate=64000
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=1499
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=0
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
[/STREAM]

XML格式输出显示
ffprobe -of xml -show_streams 1111.avi
<?xml version="1.0" encoding="UTF-8"?>
<ffprobe>
Input #0, avi, from '1111.avi':
  Metadata:
    encoder         : Lavf56.19.100
  Duration: 00:00:39.16, start: 0.000000, bitrate: 656 kb/s
    Stream #0:0: Video: h264 (High) (H264 / 0x34363248), yuv420p(progressive), 800x368 [SAR 1:1 DAR 50:23], 579 kb/s, 24 fps, 24 tbr, 24 tbn, 48 tbc
    Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo, fltp, 64 kb/s
    <streams>
        <stream 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/48" codec_tag_string="H264" codec_tag="0x34363248" width="800" height="368" coded_width="800" coded_height="368" has_b_frames="2" sample_aspect_ratio="1:1" display_aspect_ratio="50:23" pix_fmt="yuv420p" level="30" chroma_location="left" field_order="progressive" refs="1" is_avc="false" nal_length_size="0" r_frame_rate="24/1" avg_frame_rate="24/1" time_base="1/24" start_pts="0" start_time="0.000000" duration_ts="936" duration="39.000000" bit_rate="579574" bits_per_raw_sample="8" nb_frames="936">
            <disposition default="0" 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"/>
        </stream>
        <stream index="1" codec_name="mp3" codec_long_name="MP3 (MPEG audio layer 3)" codec_type="audio" codec_time_base="1/44100" codec_tag_string="U[0][0][0]" codec_tag="0x0055" sample_fmt="fltp" sample_rate="44100" channels="2" channel_layout="stereo" bits_per_sample="0" r_frame_rate="0/0" avg_frame_rate="0/0" time_base="32/1225" start_pts="0" start_time="0.000000" duration_ts="1499" duration="39.157551" bit_rate="64000" nb_frames="1499">
            <disposition default="0" 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"/>
        </stream>
    </streams>
</ffprobe>

INI格式输出显示
ffprobe -of ini -show_streams 1111.avi
[streams.stream.0]
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/48
codec_tag_string=H264
codec_tag=0x34363248
width=800
height=368
coded_width=800
coded_height=368
has_b_frames=2
sample_aspect_ratio=1\:1
display_aspect_ratio=50\:23
pix_fmt=yuv420p
level=30
color_range=unknown
color_space=unknown
color_transfer=unknown
color_primaries=unknown
chroma_location=left
field_order=progressive
timecode=N/A
refs=1
is_avc=false
nal_length_size=0
id=N/A
r_frame_rate=24/1
avg_frame_rate=24/1
time_base=1/24
start_pts=0
start_time=0.000000
duration_ts=936
duration=39.000000
bit_rate=579574
max_bit_rate=N/A
bits_per_raw_sample=8
nb_frames=936
nb_read_frames=N/A
nb_read_packets=N/A

FLAT格式输出显示
ffprobe -of flat -show_streams 1111.avi
streams.stream.0.index=0
streams.stream.0.codec_name="h264"
streams.stream.0.codec_long_name="H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"
streams.stream.0.profile="High"
streams.stream.0.codec_type="video"
streams.stream.0.codec_time_base="1/48"
streams.stream.0.codec_tag_string="H264"
streams.stream.0.codec_tag="0x34363248"
streams.stream.0.width=800
streams.stream.0.height=368
streams.stream.0.coded_width=800
streams.stream.0.coded_height=368
streams.stream.0.has_b_frames=2
streams.stream.0.sample_aspect_ratio="1:1"
streams.stream.0.display_aspect_ratio="50:23"
streams.stream.0.pix_fmt="yuv420p"
streams.stream.0.level=30
streams.stream.0.color_range="unknown"
streams.stream.0.color_space="unknown"
streams.stream.0.color_transfer="unknown"
streams.stream.0.color_primaries="unknown"
streams.stream.0.chroma_location="left"
streams.stream.0.field_order="progressive"
streams.stream.0.timecode="N/A"
streams.stream.0.refs=1
streams.stream.0.is_avc="false"
streams.stream.0.nal_length_size="0"
streams.stream.0.id="N/A"
streams.stream.0.r_frame_rate="24/1"
streams.stream.0.avg_frame_rate="24/1"
streams.stream.0.time_base="1/24"
streams.stream.0.start_pts=0
streams.stream.0.start_time="0.000000"
streams.stream.0.duration_ts=936
streams.stream.0.duration="39.000000"
streams.stream.0.bit_rate="579574"
streams.stream.0.max_bit_rate="N/A"
streams.stream.0.bits_per_raw_sample="8"
streams.stream.0.nb_frames="936"
streams.stream.0.nb_read_frames="N/A"
streams.stream.0.nb_read_packets="N/A"
streams.stream.0.disposition.default=0
streams.stream.0.disposition.dub=0
streams.stream.0.disposition.original=0
streams.stream.0.disposition.comment=0
streams.stream.0.disposition.lyrics=0
streams.stream.0.disposition.karaoke=0
streams.stream.0.disposition.forced=0
streams.stream.0.disposition.hearing_impaired=0
streams.stream.0.disposition.visual_impaired=0
streams.stream.0.disposition.clean_effects=0
streams.stream.0.disposition.attached_pic=0
streams.stream.0.disposition.timed_thumbnails=0

JSON格式输出显示
ffprobe -of json -show_streams 1111.avi
 "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/48",
            "codec_tag_string": "H264",
            "codec_tag": "0x34363248",
            "width": 800,
            "height": 368,
            "coded_width": 800,
            "coded_height": 368,
            "has_b_frames": 2,
            "sample_aspect_ratio": "1:1",
            "display_aspect_ratio": "50:23",
            "pix_fmt": "yuv420p",
            "level": 30,
            "chroma_location": "left",
            "field_order": "progressive",
            "refs": 1,
            "is_avc": "false",
            "nal_length_size": "0",
            "r_frame_rate": "24/1",
            "avg_frame_rate": "24/1",
            "time_base": "1/24",
            "start_pts": 0,
            "start_time": "0.000000",
            "duration_ts": 936,
            "duration": "39.000000",
            "bit_rate": "579574",
            "bits_per_raw_sample": "8",
            "nb_frames": "936",
            "disposition": {
                "default": 0,
                "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
            }
        },
        {
            "index": 1,
            "codec_name": "mp3",
            "codec_long_name": "MP3 (MPEG audio layer 3)",
            "codec_type": "audio",
            "codec_time_base": "1/44100",
            "codec_tag_string": "U[0][0][0]",
            "codec_tag": "0x0055",
            "sample_fmt": "fltp",
            "sample_rate": "44100",
            "channels": 2,
            "channel_layout": "stereo",
            "bits_per_sample": 0,
            "r_frame_rate": "0/0",
            "avg_frame_rate": "0/0",
            "time_base": "32/1225",
            "start_pts": 0,
            "start_time": "0.000000",
            "duration_ts": 1499,
            "duration": "39.157551",
            "bit_rate": "64000",
            "nb_frames": "1499",
            "disposition": {
                "default": 0,
                "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
            }
        }
    ]

CSV格式输出显示
ffprobe -of csv -show_packets 1111.avi
packet,video,0,N/A,N/A,0,0.000000,1,0.041667,N/A,N/A,17373,9996,K_
packet,video,0,N/A,N/A,1,0.041667,1,0.041667,N/A,N/A,2852,27378,__
packet,audio,1,0,0.000000,0,0.000000,1,0.026122,N/A,N/A,208,30238,K_
packet,video,0,N/A,N/A,2,0.083333,1,0.041667,N/A,N/A,2622,30454,__
packet,audio,1,1,0.026122,1,0.026122,1,0.026122,N/A,N/A,209,33108,K_
packet,audio,1,2,0.052245,2,0.052245,1,0.026122,N/A,N/A,209,33326,K_
packet,video,0,N/A,N/A,3,0.125000,1,0.041667,N/A,N/A,2877,33544,__
packet,audio,1,3,0.078367,3,0.078367,1,0.026122,N/A,N/A,209,36430,K_
packet,audio,1,4,0.104490,4,0.104490,1,0.026122,N/A,N/A,209,36648,K_
packet,video,0,N/A,N/A,4,0.166667,1,0.041667,N/A,N/A,3357,36866,__
packet,audio,1,5,0.130612,5,0.130612,1,0.026122,N/A,N/A,209,40232,K_
packet,video,0,N/A,N/A,5,0.208333,1,0.041667,N/A,N/A,2917,40450,__
packet,audio,1,6,0.156735,6,0.156735,1,0.026122,N/A,N/A,209,43376,K_
packet,audio,1,7,0.182857,7,0.182857,1,0.026122,N/A,N/A,209,43594,K_
packet,video,0,N/A,N/A,6,0.250000,1,0.041667,N/A,N/A,5327,43812,__
packet,audio,1,8,0.208980,8,0.208980,1,0.026122,N/A,N/A,209,49148,K_

只查看视频的frames信息
ffprobe -show_frames -select_streams v -of xml 1111.avi
<ffprobe>
Input #0, avi, from '1111.avi':
  Metadata:
    encoder         : Lavf56.19.100
  Duration: 00:00:39.16, start: 0.000000, bitrate: 656 kb/s
    Stream #0:0: Video: h264 (High) (H264 / 0x34363248), yuv420p(progressive), 800x368 [SAR 1:1 DAR 50:23], 579 kb/s, 24 fps, 24 tbr, 24 tbn, 48 tbc
    Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo, fltp, 64 kb/s
    <frames>
        <frame media_type="video" stream_index="0" key_frame="1" pkt_dts="2" pkt_dts_time="0.083333" best_effort_timestamp="2" best_effort_timestamp_time="0.083333" pkt_duration="1" pkt_duration_time="0.041667" pkt_pos="9996" pkt_size="17373" width="800" height="368" pix_fmt="yuv420p" sample_aspect_ratio="1:1" pict_type="I" coded_picture_number="0" display_picture_number="0" interlaced_frame="0" top_field_first="0" repeat_pict="0" chroma_location="left"/>
        <frame media_type="video" stream_index="0" key_frame="0" pkt_dts="3" pkt_dts_time="0.125000" best_effort_timestamp="3" best_effort_timestamp_time="0.125000" pkt_duration="1" pkt_duration_time="0.041667" pkt_pos="27378" pkt_size="2852" width="800" height="368" pix_fmt="yuv420p" sample_aspect_ratio="1:1" pict_type="P" coded_picture_number="1" display_picture_number="0" interlaced_frame="0" top_field_first="0" repeat_pict="0" chroma_location="left"/>
        <frame media_type="video" stream_index="0" key_frame="0" pkt_dts="4" pkt_dts_time="0.166667" best_effort_timestamp="4" best_effort_timestamp_time="0.166667" pkt_duration="1" pkt_duration_time="0.041667" pkt_pos="30454" pkt_size="2622" width="800" height="368" pix_fmt="yuv420p" sample_aspect_ratio="1:1" pict_type="P" coded_picture_number="2" display_picture_number="0" interlaced_frame="0" top_field_first="0" repeat_pict="0" chroma_location="left"/>
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 204,793评论 6 478
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 87,567评论 2 381
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 151,342评论 0 338
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,825评论 1 277
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,814评论 5 368
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,680评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,033评论 3 399
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,687评论 0 258
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 42,175评论 1 300
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,668评论 2 321
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,775评论 1 332
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,419评论 4 321
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,020评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,978评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,206评论 1 260
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 45,092评论 2 351
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,510评论 2 343

推荐阅读更多精彩内容

  • ffprobe主要用来查看多媒体文件的信息。本文带领大家学习ffprobe的常用命令。常用参数比较多,可以使用ff...
    书文换酒钱阅读 42,438评论 0 12
  • 1.简介 ffmpeg [global_options] {[input_file_options] -i inp...
    你家旭哥阅读 6,560评论 1 4
  • 因为正在学习音视频,从当当买了关于FFmpeg的书,在家补充知识。遇到了一些命令行的使用,我把它从书上移到笔记上,...
    请叫我果爸阅读 14,545评论 0 18
  • 一个人 静静的独享美味 眼前蛋糕的美 嘴里味觉的美 家人视频的关怀 等待着好姐妹 心情也美美的 二个人 欢快的逛街...
    平凡女汉子阅读 249评论 0 2
  • 我是一个植物学家。 好多人很羡慕我,要我谈谈小时候刻苦学习的故事。其实,那时我是一个出名的“淘气鬼”。 我的...
    三只stone阅读 319评论 1 1