Can you find key frame in h264 video without decoding?

Michael Gruner michael.gruner at ridgerun.com
Tue May 31 19:17:00 UTC 2022


Well, the h264parse handles additional stuff other than adding that flag. It fill missing caps fields based on the incoming bitstream, accumulates NAL units until a full frame is received and, more importantly, may convert between different stream formats (byte-stream, AVC, for example) and alignments (au, nal, for example). My two cents are that I would leave the parser:

- The h264parse may help if you receive a not-so-well-behaved network stream that could make your decoder unhappy.
- The h264parse may help if you are planning on supporting several decoders.
- More importantly, the h264parse is smart enough to bypass itself in case no processing is needed.


> On 31 May 2022, at 06:16, John McDermott <egglue at gmail.com> wrote:
> 
> Hi Michael,
> 
> I’ve noticed that rtph264depay also sets the flag: https://github.com/GStreamer/gst-plugins-good/blob/20bbeb5e37666c53c254c7b08470ad8a00d97630/gst/rtp/gstrtph264depay.c#L973 <https://github.com/GStreamer/gst-plugins-good/blob/20bbeb5e37666c53c254c7b08470ad8a00d97630/gst/rtp/gstrtph264depay.c#L973>
> 
> Would that mean setting the flag again in h264parse is redundant if rtph264depay is in the pipeline?
> 
> Cheers,
> 
> John
> On 31 May 2022, 5:48 AM +1000, Michael Gruner <michael.gruner at ridgerun.com>, wrote:
>> The h264parse will set the DELTA_UNIT flag based on the NAL units.
>> 
>> https://github.com/GStreamer/gst-plugins-bad/blob/ca8068c6d793d7aaa6f2e2cc6324fdedfe2f33fa/gst/videoparsers/gsth264parse.c#L2659 <https://github.com/GStreamer/gst-plugins-bad/blob/ca8068c6d793d7aaa6f2e2cc6324fdedfe2f33fa/gst/videoparsers/gsth264parse.c#L2659>
>> 
>>> On 30 May 2022, at 12:52, John McDermott via gstreamer-devel <gstreamer-devel at lists.freedesktop.org <mailto:gstreamer-devel at lists.freedesktop.org>> wrote:
>>> 
>>> Hi
>>> 
>>> Does anyone know if key frames can be found without decoding? In the context of the pipeline rtspsrc->rtph264depay->h264parse->appsink, which element sets the GST_BUFFER_FLAG_DELTA_UNIT flag? I read that a keyframe has a unique start code in the NAL unit. In that case, does that mean rtph264depay sets the flag?
>>> 
>>> Thanks
>> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20220531/d909b367/attachment.htm>


More information about the gstreamer-devel mailing list