[Live-devel] Determining h.264 frame type in a sink

Ross Finlayson finlayson at live555.com
Thu May 14 19:25:03 PDT 2015


> I am receiving h.264 frames in a method of a class whose implementation is based on DummySink class derived from MediaSink. My program is not decoding or displaying frames, it is just re-transmitting them to another application that needs to know frame type without parsing frames.
> What's the best way to determine the type of the frame (I, P, or B)?

Look at the last 5 bits of the first byte of the NAL unit - i.e., take the first byte of the NAL unit, and ‘and’ it with 0x1F.  This gives you the “nal_unit_type”.

The meaning of each NAL unit type is defined by the H.264 video specification.  You can also see it described in our code in the array “nal_unit_type_description_h264”; see “liveMedia/H264or5VideoStreamFramer.cpp”, lines 194-226.


Ross Finlayson
Live Networks, Inc.
http://www.live555.com/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20150514/351d4383/attachment.html>


More information about the live-devel mailing list