rgaufman / live555

A mirror of the live555 source code.
GNU Lesser General Public License v3.0
759 stars 368 forks source link

openRTSP -- no output #53

Open iconoclasthero opened 2 months ago

iconoclasthero commented 2 months ago

Stream's coming from mediamtx server.
(but I'm not ruling out something on the server side): mpv rtsp://fqdn:8554/mpd/mpd.opus mpv can play the stream to [pipewire-]pulse (presumably, as it shows up in pavucontrol)

$ openRTSP rtsp://fwdn:8554/mpd/mpd.opus
Created new TCP socket 3 for connection
Connecting to 8.8.8.8, port 8554 on socket 3...
...remote connection opened
Sending request: OPTIONS rtsp://fwdn:8554/mpd/mpd.opus RTSP/1.0
CSeq: 2
User-Agent: openRTSP (LIVE555 Streaming Media v2023.06.14)

Received 128 new bytes of response data.
Received a complete OPTIONS response:
RTSP/1.0 200 OK
CSeq: 2
Public: DESCRIBE, ANNOUNCE, SETUP, PLAY, RECORD, PAUSE, GET_PARAMETER, TEARDOWN
Server: gortsplib

Sending request: DESCRIBE rtsp://fwdn:8554/mpd/mpd.opus RTSP/1.0
CSeq: 3
User-Agent: openRTSP (LIVE555 Streaming Media v2023.06.14)
Accept: application/sdp

Received 377 new bytes of response data.
Received a complete DESCRIBE response:
RTSP/1.0 200 OK
CSeq: 3
Content-Base: rtsp://fwdn:8554/mpd/mpd.opus/
Content-Length: 212
Content-Type: application/sdp
Server: gortsplib

v=0
o=- 0 0 IN IP4 127.0.0.1
s=No Name
c=IN IP4 0.0.0.0
t=0 0
m=audio 0 RTP/AVP 96
a=control:rtsp://fwdn:8554/mpd/mpd.opus/trackID=0
a=rtpmap:96 opus/48000/2
a=fmtp:96 sprop-stereo=1

Opened URL "rtsp://fwdn:8554/mpd/mpd.opus", returning a SDP description:
v=0
o=- 0 0 IN IP4 127.0.0.1
s=No Name
c=IN IP4 0.0.0.0
t=0 0
m=audio 0 RTP/AVP 96
a=control:rtsp://fwdn:8554/mpd/mpd.opus/trackID=0
a=rtpmap:96 opus/48000/2
a=fmtp:96 sprop-stereo=1

Created receiver for "audio/OPUS" subsession (client ports 49842-49843)
Sending request: SETUP rtsp://fwdn:8554/mpd/mpd.opus/trackID=0 RTSP/1.0
CSeq: 4
User-Agent: openRTSP (LIVE555 Streaming Media v2023.06.14)
Transport: RTP/AVP;unicast;client_port=49842-49843

Received 189 new bytes of response data.
Received a complete SETUP response:
RTSP/1.0 200 OK
CSeq: 4
Server: gortsplib
Session: 16cc362a875947b7a6f7631f036e133f;timeout=60
Transport: RTP/AVP;unicast;client_port=49842-49843;server_port=8000-8001;ssrc=7F83F717

Setup "audio/OPUS" subsession (client ports 49842-49843)
Created output file: "audio-OPUS-1"
Sending request: PLAY rtsp://fwdn:8554/mpd/mpd.opus/ RTSP/1.0
CSeq: 5
User-Agent: openRTSP (LIVE555 Streaming Media v2023.06.14)
Session: 16cc362a875947b7a6f7631f036e133f
Range: npt=0.000-

Received 205 new bytes of response data.
Received a complete PLAY response:
RTSP/1.0 200 OK
CSeq: 5
RTP-Info: url=rtsp://fwdn:8554/mpd/mpd.opus/trackID=0;seq=32196;rtptime=2065390539
Server: gortsplib
Session: 16cc362a875947b7a6f7631f036e133f;timeout=60

Started playing session
Receiving streamed data (signal with "kill -HUP 50814" or "kill -USR1 50814" to terminate)...
^C

$ openRTSP -r -p 8554 rtsp://fwdn:8554/mpd/mpd.opus
Created new TCP socket 3 for connection
Connecting to 8.8.8.8, port 8554 on socket 3...
...remote connection opened
Sending request: OPTIONS rtsp://fwdn:8554/mpd/mpd.opus RTSP/1.0
CSeq: 2
User-Agent: openRTSP (LIVE555 Streaming Media v2023.06.14)

Received 128 new bytes of response data.
Received a complete OPTIONS response:
RTSP/1.0 200 OK
CSeq: 2
Public: DESCRIBE, ANNOUNCE, SETUP, PLAY, RECORD, PAUSE, GET_PARAMETER, TEARDOWN
Server: gortsplib

Sending request: DESCRIBE rtsp://fwdn:8554/mpd/mpd.opus RTSP/1.0
CSeq: 3
User-Agent: openRTSP (LIVE555 Streaming Media v2023.06.14)
Accept: application/sdp

Received 377 new bytes of response data.
Received a complete DESCRIBE response:
RTSP/1.0 200 OK
CSeq: 3
Content-Base: rtsp://fwdn:8554/mpd/mpd.opus/
Content-Length: 212
Content-Type: application/sdp
Server: gortsplib

v=0
o=- 0 0 IN IP4 127.0.0.1
s=No Name
c=IN IP4 0.0.0.0
t=0 0
m=audio 0 RTP/AVP 96
a=control:rtsp://fwdn:8554/mpd/mpd.opus/trackID=0
a=rtpmap:96 opus/48000/2
a=fmtp:96 sprop-stereo=1

Opened URL "rtsp://fwdn:8554/mpd/mpd.opus", returning a SDP description:
v=0
o=- 0 0 IN IP4 127.0.0.1
s=No Name
c=IN IP4 0.0.0.0
t=0 0
m=audio 0 RTP/AVP 96
a=control:rtsp://fwdn:8554/mpd/mpd.opus/trackID=0
a=rtpmap:96 opus/48000/2
a=fmtp:96 sprop-stereo=1

Sending request: SETUP rtsp://fwdn:8554/mpd/mpd.opus/trackID=0 RTSP/1.0
CSeq: 4
User-Agent: openRTSP (LIVE555 Streaming Media v2023.06.14)
Transport: RTP/AVP;unicast;client_port=8554-8555

Received 187 new bytes of response data.
Received a complete SETUP response:
RTSP/1.0 200 OK
CSeq: 4
Server: gortsplib
Session: 514182e8c8e249d9b1b5dad009a160e3;timeout=60
Transport: RTP/AVP;unicast;client_port=8554-8555;server_port=8000-8001;ssrc=7F83F717

Setup "audio/OPUS" subsession (client ports 8554-8555)
Sending request: PLAY rtsp://fwdn:8554/mpd/mpd.opus/ RTSP/1.0
CSeq: 5
User-Agent: openRTSP (LIVE555 Streaming Media v2023.06.14)
Session: 514182e8c8e249d9b1b5dad009a160e3
Range: npt=0.000-

Received 205 new bytes of response data.
Received a complete PLAY response:
RTSP/1.0 200 OK
CSeq: 5
RTP-Info: url=rtsp://fwdn:8554/mpd/mpd.opus/trackID=0;seq=32926;rtptime=2066087617
Server: gortsplib
Session: 514182e8c8e249d9b1b5dad009a160e3;timeout=60

Started playing session
Data is being streamed (signal with "kill -HUP 50817" or "kill -USR1 50817" to terminate)...
^C

Seemed to compile fine after installing libssl-dev on Rhino Linux 2024.1/Ubuntu devel/noble.

iconoclasthero commented 2 months ago

mpd sends the stream to mediamtx with this audio output:

audio_output {
     name            "pipe to ffmpeg - suffix"
     type            "pipe"
     enabled         "no"
     format          "48000:16:2"
     command         "ffmpeg -loglevel error -hide_banner -y -f s16le -ar 48000 -ac 2 -vn -i - -c libopus -b:a 64k
-f rtsp rtsp://localhost:8554/mpd/mpd.opus"
}

MediaMTX RTSP config; only 8554 is open to the server so perhaps it's that?

###############################################
# Global settings -> RTSP server

# Enable publishing and reading streams with the RTSP protocol.
rtsp: yes
# List of enabled RTSP transport protocols.
# UDP is the most performant, but doesn't work when there's a NAT/firewall between
# server and clients, and doesn't support encryption.
# UDP-multicast allows to save bandwidth when clients are all in the same LAN.
# TCP is the most versatile, and does support encryption.
# The handshake is always performed with TCP.
protocols: [udp, multicast, tcp]
# Encrypt handshakes and TCP streams with TLS (RTSPS).
# Available values are "no", "strict", "optional".
encryption: "no"
# Address of the TCP/RTSP listener. This is needed only when encryption is "no" or "optional".
rtspAddress: :8554
# Address of the TCP/TLS/RTSPS listener. This is needed only when encryption is "strict" or "optional".
rtspsAddress: :8322
# Address of the UDP/RTP listener. This is needed only when "udp" is in protocols.
rtpAddress: :8000
# Address of the UDP/RTCP listener. This is needed only when "udp" is in protocols.
rtcpAddress: :8001
# IP range of all UDP-multicast listeners. This is needed only when "multicast" is in protocols.
multicastIPRange: 224.1.0.0/16
# Port of all UDP-multicast/RTP listeners. This is needed only when "multicast" is in protocols.
multicastRTPPort: 8002
# Port of all UDP-multicast/RTCP listeners. This is needed only when "multicast" is in protocols.
multicastRTCPPort: 8003
# Path to the server key. This is needed only when encryption is "strict" or "optional".
# This can be generated with:
# openssl genrsa -out server.key 2048
# openssl req -new -x509 -sha256 -key server.key -out server.crt -days 3650
serverKey: server.key
# Path to the server certificate. This is needed only when encryption is "strict" or "optional".
serverCert: server.crt
# Authentication methods. Available are "basic" and "digest".
# "digest" doesn't provide any additional security and is available for compatibility only.
rtspAuthMethods: [basic]