Identifying h264 frame types?

will at mcelderry.com will at mcelderry.com
Thu Jan 25 12:25:01 UTC 2024


Hi All,


Short version:
   Is there a way to identify if a sample/frame provided to an appsink 
has been produced from an h264 I-frame (or P-frame/B-frame)?

Long version:

As I've already discussed on this list (thanks to Nicolas for his 
input), I've been investigating seeking to a specific frame.
I am building a table of frame index to frame time, however that's not 
as simple as it may first seem.

Some behaviour around seeking requires knowing what type of frame is 
being indexed for seeking to later (e.g. I-frame or P-frame - there are 
no B-frames in my data at present).

I can identify all key frames by using an extra "key frame 
identification process".
The identification process is to repetitively seek using  
'Gst.SeekFlags.KEY_UNIT | Gst.SeekFlags.SNAP_AFTER | 
Gst.SeekFlags.FLUSH', then requesting the frame and building a list of 
metadata that can be used to identify the key frames.

When iterating over all frames to build the index, I can then lookup to 
confirm if this frame is an I-frame using the metadata.

It strikes me that this may be redundant if I have missed some metadata 
about the frame.

     Can anyone suggest a faster way to identify the type of the frame?

Speeding this up with a single pass over the data would be very useful.

Thanks!

Will.


More information about the gstreamer-devel mailing list