2015-09-27 57 views
2

我使用以下ffmpeg命令创建从H.264编码的文件的传输流:ffprobe不显示MPEG传输流的数据包大小为188个字节

ffmpeg -i encoded.mp4 -c copy -map 0 -vbsf h264_mp4toannexb mpegts sample.ts

现在我想要查询的帧和传输流内的数据包。我用

ffprobe -show_frames

其示出了用于音频和视频帧的帧的信息。但我对pkt_size字段感到困惑。是音频和视频(I/B/P帧)每个基本流的实际帧大小?

而且,当我运行

ffprobe -show_packets

是它该做的传输流中的每个数据包的详细信息?因为每个数据包的size字段不是188字节,而是与-show_frames得到的pkt_size相同。

请问有人可以解释为什么传输流的-show_packets的大小不是188字节?在复用mp4TS时我做错了什么?

+0

看来ffprobe只给出了有关PES包,而不是即使输入文件的传输流文件(TS容器)的TS包的信息。这是对的吗? – CompNet

+0

我还没有使用ffprobe,但很可能它会显示解复用数据包的大小,即来自基本(h264)流。您可以尝试使用mpeg-ts分析器软件,网上几乎免费。 –

+0

嗨安东,谢谢。是的,我使用了ts分析器,现在它正确显示了每个TS数据包的详细信息,并且TS数据包的总数与(.ts文件/ 188的大小)完全一致。只有我无法确认的是每个TS数据包在.ts文件中复用的时间戳。包含PES报头的TS数据包为每个TS数据包提供PTS,DTS但不提供时间戳。有什么方法可以知道每个TS数据包在TS中被多路复用的时间戳吗? – CompNet

回答

2

两者pkt_size必须等于。看到这个ffprobe test from src code from gitHub

[packets_and_frames.packet.0] 
codec_type=audio 
stream_index=0 
pts=0 
pts_time=0.000000 
dts=0 
dts_time=0.000000 
duration=1024 
duration_time=0.023220 
convergence_duration=N/A 
convergence_duration_time=N/A 
size=2048 
pos=642 
flags=K 

[packets_and_frames.frame.0] 
media_type=audio 
stream_index=0 
key_frame=1 
pkt_pts=0 
pkt_pts_time=0.000000 
pkt_dts=0 
pkt_dts_time=0.000000 
best_effort_timestamp=0 
best_effort_timestamp_time=0.000000 
pkt_duration=1024 
pkt_duration_time=0.023220 
pkt_pos=642 
pkt_size=2048 
sample_fmt=s16 
nb_samples=1024 
channels=1 
channel_layout=unknown 

[packets_and_frames.packet.1] 
codec_type=video 
stream_index=1 
pts=0 
pts_time=0.000000 
dts=0 
dts_time=0.000000 
duration=2048 
duration_time=0.040000 
convergence_duration=N/A 
convergence_duration_time=N/A 
size=230400 
pos=2717 
flags=K 

[packets_and_frames.frame.1] 
media_type=video 
stream_index=1 
key_frame=1 
pkt_pts=0 
pkt_pts_time=0.000000 
pkt_dts=0 
pkt_dts_time=0.000000 
best_effort_timestamp=0 
best_effort_timestamp_time=0.000000 
pkt_duration=2048 
pkt_duration_time=0.040000 
pkt_pos=2717 
pkt_size=230400 
width=320 
height=240 
pix_fmt=rgb24 
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 

[packets_and_frames.packet.2] 
codec_type=video 
stream_index=2 
pts=0 
pts_time=0.000000 
dts=0 
dts_time=0.000000 
duration=2048 
duration_time=0.040000 
convergence_duration=N/A 
convergence_duration_time=N/A 
size=30000 
pos=233138 
flags=K 

[packets_and_frames.frame.2] 
media_type=video 
stream_index=2 
key_frame=1 
pkt_pts=0 
pkt_pts_time=0.000000 
pkt_dts=0 
pkt_dts_time=0.000000 
best_effort_timestamp=0 
best_effort_timestamp_time=0.000000 
pkt_duration=2048 
pkt_duration_time=0.040000 
pkt_pos=233138 
pkt_size=30000 
width=100 
height=100 
pix_fmt=rgb24 
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 

是一样的。 pkt_sizebytes中压缩帧的大小。

this issue ticket too

相关问题