Fast switching between H264 streams with input-selector

Marc Leeman marc.leeman at gmail.com
Tue Jan 12 12:17:57 UTC 2021


This is something that I have been using for some time now (both for
streaming and for decoding). What you can do is the following:

1. You start from a steady state

uridecodebin uri=rtsp://..../1  ! input-selector !  videoconvert ! autovideosink

2. When you want to switch, you add a new uridecodebin to your
pipeline, connect the pad-added, and set the uri to the new RTSP uri

uridecodebin uri=rtsp://..../1 ! input-selector !  videoconvert ! autovideosink
uridecodebin uri=rtsp://..../2

3. When you get a new pad; attach it to the input selector; and swap
the active-pad
4 clean up the previous uridecodebin

You end up with
uridecodebin uri=rtsp://..../2 caps="video/x-h264" ! input-selector !
decodebin ! autovideosink

This will make certain that you only switch when there is a full
decoded frame and you should have no artifacts. The previous stream
will keep on playing until you do. If the 2nd camera is off-line; you
will keep on seeing the first one, unless you use a timeout.

On Tue, 12 Jan 2021 at 11:15, omer.tal <jacklawi at gmail.com> wrote:
>
> Hey guys,
>
> I'm using input-selector to toggle between several RTSP streams.
> Whenever I toggle between two streams, I have a small duration where there's
> no valid I-frame to use for decoding so I get garbage.
>
> I thought that I could use a queue before the input-selector to store the
> last second of each stream, so when I will toggle between them, the decoder
> will decode (as fast as possible) the last second (which will include an
> I-frame), and will then get me my current frame decoded properly.
>
> I'm not sure what parameters I should use to achieve this behavior.
>
> The pipeline I have:
>
>
>
> Thank you for your time and help :)
>
>
>
> --
> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



-- 
g. Marc


More information about the gstreamer-devel mailing list