chriswiggins / rtsp-streaming-server

Lightweight RTSP/RTP streaming media server written in Javascript
GNU General Public License v3.0
106 stars 21 forks source link

Publishing using gstreamer rtspclientsink fails #31

Open RobotnickIsrael opened 2 years ago

RobotnickIsrael commented 2 years ago

If I publish using ffmpeg to the publish port, it works fine. If I publish using gstreamer rtspclientsink to the publish port, I get "503 service unavailable" on the publisher side. If I try to publish to the client port, it passes and later says "could not read from resource".

Did anyone succeed to publish using rtspclientsink?

RobotnickIsrael commented 2 years ago

It looks like gstreamer sends "RECORD" request and gets Could not write to resource"

chriswiggins commented 2 years ago

What is the log output you get if you set 'DEBUG=*' as the environment variable? I had never tried with gStreamer

RobotnickIsrael commented 2 years ago

My server publishing port is 8552, client port is 8554. (It's not possible to do both on the same port right? I think it's expecting the publisher and client to be on the same port)

My rtspclientsink is: gst-launch-1.0 videotestsrc ! x264enc ! rtspclientsink location=rtsp://10.0.238.155:8552/hello It's working if I use GstRtspServer, but not on rtsp-streaming-server.

FFMPEG cli line is working on rtsp-steraming-server: ../vix_resources/ffmpeg/ffmpeg -stream_loop -1 -re -fflags +genpts -i ../vix_resources/video-sample/test.mp4 -an -c:v copy -vsync 0 -enc_time_base -1 -start_at_zero -f tee -map 0:v [f=rtp]rtp://10.0.238.155:5004/|[f=mpegts]udp://10.0.238.155:5002/|[f=rtsp]rtsp://10.0.238.155:8552/testing|[f=mpegts]udp://239.10.30.70:30150/|[f=mpegts]udp://239.10.30.70:51000/

When I try rtspclientsink on rtsp-streaming-server I get these logs:

