bluenviron / mediamtx

Ready-to-use SRT / WebRTC / RTSP / RTMP / LL-HLS media server and media proxy that allows to read, publish, proxy, record and playback video and audio streams.
MIT License
11.64k stars 1.47k forks source link

SRT Streaming Issues with GStreamer #3576

Open WooKyungHwa opened 1 month ago

WooKyungHwa commented 1 month ago

Which version are you using?

v1.8.4

Which operating system are you using?

Describe the issue

I want to receive and view the camera stream sent to the mediamtx server via RTMP using GStreamer with SRT. The readme only provides code related to RTSP for GStreamer, and I would like to know the command to pull the stream from the mediamtx server using SRT.

Describe how to replicate the issue

I am running the Linux binary for armv6 on Ubuntu 20.04 and using a Jetson Orin NX board. I am using GStreamer 1.16.3 for streaming.

The process of sending the camera stream to the mediamtx server via RTMP and then receiving and viewing it using GStreamer via RTSP works fine with the following steps:

  1. RTMP -> mediamtx gst-launch-1.0 -v -e v4l2src device=/dev/video0 ! 'video/x-raw, width=640, height=480, framerate=30/1, format=YUY2' ! nvvidconv ! 'video/x-raw(memory:NVMM), format=(string)NV12' ! nvv4l2h264enc bitrate=5000000 ! h264parse ! flvmux ! rtmpsink location='rtmp://localhost:1935/mystream live=1'

  2. mediamtx -> RTSP gst-launch-1.0 rtspsrc location=rtsp://:8554/mystream drop-on-latency=true use-pipeline-clock=true do-retransmission=false latency=0 ! rtph264depay ! avdec_h264 ! autovideosink sync=true

However, when I try to receive and view the stream using GStreamer via SRT, I keep encountering the following error: $ gst-launch-1.0 -v -e srtsrc uri="srt://:8890?streamid=read:mystream" ! queue ! h264parse ! avdec_h264 ! autovideosink Setting pipeline to PAUSED ... Pipeline is live and does not need PREROLL ... Setting pipeline to PLAYING ... New clock: GstSystemClock 11:05:37 AM.549573/SRT:RcvQ:workerE:SRT.c: processAsyncConnectRequest: REJECT reported from HS processing, not processing further. 11:05:37 AM.549614/SRT:RcvQ:workerE:SRT.c: RendezvousQueue: processAsyncConnectRequest FAILED. Setting TTL as EXPIRED. 11:05:37 AM.806282/SRT:RcvQ:workerE:SRT.c: processAsyncConnectRequest: REJECT reported from HS processing, not processing further. 11:05:37 AM.806352/SRT:RcvQ:workerE:SRT.c: RendezvousQueue: processAsyncConnectRequest FAILED. Setting TTL as EXPIRED. ^Chandling interrupt. Interrupt: Stopping pipeline ... EOS on shutdown enabled -- Forcing EOS on the pipeline Waiting for EOS... Got EOS from element "pipeline0". EOS received - stopping pipeline... Execution ended after 0:00:01.159024029 Setting pipeline to NULL ... Freeing pipeline ...

The stream is successfully received with VLC and ffmpeg, but not with GStreamer. Below are the successful VLC and ffmpeg commands, and I would like to know how to receive the stream with GStreamer.

Can you help me with the command to receive the stream using GStreamer?

Did you attach the server logs?

2024/07/25 16:03:38 INF MediaMTX v1.8.4 2024/07/25 16:03:38 INF configuration loaded from /home/k/Downloads/mediamtx_v1.8.4_linux_armv6/mediamtx.yml 2024/07/25 16:03:38 INF [RTSP] listener opened on :8554 (TCP), :8000 (UDP/RTP), :8001 (UDP/RTCP) 2024/07/25 16:03:38 INF [RTMP] listener opened on :1935 2024/07/25 16:03:38 INF [HLS] listener opened on :8888 2024/07/25 16:03:38 INF [WebRTC] listener opened on :8889 (HTTP), :8189 (ICE/UDP) 2024/07/25 16:03:38 INF [SRT] listener opened on :8890 (UDP) 2024/07/25 16:03:43 INF [RTMP] [conn 127.0.0.1:48590] opened 2024/07/25 16:03:43 INF [RTMP] [conn 127.0.0.1:48590] is publishing to path 'mystream', 1 track (H264)

Did you attach a network dump?

no

tetobondiola commented 3 weeks ago

I'm having the same issue but sending via SRT using gstreamer (srtclientsink or srtsink)

gst-launch-1.0 videotestsrc is-live=true ! videoconvert ! x264enc bitrate=500 ! h264parse ! mpegtsmux ! srtclientsink uri=srt://XXX.XXX.XXX.XXX:8890?streamid=publish:mystream

09:52:02.066637/SRT:RcvQ:workerE:SRT.c: processAsyncConnectRequest: REJECT reported from HS processing, not processing further. 09:52:02.066793/SRT:RcvQ:workerE:SRT.c: RendezvousQueue: processAsyncConnectRequest FAILED. Setting TTL as EXPIRED.

moschopsuk commented 2 weeks ago

The following gstreamer command works for me to send a stream into mediamtx using SRT and stream id.

gst-launch-1.0 videotestsrc ! video/x-raw, height=1080, width=1920 ! videoconvert ! x264enc tune=zerolatency ! video/x-h264, profile=baseline ! mpegtsmux ! srtsink uri='srt://10.0.20.3:8890' streamid='#!::m=publish,r=test'