warren-bank / node-rtsp-relay

Node.js server to relay RTSP video stream from 'producer' to 'consumer' client endpoint.
GNU General Public License v2.0
4 stars 2 forks source link

503 Service Unavailable #2

Closed adminy closed 1 year ago

adminy commented 1 year ago
rtsp-relay --producer-port 5554 --client-port 8554 --log=4

then I tried connecting a producer:

# on the macbook:

ffmpeg -y -r 30 -f avfoundation -i "0" \
  -c:v libx264 -s 1280x720 -pix_fmt yuv420p \
  -c:a aac -b:a 128k -ar 44100 \
  -f rtsp -muxdelay 0.1 rtsp://0.0.0.0:5554/

# or on the pi
libcamera-vid -t 0 -o - | ffmpeg \
             -re -i - -hide_banner -y -loglevel error \
             -c:v copy  \
             -c:a aac -b:a 128k -ar 44100    \
             -max_muxing_queue_size 1024 \
             -f rtsp rtsp://0.0.0.0:5554/

# Logs

[rtsp @ 0x12c828400] method ANNOUNCE failed: 503 Service Unavailable
Could not write header for output file #0 (incorrect codec parameters ?): Server returned 5XX Server Error reply
Error initializing output stream 0:0 -- 

any parameter I am missing?

warren-bank commented 1 year ago
  1. change the format of input params for the relay from --a=b to --a 'b'
  2. ffmpeg -i '0'
    • is this a valid input stream?
    • update: these examples explain its meaning.. all good
      • though it might be worth trying -i '0:0' instead
warren-bank commented 1 year ago

oh.. and aren't you're specifying output format -f xxx twice?

warren-bank commented 1 year ago

sorry, I haven't looked at this in ages..

referring back to my original example.. I see that it uses the ffmpeg options:

  -c:a copy -c:v mpeg1video -q 15 -f rtsp -rtsp_transport udp -muxdelay 0.1 rtsp://127.0.0.1:5554/stream1
warren-bank commented 1 year ago

maybe try?

ffmpeg -f avfoundation -i '0:0' -c:a copy -c:v mpeg1video -r 30 -q 15 -f rtsp -rtsp_transport udp -muxdelay 0.1 rtsp://127.0.0.1:5554/stream1

just as an fyi, even though this tweak won't be relevent to you.. I'm currently on Windows

adminy commented 1 year ago

I've updated the command:

rtsp-relay --producer-port 5554 --client-port 8554 --log 4 &

libcamera-vid -t 0 -o - | ffmpeg \
          -re -i - -hide_banner -y -loglevel error \
          -c:v copy \
           -c:a aac -b:a 128k -ar 44100 \
           -max_muxing_queue_size 1024  \
            -f rtsp -rtsp_transport udp -muxdelay 0.1   \
          rtsp://127.0.0.1:5554/stream1

