Frames are not output correctly

Marianna Smidth Buschle msb at qtec.com
Tue Jun 7 07:02:22 UTC 2022


Hi,


I agree with Jeff Shanab, even if you got this working (all frames as 
key-frames) it would be a bad solution encoding wise.


What you need to do is delay the input-selector switching until you got 
a key-frame (only switch on key frames).

I have done something similar (though with simple RTP/UDP, not rtspsrc) 
and can tell you it works fine.


There has been a similar entry on the mailing list about it about a week 
ago: "Can you find key frame in h264 video without decoding?"

But here is a snippet from my source code demonstrating the principle 
(note that I have used interpipesrc/sink instead of input-selector, but 
should be pretty similar):

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 04.06.2022 14.00, gstreamer-devel-request at lists.freedesktop.org wrote:
> err I frame set to 1 do you mean gop size 1, no difference frames? or do
> you mean once a second.
>
> All I frames will be only slightly better than JPEG on bandwidth and would
> make things worse.

-- 
Best regards / Med venlig hilsen
“Marianna Smidth Buschle”
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20220607/65940d36/attachment.htm>


More information about the gstreamer-devel mailing list