Loop a video with gst-rtsp-server

Fabián Orccón cfoch.fabian at gmail.com
Mon Mar 30 03:03:33 UTC 2020


Hello,
Do a SEGMENT seek to 0.0 when you receive Gst.MessageType.SEGMENT_DONE.


\o

On Sun, Mar 29, 2020 at 9:45 PM Tyler Compton <xaviosx at gmail.com> wrote:

> Hi list,
>
> I've been trying to create an RTSP stream from a video file source and
> have the video loop back to the start when it ends. This has ended up being
> quite tricky and I suspect I'm missing something obvious. My pipeline looks
> something like this:
>
> filesrc location=video.mp4 ! parsebin ! rtph264pay name=pay0
>
> My current solution is to subclass RTSPMedia and override the
> do_handle_message method. I capture EOS messages and seek the pipeline back
> to the start. However, this doesn't seem to have any effect. The stream
> just ends like normal.
>
> class MyRTSPMedia(GstRtspServer.RTSPMedia):
>     def do_handle_message(self, message):
>         print("Got message:", message.type)
>         if message.type == Gst.MessageType.EOS:
>             pipeline: Gst.Pipeline = self.get_property("element")
>             seek_result = pipeline.seek(
>                 rate=1.0,
>                 format=Gst.Format.TIME,
>                 flags=Gst.SeekFlags.FLUSH,
>                 start_type=Gst.SeekType.SET,
>                 start=0,
>                 stop_type=Gst.SeekType.NONE,
>                 stop=-1)
>             if not seek_result:
>                 logging.error(
>                     f"Failed to seek stream back to start! Seek "
>                     f"returned {seek_result}")
>             return True
>         return GstRtspServer.RTSPMedia.do_handle_message(self, message)
>
> I provide this class to my RTSPMediaFactory with the set_media_gtype
> method.
>
> I noticed that gst-rtsp-server reports the video length to the client, so
> the client expects the stream to only last for as long as the original
> video. I would like the client to treat the source as a live, unending
> stream. Is it possible that this inaccurate runtime is the source of my
> problem?
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20200329/7e903233/attachment.htm>


More information about the gstreamer-devel mailing list