Can I get the referencing list of each frame of h.264 using ffmpeg or ffprobe?

Viewed 379

I want to get the referencing list of each frame of h.264 video. For example, I want to get the list as following:

Frame 0: Reference frame 0

Frame 1: Reference frame 0

Frame 2: Reference frame 1,3

Frame 3: Reference frame 0

Can I get the referencing information above using ffmpeg or ffprobe? I have googled but got little harvest. Or are there any software can do this? Thanks for your relpy!

1 Answers

The direct printing of List 0 and List 1 references is hidden by a preprocessor guard. However, you can get close by printing the decoder's mem mgmt operations

ffmpeg -debug mmco -i INPUT -an -f null -

This will print readouts in the following format.

[h264 @ 000001c7cf382340] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 0
[h264 @ 000001c7cf382340] short term list:
[h264 @ 000001c7cf382340] 0 fn:7 poc:65552 000001c7d1090d80
[h264 @ 000001c7cf382340] 1 fn:6 poc:65556 000001c7d0da4600
[h264 @ 000001c7cf382340] 2 fn:5 poc:65548 000001c7d0b00500
[h264 @ 000001c7cf382340] long term list:

The fn refers to the frame index in decoding order. The poc is the display order (with a base offset of 65536).

Related