Sun, 13 Mar 2022 12:24:41 GMT rtsp-server new socket connection Sun, 13 Mar 2022 12:24:41 GMT rtsp-stream decoding chunk 'OPTIONS rtsp://10.0.238.155:8552/hello RTSP/1.0\r\n' + 'CSeq: 1\r\n' + 'User-Agent: GStreamer/1.16.2\r\n' + 'Date: Sun, 13 Mar 2022 12:25:01 GMT\r\n' + '\r\n' Sun, 13 Mar 2022 12:24:41 GMT rtsp-stream start of header Sun, 13 Mar 2022 12:24:41 GMT rtsp-stream end of header Sun, 13 Mar 2022 12:24:41 GMT rtsp-server OPTIONS rtsp://10.0.238.155:8552/hello { cseq: '1', 'user-agent': 'GStreamer/1.16.2', date: 'Sun, 13 Mar 2022 12:25:01 GMT' } 2022-03-13T12:24:41.033Z rtsp-streaming-server:PublishServer Options request from ::ffff:10.0.238.247 with headers { cseq: '1', 'user-agent': 'GStreamer/1.16.2', date: 'Sun, 13 Mar 2022 12:25:01 GMT' } Sun, 13 Mar 2022 12:24:41 GMT rtsp-stream start-line sent RTSP/1.0 200 OK Sun, 13 Mar 2022 12:24:41 GMT rtsp-stream headers sent { CSeq: '1', Date: 'Sun, 13 Mar 2022 12:24:41 GMT', OPTIONS: 'DESCRIBE SETUP ANNOUNCE RECORD' } Sun, 13 Mar 2022 12:24:41 GMT rtsp-stream decoding chunk 'ANNOUNCE rtsp://10.0.238.155:8552/hello RTSP/1.0\r\n' + 'CSeq: 2\r\n' + 'User-Agent: GStreamer/1.16.2\r\n' + 'Content-Type: application/sdp\r\n' + 'Date: Sun, 13 Mar 2022 12:25:01 GMT\r\n' + 'Content-Length: 396\r\n' + '\r\n' + 'v=0\r\n' + 'o=- 974304819 1 IN IP4 10.0.238.247\r\n' + 's=Session streamed with GStreamer\r\n' + 'i=rtspclientsink\r\n' + 't=0 0\r\n' + 'a=tool:GStreamer\r\n' + 'm=video 0 RTP/AVP 96\r\n' + 'c=IN IP4 0.0.0.0\r\n' + 'b=AS:2097\r\n' + 'a=rtpmap:96 H264/90000\r\n' + 'a=framerate:30\r\n' + 'a=fmtp:96 packetization-mode=1;profile-level-id=f4000d;sprop-parameter-sets=Z/QADZGbKCg/YC1BgEFQAAADABAAAAMDyPFCmWA=,aOvsRIA=\r\n' + 'a=control:stream=0\r\n' + 'a=ts-refclk:local\r\n' + 'a=mediaclk:sender\r\n' Sun, 13 Mar 2022 12:24:41 GMT rtsp-stream start of header Sun, 13 Mar 2022 12:24:41 GMT rtsp-stream end of header Sun, 13 Mar 2022 12:24:41 GMT rtsp-server ANNOUNCE rtsp://10.0.238.155:8552/hello { cseq: '2', 'user-agent': 'GStreamer/1.16.2', 'content-type': 'application/sdp', date: 'Sun, 13 Mar 2022 12:25:01 GMT', 'content-length': '396' } 2022-03-13T12:24:41.083Z rtsp-streaming-server:PublishServer ::ffff:10.0.238.247:58188 - Announce request with headers { cseq: '2', 'user-agent': 'GStreamer/1.16.2', 'content-type': 'application/sdp', date: 'Sun, 13 Mar 2022 12:25:01 GMT', 'content-length': '396' } Sun, 13 Mar 2022 12:24:41 GMT rtsp-stream decoding chunk 'v=0\r\n' + 'o=- 974304819 1 IN IP4 10.0.238.247\r\n' + 's=Session streamed with GStreamer\r\n' + 'i=rtspclientsink\r\n' + 't=0 0\r\n' + 'a=tool:GStreamer\r\n' + 'm=video 0 RTP/AVP 96\r\n' + 'c=IN IP4 0.0.0.0\r\n' + 'b=AS:2097\r\n' + 'a=rtpmap:96 H264/90000\r\n' + 'a=framerate:30\r\n' + 'a=fmtp:96 packetization-mode=1;profile-level-id=f4000d;sprop-parameter-sets=Z/QADZGbKCg/YC1BgEFQAAADABAAAAMDyPFCmWA=,aOvsRIA=\r\n' + 'a=control:stream=0\r\n' + 'a=ts-refclk:local\r\n' + 'a=mediaclk:sender\r\n' Sun, 13 Mar 2022 12:24:41 GMT rtsp-stream start of body Sun, 13 Mar 2022 12:24:41 GMT rtsp-stream end of body 2022-03-13T12:24:41.086Z rtsp-streaming-server:Mounts Adding mount with path rtsp://10.0.238.155:8552/hello and SDP 'v=0\r\n' + 'o=- 974304819 1 IN IP4 10.0.238.247\r\n' + 's=Session streamed with GStreamer\r\n' + 'i=rtspclientsink\r\n' + 't=0 0\r\n' + 'a=tool:GStreamer\r\n' + 'm=video 0 RTP/AVP 96\r\n' + 'c=IN IP4 0.0.0.0\r\n' + 'b=AS:2097\r\n' + 'a=rtpmap:96 H264/90000\r\n' + 'a=framerate:30\r\n' + 'a=fmtp:96 packetization-mode=1;profile-level-id=f4000d;sprop-parameter-sets=Z/QADZGbKCg/YC1BgEFQAAADABAAAAMDyPFCmWA=,aOvsRIA=\r\n' + 'a=control:stream=0\r\n' + 'a=ts-refclk:local\r\n' + 'a=mediaclk:sender\r\n' 2022-03-13T12:24:41.087Z rtsp-streaming-server:Mount Set up mount at path /hello 2022-03-13T12:24:41.087Z rtsp-streaming-server:PublishServer ::ffff:10.0.238.247:58188 - Set session to 3aa4cd1e-15be-47b4-9d70-3c4c96847e32 Sun, 13 Mar 2022 12:24:41 GMT rtsp-stream start-line sent RTSP/1.0 200 OK Sun, 13 Mar 2022 12:24:41 GMT rtsp-stream headers sent { CSeq: '2', Date: 'Sun, 13 Mar 2022 12:24:41 GMT', Session: '3aa4cd1e-15be-47b4-9d70-3c4c96847e32;timeout=30' } Sun, 13 Mar 2022 12:24:41 GMT rtsp-stream decoding chunk 'SETUP rtsp://10.0.238.155:8552/hello/stream=0 RTSP/1.0\r\n' + 'CSeq: 3\r\n' + 'User-Agent: GStreamer/1.16.2\r\n' + 'Transport: RTP/AVP/UDP;unicast;client_port=50062-50063;mode=RECORD\r\n' + 'Session: 3aa4cd1e-15be-47b4-9d70-3c4c96847e32\r\n' + 'Date: Sun, 13 Mar 2022 12:25:01 GMT\r\n' + '\r\n' Sun, 13 Mar 2022 12:24:41 GMT rtsp-stream start of header Sun, 13 Mar 2022 12:24:41 GMT rtsp-stream end of header Sun, 13 Mar 2022 12:24:41 GMT rtsp-server SETUP rtsp://10.0.238.155:8552/hello/stream=0 { cseq: '3', 'user-agent': 'GStreamer/1.16.2', transport: 'RTP/AVP/UDP;unicast;client_port=50062-50063;mode=RECORD', session: '3aa4cd1e-15be-47b4-9d70-3c4c96847e32', date: 'Sun, 13 Mar 2022 12:25:01 GMT' } 2022-03-13T12:24:41.093Z rtsp-streaming-server:PublishServer ::ffff:10.0.238.247:58188 - No mount with path rtsp://10.0.238.155:8552/hello/stream=0 exists Sun, 13 Mar 2022 12:24:41 GMT rtsp-stream start-line sent RTSP/1.0 404 Not Found Sun, 13 Mar 2022 12:24:41 GMT rtsp-stream headers sent { CSeq: '3', Date: 'Sun, 13 Mar 2022 12:24:41 GMT' } Sun, 13 Mar 2022 12:24:41 GMT rtsp-server socket connection ended Sun, 13 Mar 2022 12:24:41 GMT rtsp-server socket connection closed Sun, 13 Mar 2022 12:24:41 GMT rtsp-server new socket connection Sun, 13 Mar 2022 12:24:41 GMT rtsp-stream decoding chunk 'OPTIONS rtsp://10.0.238.155:8552/hello RTSP/1.0\r\n' + 'CSeq: 1\r\n' + 'User-Agent: GStreamer/1.16.2\r\n' + 'Date: Sun, 13 Mar 2022 12:25:01 GMT\r\n' + '\r\n' Sun, 13 Mar 2022 12:24:41 GMT rtsp-stream start of header Sun, 13 Mar 2022 12:24:41 GMT rtsp-stream end of header Sun, 13 Mar 2022 12:24:41 GMT rtsp-server OPTIONS rtsp://10.0.238.155:8552/hello { cseq: '1', 'user-agent': 'GStreamer/1.16.2', date: 'Sun, 13 Mar 2022 12:25:01 GMT' } 2022-03-13T12:24:41.100Z rtsp-streaming-server:PublishServer Options request from ::ffff:10.0.238.247 with headers { cseq: '1', 'user-agent': 'GStreamer/1.16.2', date: 'Sun, 13 Mar 2022 12:25:01 GMT' } Sun, 13 Mar 2022 12:24:41 GMT rtsp-stream start-line sent RTSP/1.0 200 OK Sun, 13 Mar 2022 12:24:41 GMT rtsp-stream headers sent { CSeq: '1', Date: 'Sun, 13 Mar 2022 12:24:41 GMT', OPTIONS: 'DESCRIBE SETUP ANNOUNCE RECORD' } Sun, 13 Mar 2022 12:24:41 GMT rtsp-server socket connection ended Sun, 13 Mar 2022 12:24:41 GMT rtsp-server socket connection closed