ffprobe常用命令使用

前言

下面的命令主要是按照包含关系的顺序排序的:文件(对应format)、文件里面的流(对应是stream)、流的组成packet(对应的是packets)、packet里面包含的frame(对应的是frames)

1,ffprobe -show_format的使用

用来查看当前文件的信息。

执行 ffprobe -show_format C:\Users\Administrator\Desktop\784dd15e-a13f-4369-934c-ce1a187799c3_1611126662.mp4

得到下面的信息:包括媒体流的数量、文件的大小和时长、比特率等信息

[FORMAT]
filename=C:\Users\Administrator\Desktop\784dd15e-a13f-4369-934c-ce1a187799c3_1611126662.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=10.884000
size=503911
bit_rate=370386
probe_score=100
TAG:major_brand=isom
TAG:minor_version=0
TAG:compatible_brands=mp41avc1psp
TAG:creation_time=2021-01-20T07:10:59.000000Z
[/FORMAT]
2,ffprobe -show_streams的使用

用来查看当前文件包含的多媒体流信息(Video、Audio、Subtitle)。

执行 ffprobe -show_streams C:\Users\Administrator\Desktop\784dd15e-a13f-4369-934c-ce1a187799c3_1611126662.mp4

得到下面的信息:包括时间、大小、数量等信息

[STREAM]
index=0
codec_name=h264
codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
profile=Baseline
codec_type=video
codec_time_base=2733/82000
codec_tag_string=avc1
codec_tag=0x31637661
width=368
height=640
coded_width=368
coded_height=640
closed_captions=0
has_b_frames=0
sample_aspect_ratio=N/A
display_aspect_ratio=N/A
pix_fmt=yuv420p
level=22
color_range=tv
color_space=smpte170m
color_transfer=smpte170m
color_primaries=bt470bg
chroma_location=left
field_order=unknown
timecode=N/A
refs=1
is_avc=true
nal_length_size=4
id=N/A
r_frame_rate=15/1
avg_frame_rate=41000/2733
time_base=1/1000
start_pts=0
start_time=0.000000
duration_ts=10884
duration=10.884000
bit_rate=299489
max_bit_rate=N/A
bits_per_raw_sample=8
nb_frames=164
...
TAG:creation_time=2021-01-20T07:10:59.000000Z
TAG:language=und
TAG:handler_name=Video Handler
[/STREAM]
[STREAM]
index=1
codec_name=aac
codec_long_name=AAC (Advanced Audio Coding)
profile=LC
codec_type=audio
codec_time_base=1/48000
codec_tag_string=mp4a
codec_tag=0x6134706d
sample_fmt=fltp
sample_rate=48000
channels=1
channel_layout=mono
bits_per_sample=0
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/1000
start_pts=0
start_time=0.000000
duration_ts=10880
duration=10.880000
bit_rate=64125
max_bit_rate=64000
bits_per_raw_sample=N/A
nb_frames=511
...
TAG:creation_time=2021-01-20T07:10:59.000000Z
TAG:language=und
TAG:handler_name=Audio Handler
[/STREAM]
3,ffprobe -show_packets的使用

用来查看所有的packet信息。

如果想看到每个packet的数据包含data可以使用ffprobe -show_data -show_packets 文件名。

执行 ffprobe -show_packets C:\Users\Administrator\Desktop\784dd15e-a13f-4369-934c-ce1a187799c3_1611126662.mp4 ,

得到下面的信息:包含每个packet的时长、大小、解码和显示时间戳等信息

...
[PACKET]
codec_type=video
stream_index=0
pts=10332
pts_time=10.332000
dts=10332
dts_time=10.332000
duration=66
duration_time=0.066000
convergence_duration=N/A
convergence_duration_time=N/A
size=1264
pos=472228
flags=__
[/PACKET]
[PACKET]
codec_type=audio
stream_index=1
pts=10369
pts_time=10.369000
dts=10369
dts_time=10.369000
duration=21
duration_time=0.021000
convergence_duration=N/A
convergence_duration_time=N/A
size=170
pos=473492
flags=K_
[/PACKET]
...
4,ffprobe -show_frames的使用

用来查看所有的frame信息。

执行 ffprobe -show_frames C:\Users\Administrator\Desktop\784dd15e-a13f-4369-934c-ce1a187799c3_1611126662.mp4

得到下面的信息:包含每个frame的时长、大小、解码和显示时间戳等信息

...
[FRAME]
media_type=video
stream_index=0
key_frame=0
pkt_pts=999
pkt_pts_time=0.999000
pkt_dts=999
pkt_dts_time=0.999000
best_effort_timestamp=999
best_effort_timestamp_time=0.999000
pkt_duration=66
pkt_duration_time=0.066000
pkt_pos=55252
pkt_size=2096
width=368
height=640
pix_fmt=yuv420p
sample_aspect_ratio=N/A
pict_type=P
coded_picture_number=15
display_picture_number=0
interlaced_frame=0
top_field_first=0
repeat_pict=0
color_range=tv
color_space=smpte170m
color_primaries=bt470bg
color_transfer=smpte170m
chroma_location=left
[/FRAME]
[FRAME]
media_type=audio
stream_index=1
key_frame=1
pkt_pts=1025
pkt_pts_time=1.025000
pkt_dts=1025
pkt_dts_time=1.025000
best_effort_timestamp=1025
best_effort_timestamp_time=1.025000
pkt_duration=21
pkt_duration_time=0.021000
pkt_pos=57348
pkt_size=170
sample_fmt=fltp
nb_samples=1024
channels=1
channel_layout=mono
[/FRAME]
...
样式

如果想指定执行上面命令显示信息的格式可以在文件名前加上-of csv或者xml或json等

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值