Can you find key frame in h264 video without decoding?
Marianna Smidth Buschle
msb at qtec.com
Wed Jun 1 05:55:12 UTC 2022
> Does anyone know if key frames can be found without decoding?
Yes, this how how I have been doing it to switch between 2 live h264
encoded video sources (switch on Key-Frame):
defgot_buff(self, pad, info, video_pad, audio_pad):
buf= info.get_buffer()
print("Waiting for Key-frame in pad '{}'...".format(video_pad))
ifbuf.has_flags(Gst.BufferFlags.DELTA_UNIT) isFalse:
print("Key-frame received in pad '{}'".format(video_pad))
self.video_selector.set_property("listen-to", video_pad)
self.audio_selector.set_property("listen-to", audio_pad)
returnGst.PadProbeReturn.REMOVE
else:
returnGst.PadProbeReturn.OK
defcheck_kf(self, video_pad, vsink, audio_pad):
# add pad probe
vpad= vsink.get_static_pad("sink")
vpad.add_probe(Gst.PadProbeType.BUFFER, self.got_buff, video_pad, audio_pad)
returnTrue
"udpsrc address=127.0.0.1 port=5000 !
application/x-rtp,media=video,payload=33,clock-rate=90000,encoding-name=MP2T
! rtpbin ! rtpmp2tdepay ! "
"tsdemux : h264parse ! "
"interpipesink name=cam1_V sync=false async=false "
And in some cases I have experienced the flags missing unless I set the
caps after 'h264parse' to
"video/x-h264,stream-format=byte-stream,alignment=au"
Best Regards
Marianna
On 31.05.2022 14.00, gstreamer-devel-request 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
--
Best regards / Med venlig hilsen
“Marianna Smidth Buschle”
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20220601/169808bf/attachment-0001.htm>
More information about the gstreamer-devel
mailing list