how to measure bitrate of video over time
It does not make sense to speak of the size of an encoded frame in an inter-coded video stream, which is typical of MPEG-X videos. I-frames are self-contained but P- and B- frames are predicted frames and the final decoded result uses data from various inputs. On the other hand, the size of a single Group of Pictures (GOP) may be a meaningful measure.

The FFmpeg segmenter in combination with a compatible demuxer can break apart the video stream at GOP boundaries. By specifying an ultra-low time for segment size, you can ensure that each segment contains 1 GOP. Running a ffprobe on each segment will then provide the bitrate for that GOP.

I tested the command below on MP4s which had 1) a variable-sized GOP, 2) an intra-coded scheme and 3) fixed GOP of unusual length (11 frames), and each output had the expected result.

ffmpeg -i input.mp4 -an -c:v copy -segment_time 0.00001 -f segment i%0d.mp4


Each segment contained exactly 1 I-frame (each segment of the intra input contained exactly 1 frame in all).

Running ffprobe on each segment gives a bitrate reading:

Duration: 00:00:00.37, start: 4.466016, bitrate: 1539 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
1280x720 [SAR 1:1 DAR 16:9], 1520 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)


The above one is from the 11-frame GOP, and has a bitrate of 1520 kbps.