Hi, I have a situation where I want to occasionally access video streams from an IP camera. Unfortunately, said camera has a very large interval between keyframes (minimum 25 s), so it takes a long while to load the image. I also cannot leave a decoder running all the time since that would use up too much CPU resources.
Is there some sort of plugin that takes an RTSP stream, caches everything from the latest keyframe onward (evicting the cache if a new one arrives) and offers that cached stream on the other end?
I realize that anyone consuming that cached stream would initially get a flood of frames, but I guess that would still be preferable to waiting half a minute for the initial keyframe.
This sounds like GOP buffer, though I must admit this is pretty new and I’m not familiar in how to correctly use it.
1 Like
That does look suspiciously like what I’m trying to do! While it does not seem to differentiate between keyframes and intermediate frames, it might be enough since I know the maximum keyframe interval of my camera. Thank you! 
Unfortunately, this does not seem to work with my RTSP stream though; If I launch a pipeline like this
GST_DEBUG=3 gst-launch-1.0 rtspsrc location=rtsp://192.168.0.236/substream ! rtph264depay ! gopbuffer ! udpsink
it ends with
0:00:02.156864923 175884 0xffff8c019920 WARN gopbuffer generic/gopbuffer/src/gopbuffer/imp.rs:589:gstgopbuffer::gopbuffer::imp::GopBuffer::sink_query:<gopbuffer0:video_sink> Serialized queries are currently not supported
0:00:02.158547781 175884 0xffff8c019920 ERROR gopbuffer generic/gopbuffer/src/gopbuffer/imp.rs:445:gstgopbuffer::gopbuffer::imp::GopBuffer::sink_chain:<gopbuffer0:video_sink> Require DTS for video streams
Add a h264timestamper
element after rtph264depay
.
1 Like
That does indeed fix that error, however I get no image from the pipeline anymore.
gst-launch-1.0 rtspsrc location=rtsp://192.168.0.236/substream ! rtph264depay ! h264timestamper ! gopbuffer ! h264parse ! avdec_h264 ! webrtcsink 'turn-servers=<"turn://…?transport=tcp">' 'ice-transport-policy=relay'
I also naively tried splitting the pipeline in two behind the gopbuffer (adding a udpsink there and starting the next pipeline with a udpsrc), but that does not yield any video either.