CompNet
CompNet

Reputation: 77

ffprobe does not show packet size of a mpeg transport stream as 188 bytes

I created a transport stream from a H.264 encoded file using the following ffmpeg command:

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

Now I want to check the frames and packets within the transport stream. I used

ffprobe -show_frames

which shows the frame details for audio and video frames. But I'm confused about the pkt_size field. Is it the actual frame size of each elementary stream of audio and video (I/B/P frames)?

Also, when I run

ffprobe -show_packets

is it supposed to give each packet details in the transport stream? Because the size field of each packet is not 188 bytes, rather it is same as the pkt_size I got with -show_frames.

Could someone please explain why the size in -show_packets of transport stream is not 188 bytes? Did I do anything wrong while multiplexing mp4 to TS?

Upvotes: 2

Views: 4545

Answers (1)

albertoiNET
albertoiNET

Reputation: 1348

Both pkt_size must to be equals. See this 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

Is the same. Both pkt_size are the size of compressed frame in bytes.

See this issue ticket too

Upvotes: 1

Related Questions