now the producer is fine, but when I invoke vlc as a client, I get the following error at the end when I connect:

  rtsp-relay:1:ProducerServer RTSP producer server is running on port: 5554 +0ms
  rtsp-relay:1:ConsumerServer RTSP consumer server is running on port: 8554 +4ms
  rtsp-server new socket connection +19s
  rtsp-stream decoding chunk 'OPTIONS rtsp://127.0.0.1:5554/stream1 RTSP/1.0\r\n' +
  'CSeq: 1\r\n' +
  'User-Agent: Lavf58.45.100\r\n' +
  '\r\n' +21ms
  rtsp-stream start of header +2ms
  rtsp-stream end of header +3ms
  rtsp-server OPTIONS rtsp://127.0.0.1:5554/stream1 { cseq: '1', 'user-agent': 'Lavf58.45.100' } +6ms
  rtsp-relay:2:ProducerServer Options request from ::ffff:127.0.0.1 with headers { cseq: '1', 'user-agent': 'Lavf58.45.100' } +12ms
  rtsp-stream start-line sent RTSP/1.0 200 OK +8ms
  rtsp-stream headers sent {
  CSeq: '1',
  Date: 'Sun, 04 Jun 2023 05:59:51 GMT',
  OPTIONS: 'DESCRIBE SETUP ANNOUNCE RECORD'
} +5ms
  rtsp-stream decoding chunk 'ANNOUNCE rtsp://127.0.0.1:5554/stream1 RTSP/1.0\r\n' +
  'Content-Type: application/sdp\r\n' +
  'CSeq: 2\r\n' +
  'User-Agent: Lavf58.45.100\r\n' +
  'Content-Length: 304\r\n' +
  '\r\n' +
  'v=0\r\n' +
  'o=- 0 0 IN IP4 127.0.0.1\r\n' +
  's=No Name\r\n' +
  'c=IN IP4 127.0.0.1\r\n' +
  't=0 0\r\n' +
  'a=tool:libavformat 58.45.100\r\n' +
  'm=video 0 RTP/AVP 96\r\n' +
  'a=rtpmap:96 H264/90000\r\n' +
  'a=fmtp:96 packetization-mode=1; sprop-parameter-sets=J2QAKKwrQFAe0IAAAAMAgAAAHnJQABMSwAAvrze9wDxImoA=,KO4fLAA=; profile-level-id=640028\r\n' +
  'a=control:streamid=0\r\n' +7ms
  rtsp-stream start of header +2ms
  rtsp-stream end of header +1ms
  rtsp-server ANNOUNCE rtsp://127.0.0.1:5554/stream1 {
  'content-type': 'application/sdp',
  cseq: '2',
  'user-agent': 'Lavf58.45.100',
  'content-length': '304'
} +3ms
  rtsp-relay:2:ProducerServer ::ffff:127.0.0.1:47884 - Announce request with headers { 'content-type': 'application/sdp', cseq: '2', 'user-agent': 'Lavf58.45.100', 'content-length': '304' } +3ms
  rtsp-stream decoding chunk 'v=0\r\n' +
  'o=- 0 0 IN IP4 127.0.0.1\r\n' +
  's=No Name\r\n' +
  'c=IN IP4 127.0.0.1\r\n' +
  't=0 0\r\n' +
  'a=tool:libavformat 58.45.100\r\n' +
  'm=video 0 RTP/AVP 96\r\n' +
  'a=rtpmap:96 H264/90000\r\n' +
  'a=fmtp:96 packetization-mode=1; sprop-parameter-sets=J2QAKKwrQFAe0IAAAAMAgAAAHnJQABMSwAAvrze9wDxImoA=,KO4fLAA=; profile-level-id=640028\r\n' +
  'a=control:streamid=0\r\n' +3ms
  rtsp-stream start of body +1ms
  rtsp-stream end of body +4ms
  rtsp-relay:2:Mounts Adding mount with path rtsp://127.0.0.1:5554/stream1 and SDP 'v=0\r\n' +
  rtsp-relay:2:Mounts   'o=- 0 0 IN IP4 127.0.0.1\r\n' +
  rtsp-relay:2:Mounts   's=No Name\r\n' +
  rtsp-relay:2:Mounts   'c=IN IP4 127.0.0.1\r\n' +
  rtsp-relay:2:Mounts   't=0 0\r\n' +
  rtsp-relay:2:Mounts   'a=tool:libavformat 58.45.100\r\n' +
  rtsp-relay:2:Mounts   'm=video 0 RTP/AVP 96\r\n' +
  rtsp-relay:2:Mounts   'a=rtpmap:96 H264/90000\r\n' +
  rtsp-relay:2:Mounts   'a=fmtp:96 packetization-mode=1; sprop-parameter-sets=J2QAKKwrQFAe0IAAAAMAgAAAHnJQABMSwAAvrze9wDxImoA=,KO4fLAA=; profile-level-id=640028\r\n' +
  rtsp-relay:2:Mounts   'a=control:streamid=0\r\n' +6ms
  rtsp-relay:1:Mount Set up mount at path /stream1 +2ms
  rtsp-relay:2:ProducerServer ::ffff:127.0.0.1:47884 - Set session to 1515452231212517523917257172143250250226152 +1ms
  rtsp-stream start-line sent RTSP/1.0 200 OK +1ms
  rtsp-stream headers sent {
  CSeq: '2',
  Date: 'Sun, 04 Jun 2023 05:59:51 GMT',
  Session: '1515452231212517523917257172143250250226152;timeout=30'
} +1ms
  rtsp-stream decoding chunk 'SETUP rtsp://127.0.0.1:5554/stream1/streamid=0 RTSP/1.0\r\n' +
  'Transport: RTP/AVP/UDP;unicast;client_port=22590-22591;mode=record\r\n' +
  'CSeq: 3\r\n' +
  'User-Agent: Lavf58.45.100\r\n' +
  'Session: 1515452231212517523917257172143250250226152\r\n' +
  '\r\n' +44ms
  rtsp-stream start of header +1ms
  rtsp-stream end of header +0ms
  rtsp-server SETUP rtsp://127.0.0.1:5554/stream1/streamid=0 {
  transport: 'RTP/AVP/UDP;unicast;client_port=22590-22591;mode=record',
  cseq: '3',
  'user-agent': 'Lavf58.45.100',
  session: '1515452231212517523917257172143250250226152'
} +1ms
  rtsp-relay:2:Mounts 4999 rtp ports remaining +3ms
  rtsp-relay:1:Mount Setting up stream 0 on path /stream1 +0ms
  rtsp-stream start-line sent RTSP/1.0 200 OK +1ms
  rtsp-stream headers sent {
  CSeq: '3',
  Date: 'Sun, 04 Jun 2023 05:59:51 GMT',
  Transport: 'RTP/AVP/UDP;unicast;client_port=22590-22591;mode=record;server_port=10000-10001'
} +1ms
  rtsp-stream decoding chunk 'RECORD rtsp://127.0.0.1:5554/stream1 RTSP/1.0\r\n' +
  'Range: npt=0.000-\r\n' +
  'CSeq: 4\r\n' +
  'User-Agent: Lavf58.45.100\r\n' +
  'Session: 1515452231212517523917257172143250250226152\r\n' +
  '\r\n' +40ms
  rtsp-stream start of header +1ms
  rtsp-stream end of header +0ms
  rtsp-server RECORD rtsp://127.0.0.1:5554/stream1 {
  range: 'npt=0.000-',
  cseq: '4',
  'user-agent': 'Lavf58.45.100',
  session: '1515452231212517523917257172143250250226152'
} +1ms
  rtsp-relay:2:RtpUdp Opened RTP listener for stream 0 on path /stream1 +9ms
  rtsp-relay:2:RtpUdp Opened RTCP listener for stream 0 on path /stream1 +2ms
  rtsp-stream start-line sent RTSP/1.0 200 OK +1ms
  rtsp-stream headers sent { CSeq: '4', Date: 'Sun, 04 Jun 2023 05:59:51 GMT' } +1ms
  rtsp-server new socket connection +21s
  rtsp-stream decoding chunk 'OPTIONS rtsp://192.168.1.103:8554/stream1 RTSP/1.0\r\n' +
  'CSeq: 2\r\n' +
  'User-Agent: LibVLC/3.0.19 (LIVE555 Streaming Media v2016.10.21)\r\n' +
  '\r\n' +9ms
  rtsp-stream start of header +1ms
  rtsp-stream end of header +0ms
  rtsp-server OPTIONS rtsp://192.168.1.103:8554/stream1 {
  cseq: '2',
  'user-agent': 'LibVLC/3.0.19 (LIVE555 Streaming Media v2016.10.21)'
} +2ms
  rtsp-relay:2:ConsumerServer ::ffff:192.168.1.102:55057 request: OPTIONS +1ms
  rtsp-stream start-line sent RTSP/1.0 200 OK +3ms
  rtsp-stream headers sent {
  CSeq: '2',
  Date: 'Sun, 04 Jun 2023 06:00:12 GMT',
  OPTIONS: 'DESCRIBE SETUP PLAY STOP'
} +4ms
  rtsp-stream decoding chunk 'DESCRIBE rtsp://192.168.1.103:8554/stream1 RTSP/1.0\r\n' +
  'CSeq: 3\r\n' +
  'User-Agent: LibVLC/3.0.19 (LIVE555 Streaming Media v2016.10.21)\r\n' +
  'Accept: application/sdp\r\n' +
  '\r\n' +9ms
  rtsp-stream start of header +0ms
  rtsp-stream end of header +0ms
  rtsp-server DESCRIBE rtsp://192.168.1.103:8554/stream1 {
  cseq: '3',
  'user-agent': 'LibVLC/3.0.19 (LIVE555 Streaming Media v2016.10.21)',
  accept: 'application/sdp'
} +3ms
  rtsp-relay:2:ConsumerServer ::ffff:192.168.1.102:55057 request: DESCRIBE +1ms
  rtsp-stream start-line sent RTSP/1.0 200 OK +6ms
  rtsp-stream headers sent {
  CSeq: '3',
  Date: 'Sun, 04 Jun 2023 06:00:12 GMT',
  'Content-Type': 'application/sdp',
  'Content-Length': 304
} +1ms
  rtsp-stream decoding chunk 'SETUP rtsp://192.168.1.103:8554/stream1/streamid=0 RTSP/1.0\r\n' +
  'CSeq: 4\r\n' +
  'User-Agent: LibVLC/3.0.19 (LIVE555 Streaming Media v2016.10.21)\r\n' +
  'Transport: RTP/AVP/TCP;unicast;interleaved=0-1\r\n' +
  '\r\n' +73ms
  rtsp-stream start of header +1ms
  rtsp-stream end of header +0ms
  rtsp-server SETUP rtsp://192.168.1.103:8554/stream1/streamid=0 {
  cseq: '4',
  'user-agent': 'LibVLC/3.0.19 (LIVE555 Streaming Media v2016.10.21)',
  transport: 'RTP/AVP/TCP;unicast;interleaved=0-1'
} +1ms
  rtsp-relay:2:ConsumerServer ::ffff:192.168.1.102:55057 request: SETUP +1ms
  rtsp-relay:2:ConsumerServer ::ffff:192.168.1.102:55057 - we dont support tcp, sending 504: 'rtsp://192.168.1.103:8554/stream1/streamid=0' +1ms
  rtsp-stream start-line sent RTSP/1.0 504 Gateway Time-out +1ms
  rtsp-stream headers sent { CSeq: '4', Date: 'Sun, 04 Jun 2023 06:00:12 GMT' } +1ms
  rtsp-server socket connection ended +20ms
  rtsp-server socket connection closed +9ms
  rtsp-server new socket connection +66ms
  rtsp-stream decoding chunk 'OPTIONS rtsp://192.168.1.103:8554/stream1 RTSP/1.0\r\n' +
  'CSeq: 2\r\n' +
  'User-Agent: LibVLC/3.0.19 (LIVE555 Streaming Media v2016.10.21)\r\n' +
  '\r\n' +6ms
  rtsp-stream start of header +2ms
  rtsp-stream end of header +0ms
  rtsp-server OPTIONS rtsp://192.168.1.103:8554/stream1 {
  cseq: '2',
  'user-agent': 'LibVLC/3.0.19 (LIVE555 Streaming Media v2016.10.21)'
} +3ms
  rtsp-relay:2:ConsumerServer ::ffff:192.168.1.102:55058 request: OPTIONS +3ms
  rtsp-stream start-line sent RTSP/1.0 200 OK +1ms
  rtsp-stream headers sent {
  CSeq: '2',
  Date: 'Sun, 04 Jun 2023 06:00:13 GMT',
  OPTIONS: 'DESCRIBE SETUP PLAY STOP'
} +1ms
  rtsp-stream decoding chunk 'DESCRIBE rtsp://192.168.1.103:8554/stream1 RTSP/1.0\r\n' +
  'CSeq: 3\r\n' +
  'User-Agent: LibVLC/3.0.19 (LIVE555 Streaming Media v2016.10.21)\r\n' +
  'Accept: application/sdp\r\n' +
  '\r\n' +85ms
  rtsp-stream start of header +0ms
  rtsp-stream end of header +0ms
  rtsp-server DESCRIBE rtsp://192.168.1.103:8554/stream1 {
  cseq: '3',
  'user-agent': 'LibVLC/3.0.19 (LIVE555 Streaming Media v2016.10.21)',
  accept: 'application/sdp'
} +1ms
  rtsp-relay:2:ConsumerServer ::ffff:192.168.1.102:55058 request: DESCRIBE +2ms
  rtsp-stream start-line sent RTSP/1.0 200 OK +3ms
  rtsp-stream headers sent {
  CSeq: '3',
  Date: 'Sun, 04 Jun 2023 06:00:13 GMT',
  'Content-Type': 'application/sdp',
  'Content-Length': 304
} +2ms
  rtsp-stream decoding chunk 'SETUP rtsp://192.168.1.103:8554/stream1/streamid=0 RTSP/1.0\r\n' +
  'CSeq: 4\r\n' +
  'User-Agent: LibVLC/3.0.19 (LIVE555 Streaming Media v2016.10.21)\r\n' +
  'Transport: RTP/AVP/TCP;unicast;interleaved=0-1\r\n' +
  '\r\n' +95ms
  rtsp-stream start of header +1ms
  rtsp-stream end of header +0ms
  rtsp-server SETUP rtsp://192.168.1.103:8554/stream1/streamid=0 {
  cseq: '4',
  'user-agent': 'LibVLC/3.0.19 (LIVE555 Streaming Media v2016.10.21)',
  transport: 'RTP/AVP/TCP;unicast;interleaved=0-1'
} +2ms
  rtsp-relay:2:ConsumerServer ::ffff:192.168.1.102:55058 request: SETUP +2ms
  rtsp-relay:2:ConsumerServer ::ffff:192.168.1.102:55058 - we dont support tcp, sending 504: 'rtsp://192.168.1.103:8554/stream1/streamid=0' +2ms
  rtsp-stream start-line sent RTSP/1.0 504 Gateway Time-out +1ms
  rtsp-stream headers sent { CSeq: '4', Date: 'Sun, 04 Jun 2023 06:00:13 GMT' } +1ms
  rtsp-server socket connection ended +307ms
  rtsp-server socket connection closed +3ms
  rtsp-server new socket connection +3ms
  rtsp-stream decoding chunk 'OPTIONS rtsp://192.168.1.103:8554/stream1 RTSP/1.0\r\n' +
  'CSeq: 2\r\n' +
  'User-Agent: LibVLC/3.0.19 (LIVE555 Streaming Media v2016.10.21)\r\n' +
  '\r\n' +4ms
  rtsp-stream start of header +1ms
  rtsp-stream end of header +0ms
  rtsp-server OPTIONS rtsp://192.168.1.103:8554/stream1 {
  cseq: '2',
  'user-agent': 'LibVLC/3.0.19 (LIVE555 Streaming Media v2016.10.21)'
} +2ms
  rtsp-relay:2:ConsumerServer ::ffff:192.168.1.102:55059 request: OPTIONS +4ms
  rtsp-stream start-line sent RTSP/1.0 200 OK +1ms
  rtsp-stream headers sent {
  CSeq: '2',
  Date: 'Sun, 04 Jun 2023 06:00:13 GMT',
  OPTIONS: 'DESCRIBE SETUP PLAY STOP'
} +1ms
  rtsp-stream decoding chunk 'DESCRIBE rtsp://192.168.1.103:8554/stream1 RTSP/1.0\r\n' +
  'CSeq: 3\r\n' +
  'User-Agent: LibVLC/3.0.19 (LIVE555 Streaming Media v2016.10.21)\r\n' +
  'Accept: application/sdp\r\n' +
  '\r\n' +6ms
  rtsp-stream start of header +1ms
  rtsp-stream end of header +0ms
  rtsp-server DESCRIBE rtsp://192.168.1.103:8554/stream1 {
  cseq: '3',
  'user-agent': 'LibVLC/3.0.19 (LIVE555 Streaming Media v2016.10.21)',
  accept: 'application/sdp'
} +2ms
  rtsp-relay:2:ConsumerServer ::ffff:192.168.1.102:55059 request: DESCRIBE +1ms
  rtsp-stream start-line sent RTSP/1.0 200 OK +3ms
  rtsp-stream headers sent {
  CSeq: '3',
  Date: 'Sun, 04 Jun 2023 06:00:13 GMT',
  'Content-Type': 'application/sdp',
  'Content-Length': 304
} +3ms
  rtsp-stream decoding chunk 'SETUP rtsp://192.168.1.103:8554/stream1/streamid=0 RTSP/1.0\r\n' +
  'CSeq: 4\r\n' +
  'User-Agent: LibVLC/3.0.19 (LIVE555 Streaming Media v2016.10.21)\r\n' +
  'Transport: RTP/AVP/TCP;unicast;interleaved=0-1\r\n' +
  '\r\n' +66ms
  rtsp-stream start of header +0ms
  rtsp-stream end of header +1ms
  rtsp-server SETUP rtsp://192.168.1.103:8554/stream1/streamid=0 {
  cseq: '4',
  'user-agent': 'LibVLC/3.0.19 (LIVE555 Streaming Media v2016.10.21)',
  transport: 'RTP/AVP/TCP;unicast;interleaved=0-1'
} +2ms
  rtsp-relay:2:ConsumerServer ::ffff:192.168.1.102:55059 request: SETUP +1ms
  rtsp-relay:2:ConsumerServer ::ffff:192.168.1.102:55059 - we dont support tcp, sending 504: 'rtsp://192.168.1.103:8554/stream1/streamid=0' +1ms
  rtsp-stream start-line sent RTSP/1.0 504 Gateway Time-out +1ms
  rtsp-stream headers sent { CSeq: '4', Date: 'Sun, 04 Jun 2023 06:00:13 GMT' } +1ms
  rtsp-server socket connection ended +93ms
  rtsp-server socket connection closed +2ms
  rtsp-server new socket connection +3ms
  rtsp-stream decoding chunk 'SETUP rtsp://192.168.1.103:8554/stream1 RTSP/1.0\r\n' +
  'CSeq: 0\r\n' +
  'Transport: RTP/AVP;unicast;client_port=9376-9377\r\n' +
  '\r\n' +2ms
  rtsp-stream start of header +0ms
  rtsp-stream end of header +0ms
  rtsp-server SETUP rtsp://192.168.1.103:8554/stream1 { cseq: '0', transport: 'RTP/AVP;unicast;client_port=9376-9377' } +3ms
  rtsp-relay:2:ConsumerServer ::ffff:192.168.1.102:55060 request: SETUP +1ms
  rtsp-relay:2:ClientWrapper 379768602381916710514016413727211161204243 - constructed +3ms
  rtsp-relay:2:Mounts 4998 rtp ports remaining +3ms
  rtsp-relay:2:ClientWrapper 379768602381916710514016413727211161204243 new client 1671191802041531866791128171227231184111203162 +0ms
  rtsp-relay:2:ConsumerServer Error setting up client TypeError: Cannot read properties of undefined (reading 'mount')
    at Client.setup (/usr/lib/node_modules/@warren-bank/rtsp-relay/lib/rtsp-streaming-server/lib/Client.js:76:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async ConsumerServer.setupRequest (/usr/lib/node_modules/@warren-bank/rtsp-relay/lib/rtsp-streaming-server/lib/ConsumerServer.js:136:7) +4ms
  rtsp-stream start-line sent RTSP/1.0 500 Internal Server Error +5ms
  rtsp-stream headers sent { CSeq: '0', Date: 'Sun, 04 Jun 2023 06:00:13 GMT' } +1ms
  rtsp-server socket connection ended +76ms
  rtsp-server socket connection closed +2ms
  rtsp-server new socket connection +3ms
  rtsp-stream decoding chunk 'SETUP rtsp://192.168.1.103:8554/stream1 RTSP/1.0\r\n' +
  'CSeq: 0\r\n' +
  'Transport: RTP/AVP;unicast;client_port=9356-9357\r\n' +
  '\r\n' +2ms
  rtsp-stream start of header +1ms
  rtsp-stream end of header +2ms
  rtsp-server SETUP rtsp://192.168.1.103:8554/stream1 { cseq: '0', transport: 'RTP/AVP;unicast;client_port=9356-9357' } +2ms
  rtsp-relay:2:ConsumerServer ::ffff:192.168.1.102:55061 request: SETUP +1ms
  rtsp-relay:2:ClientWrapper 552553913922529711041441212491581303423538 - constructed +2ms
  rtsp-relay:2:Mounts 4997 rtp ports remaining +2ms
  rtsp-relay:2:ClientWrapper 552553913922529711041441212491581303423538 new client 215159217174135837617017812220818935127245198 +0ms
  rtsp-relay:2:ConsumerServer Error setting up client TypeError: Cannot read properties of undefined (reading 'mount')
    at Client.setup (/usr/lib/node_modules/@warren-bank/rtsp-relay/lib/rtsp-streaming-server/lib/Client.js:76:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async ConsumerServer.setupRequest (/usr/lib/node_modules/@warren-bank/rtsp-relay/lib/rtsp-streaming-server/lib/ConsumerServer.js:136:7) +2ms
  rtsp-stream start-line sent RTSP/1.0 500 Internal Server Error +2ms
  rtsp-stream headers sent { CSeq: '0', Date: 'Sun, 04 Jun 2023 06:00:13 GMT' } +2ms
  rtsp-server socket connection ended +79ms
  rtsp-server socket connection closed +1ms
  rtsp-server new socket connection +5ms
  rtsp-stream decoding chunk 'SETUP rtsp://192.168.1.103:8554/stream1 RTSP/1.0\r\n' +
  'CSeq: 0\r\n' +
  'Transport: RTP/AVP;unicast;client_port=9334-9335\r\n' +
  '\r\n' +3ms
  rtsp-stream start of header +1ms
  rtsp-stream end of header +0ms
  rtsp-server SETUP rtsp://192.168.1.103:8554/stream1 { cseq: '0', transport: 'RTP/AVP;unicast;client_port=9334-9335' } +1ms
  rtsp-relay:2:ConsumerServer ::ffff:192.168.1.102:55062 request: SETUP +1ms
  rtsp-relay:2:ClientWrapper 19922590415106746217863200177150217168134 - constructed +3ms
  rtsp-relay:2:Mounts 4996 rtp ports remaining +2ms
  rtsp-relay:2:ClientWrapper 19922590415106746217863200177150217168134 new client 1691454079170117820715723871222001183026 +0ms
  rtsp-relay:2:ConsumerServer Error setting up client TypeError: Cannot read properties of undefined (reading 'mount')
    at Client.setup (/usr/lib/node_modules/@warren-bank/rtsp-relay/lib/rtsp-streaming-server/lib/Client.js:76:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async ConsumerServer.setupRequest (/usr/lib/node_modules/@warren-bank/rtsp-relay/lib/rtsp-streaming-server/lib/ConsumerServer.js:136:7) +3ms
  rtsp-stream start-line sent RTSP/1.0 500 Internal Server Error +1ms
  rtsp-stream headers sent { CSeq: '0', Date: 'Sun, 04 Jun 2023 06:00:13 GMT' } +1ms
  rtsp-server socket connection ended +7ms
  rtsp-server socket connection closed +2ms
warren-bank commented 1 year ago

I had no problem playing my webcam's video stream through the relay.. did you try changing from -c:v copy to -c:v mpeg1video?

And, to be super explicit.. your video client (ex: vlc) is connecting to the consumer port of your relay? ie: rtsp://192.168.1.103:8554/stream1

adminy commented 1 year ago

yep I did that, does it have to be mpeg1video?

I was wondering if h264 can be used.

adminy commented 1 year ago

never mind, it seems like ffplay works, vlc probably does something that makes it not work ...

adminy commented 1 year ago

  rtsp-stream decoding chunk 'OPTIONS rtsp://127.0.0.1:8554/stream1 RTSP/1.0\r\n' +
  'CSeq: 11\r\n' +
  'User-Agent: Lavf59.27.100\r\n' +
  'Session: 32901481207615670571881756641996240188\r\n' +
  '\r\n' +5s
  rtsp-stream start of header +1ms
  rtsp-stream end of header +0ms
  rtsp-server OPTIONS rtsp://127.0.0.1:8554/stream1 {
  cseq: '11',
  'user-agent': 'Lavf59.27.100',
  session: '32901481207615670571881756641996240188'
} +0ms
  rtsp-relay:2:ConsumerServer ::ffff:127.0.0.1:55420 request: OPTIONS +1ms
  rtsp-stream start-line sent RTSP/1.0 200 OK +1ms
  rtsp-stream headers sent {
  CSeq: '11',
  Date: 'Sun, 04 Jun 2023 07:00:59 GMT',
  OPTIONS: 'DESCRIBE SETUP PLAY STOP'
} +0ms
  rtsp-stream decoding chunk 'OPTIONS rtsp://127.0.0.1:8554/stream1 RTSP/1.0\r\n' +
  'CSeq: 11\r\n' +
  'User-Agent: Lavf59.27.100\r\n' +
  'Session: 2031682551603813979183145184872511381782\r\n' +
  '\r\n' +174ms
  rtsp-stream start of header +0ms
  rtsp-stream end of header +1ms
  rtsp-server OPTIONS rtsp://127.0.0.1:8554/stream1 {
  cseq: '11',
  'user-agent': 'Lavf59.27.100',
  session: '2031682551603813979183145184872511381782'
} +1ms
  rtsp-relay:2:ConsumerServer ::ffff:127.0.0.1:55436 request: OPTIONS +1ms
  rtsp-stream start-line sent RTSP/1.0 200 OK +1ms
  rtsp-stream headers sent {
  CSeq: '11',
  Date: 'Sun, 04 Jun 2023 07:00:59 GMT',
  OPTIONS: 'DESCRIBE SETUP PLAY STOP'
} +2ms
  rtsp-stream decoding chunk 'OPTIONS rtsp://127.0.0.1:8554/stream1 RTSP/1.0\r\n' +
  'CSeq: 11\r\n' +
  'User-Agent: Lavf59.27.100\r\n' +
  'Session: 109115606417412170141521559924525411010223\r\n' +
  '\r\n' +305ms
  rtsp-stream start of header +0ms
  rtsp-stream end of header +0ms
  rtsp-server OPTIONS rtsp://127.0.0.1:8554/stream1 {
  cseq: '11',
  'user-agent': 'Lavf59.27.100',
  session: '109115606417412170141521559924525411010223'
} +1ms
  rtsp-relay:2:ConsumerServer ::ffff:127.0.0.1:55438 request: OPTIONS +1ms
  rtsp-stream start-line sent RTSP/1.0 200 OK +1ms
  rtsp-stream headers sent {
  CSeq: '11',
  Date: 'Sun, 04 Jun 2023 07:00:59 GMT',
  OPTIONS: 'DESCRIBE SETUP PLAY STOP'
} +1ms

Is the stop command implemented?

warren-bank commented 1 year ago

Is the stop command implemented?

honestly, I wrote this so long ago.. I don't remember anything.. at all.. about its internals; I'd need to read the source to answer that.. same as anybody else.

adminy commented 1 year ago

Thanks anyways, my initial issue was solved. Have a lovely day.

warren-bank commented 1 year ago

here is the list of RTSP request methods that are implemented by the server that interacts with the consumers.

here is the list of RTSP request methods that are implemented by the server that interacts with the producers.

adminy commented 1 year ago

yep, seems to be missing stop. I can avoid rtsp entirely in my case if I refactor some code, so I'll go with that approach.

warren-bank commented 1 year ago

I'm no expert.. so I just referred to the spec:

"stop" isn't a documented method in either version.

most of the methods in both versions of the spec are implemented..

FWIW, the TEARDOWN method.. when sent by the client.. causes the consumer server to close its connection to the client.. which I assume is pretty equivalent to "stop".