2

H.264我使用以下ffmpeg命令从编码文件创建了传输流:

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 字节,而是和pkt_size我用-show_frames.

有人可以解释为什么-show_packets传输流的大小不是 188 字节吗?mp4多路复用时我做错了什么TS吗?

4

1 回答 1

1

两个pkt_size必须相等。从 gitHub 的 src 代码中查看这个ffprobe 测试。

[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_size都是以字节为单位的压缩帧的大小。

也看到这个问题票

于 2015-10-16T12:17:35.193 回答