# Having a (RTSP) fallback source without decoding

**URL:** <https://discourse.gstreamer.org/t/having-a-rtsp-fallback-source-without-decoding/1664>\
**Category:** Application Development\
**Created:** [May 29, 2024, 6:55am UTC](https://discourse.gstreamer.org/t/having-a-rtsp-fallback-source-without-decoding/1664 "2024-05-29T06:55:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonasdn](https://discourse.gstreamer.org/user_avatar/discourse.gstreamer.org/jonasdn/32/96_2.png) [@jonasdn](https://discourse.gstreamer.org/u/jonasdn)\
**Post date:** [May 29, 2024, 6:55am UTC](https://discourse.gstreamer.org/t/having-a-rtsp-fallback-source-without-decoding/1664/1 "2024-05-29T06:55:05Z")

</div>

Hello hackers!

We have an application that receive audio and video via RTP then feeds that via `rtppassthroughpay` payloaders to the `gst-rtsp-server` library, using different fancy sub classes.

Sometime the RTP streams to the application can take a while to appear, and we want to be able to give out a link to our RTSP stream fairly quickly.

A dream scenario for us would be if we could have something (an image, a video loop or whatever) streaming on the RTSP server before we have incoming data to the application and then switch over when data arrives. Pretty much what the `gst-plugin-fallbackswitch` elements facilitate … but … we do not want to encode / decode H.26x in our application. It would become expensive for us and use too much CPU.

Is there anyway to either use RTSP tricks to have a stream dynamically appear and dissapear? Or to have fallback behavior using encoded data? If so what codec parameters need to match? Does this get too complicated to quickly?

Does my question make sense? Thank you for reading!

---

<div class="post-metadata">

**Author:** ![Honey\_Patouceul](https://discourse.gstreamer.org/user_avatar/discourse.gstreamer.org/honey_patouceul/32/365_2.png) [@Honey\_Patouceul](https://discourse.gstreamer.org/u/Honey_Patouceul)\
**Post date:** [May 29, 2024, 8:27pm UTC](https://discourse.gstreamer.org/t/having-a-rtsp-fallback-source-without-decoding/1664/2 "2024-05-29T20:27:31Z")

</div>

Not sure for your case, but you may try using `switchbin` element with a fallback case such as:

```auto
gst-launch-1.0 rtspsrc location=rtsp://your_rtsp_uri ! switchbin num-paths=3 \
 path0::caps="application/x-rtp,encoding-name=JPEG,clock-rate=90000,payload=26" path0::element="rtpjpegdepay ! jpegdec ! autovideoconvert"\
 path1::caps="application/x-rtp,encoding-name=H264,clock-rate=90000,payload=96" path1::element="rtph264depay ! h264parse ! openh264dec ! autovideoconvert"\
 path2::caps="ANY" path2::element="fakesink videotestsrc pattern=snow ! autovideoconvert" \ 
! autovideosink

```
