FFmpeg命令行练习(5)

2019-01-17  本文已影响5人  Goning

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"/>
上一篇 下一篇

猜你喜欢

热点阅读