Commandline probe for video bitrate per GOP

0

Is there a way to use ffprobe or similar commandline tools to probe for the video bitrate per GOP?

ffprobe only seems to output the overall bitrate for the whole video but not packets.

ffprobe -i video.mp4 -show_entries packets

which i guess is a group of pictures.

[PACKET]
codec_type=video
stream_index=0
pts=126976
pts_time=9.920000
dts=126464
dts_time=9.880000
duration=512
duration_time=0.040000
convergence_duration=N/A
convergence_duration_time=N/A
size=6229
pos=5648590
flags=__
[/PACKET]

secondplace

Posted 2018-08-06T13:25:01.063

Reputation: 103

Answers

1

A packet is not a group of pictures—depending on the container, a packet is just one frame or can also contain only part of a frame.

You should instead look at whether you have a packet containing a keyframe. Check the flags attribute. If you get a K in it, this is the start of the GOP. Remember the packet DTS and sum up the size attribute until you reach the next keyframe, dividing that sum by the delta in timestamps, or alternatively by the sum of duration_time.

This will give you the bitrate per GOP, including packetization overhead.

slhck

Posted 2018-08-06T13:25:01.063

Reputation: 182 472