rtsp and rtmp streams from gstreamer using raspivid

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

rtsp and rtmp streams from gstreamer using raspivid

mahendra0203
Hi,

   I am trying to stream rtsp and rtmp stream simultaneously on a raspberry pi using gst-rtsp-server and nginx-rtmp. The setup I am using is something like this. I need rtsp and hls streams from a single camera. So the below mentioned is the easiest way I could implement it.

raspivid -t 0 -h 720 -w 1080 -fps 15 -b 2000000 -ih -pf high -o - | tee >(/home/pi/rtsp/gst-rtsp-server/server-exec "( fdsrc typefind=true do-timestamp=true ! h264parse ! rtph264pay name=pay0 pt=96 )") >(gst-launch-1.0 fdsrc typefind=true do-timestamp=true ! h264parse ! flvmux ! rtmpsink location='rtmp://127.0.0.1:1935/myapp/live live=1')  >>  /dev/null

When either rtsp or rtmp pieplines are piped individually to raspivid it works fine.

 But when they are combined using tee, rtmp/hls stream works only if rtsp stream is active, some client should be receiving an rtsp stream, for rtmp/hls stream to work.  Rtsp stream doesn't have such an issue.

After checking the logs I could see that raspivid would send data to pipe only if rtsp stream is active.
 
I am sure there is some basic and obvious linux/gstreamer setting which I am missing here. But, I haven't figured it out yet. And help would be greatly appreciated.

Thanks,
Mahendra Naik
Reply | Threaded
Open this post in threaded view
|

Re: rtsp and rtmp streams from gstreamer using raspivid

mahendra0203
Hi,
   Still the issue persists, I can't run both rtmp and rtsp streams in a tee command.

 If I replace the rtsp-server command with a tcpserversink or udpsink. I can view both rtmp and gdp streams clearly. The issues occurs only while using gst-rtsp-server in a unix tee.

For now this works,

raspivid -t 0 -h 720 -w 1080 -fps 15 -b 2000000 -ih -pf high -o - | /home/pi/rtsp/gst-rtsp-server/server-exec "( fdsrc typefind=true do-timestamp=true ! h264parse ! rtph264pay name=pay0 pt=96 )"

The above command generates a rtsp stream , then a seperate gstreamer client transcodes this stream to rtmp , something like

gst-launch-1.0 rtspsrc location=rtsp://127.0.0.1:8554/video-testing- ! rtph264depay ! flvmux ! rtmpsink location='rtmp://127.0.0.1:8907/showvideo/live live=1'

This setup works fine , but it consumes lot more system resources.
Is there a better and efficient way to do RTSP and HLS stream  ? I could really use some inputs here.

Thanks and Regards,
Mahendra Naik