Forking a video stream with gstreamer

Viewed 31

BLUF: I'd like to fan out an RTSP video stream using gstreamer so multiple processes can use the gstreamer process as a source, and I'm having problems doing that with tcpserversink.

I have an IOT camera that serves the video over RTSP, so I can successfully capture video with e.g.

gst-launch-1.0 -e rtspsrc location=rtsp://camera:554/data \
    ! rtph264depay \
    ! h264parse \
    ! mp4mux \
    ! filesink location=/tmp/data.mp4

I'd like to be able to capture several videos simultaneously from the stream, with arbitrary start and stop times - for example, I might have a video that runs from 0-120, another from 40-80, another from 60-100. For reasons that are not clear, when I request too many simultaneous streams, the camera starts killing existing streams. My theory is that the camera's hardware can't handle multiple connections and is running into resource starvation issues. To get around this, I'd like my recording server to have a single process that is re-hosting the RTSP stream from the camera, and my asynchronous recorder processes can attach to that.

It would seem that the following would work for the server subprocess:

gst-launch-1.0 -e rtspsrc location=rtsp://camera:554/data \
    tcpserversink port=29000

and the following for the asynchronous recorder:

gst-launch-1.0 -e tcpclientsrc port=29000 \
    ! rtph264depay \
    ! h264parse \
    ! mp4mux \
    ! filesink location=/tmp/data.mp4

But it don't. The specific error I'm seeing on my client process is

ERROR: from element /GstPipeline:pipeline0/GstTCPClientSrc:tcpclientsrc0: Internal data stream error.

The documentation for tcpserversink seems to indicate that you can just attach any pipeline end there and you're fine. It seems this isn't the case. What am I missing?

0 Answers
Related