AlexxIT / go2rtc

Ultimate camera streaming application with support RTSP, RTMP, HTTP-FLV, WebRTC, MSE, HLS, MP4, MJPEG, HomeKit, FFmpeg, etc.
https://github.com/AlexxIT/Blog
MIT License
3.76k stars 304 forks source link

ERROR: unable to open RTSP for listening / Cannot assign requested address #1143

Open stbuerger opened 1 month ago

stbuerger commented 1 month ago

Trying to use a RTSP (h.265) camera (Steinel L620) stream in browser with go2rtc-1.9.2 I only get errors on address. The errors only appear when using a URL of type "ffmpeg:rtsp://MYIP:554/MYPATH" -- whereas "rtsp://MYIP:554/MYPATH" doesn't give errors - but Chrome&FF browser do not support h.265 with WebRTC an therefor I need to use ffmpeg for transcoding to h.264.

with go2rtc.yaml:

streams:
  L620HT: 
    - "ffmpeg:rtsp://192.168.1.63:554/user=admin&password=MYSECRET&channel=1&stream=0.sdp#video=h264#audio=opus"
log:
  level: info
  api: debug
  rtsp: debug
  streams: debug
  webrtc: debug
  exec: debug

running go2rtc and and just using web-ui/"probe" or access "stream" URL results in:

21:42:31.990 INF go2rtc platform=linux/amd64 revision=b2399f3 version=1.9.2 21:42:31.990 INF config path=/home/stefan/go2rtc/go2rtc.yaml 21:42:31.991 INF [rtsp] listen addr=:8554 21:42:31.991 INF [api] listen addr=:1984 21:42:31.991 INF [webrtc] listen addr=:8555/tcp 21:42:59.265 DBG [webrtc] new consumer src=L620HT 21:42:59.267 DBG [exec] run cmd="ffmpeg -hide_banner -v error -allowed_media_types video+audio -fflags nobuffer -flags low_delay -timeout 5000000 -user_agent go2rtc/ffmpeg -rtsp_flags prefer_tcp -i rtsp://192.168.1.63:554/user=admin&password=MYSECRET&channel=1&stream=0.sdp -c:v libx264 -g 50 -profile:v high -level:v 4.1 -preset:v superfast -tune:v zerolatency -pix_fmt:v yuv420p -c:a libopus -application:a lowdelay -min_comp 0 -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp rtsp://127.0.0.1:8554/802bfa2f1f149eaa99fddbcbc83395c8" url="exec:ffmpeg -hide_banner -v error -allowed_media_types video+audio -fflags nobuffer -flags low_delay -timeout 5000000 -user_agent go2rtc/ffmpeg -rtsp_flags prefer_tcp -i rtsp://192.168.1.63:554/user=admin&password=MYSECRET&channel=1&stream=0.sdp -c:v libx264 -g 50 -profile:v high -level:v 4.1 -preset:v superfast -tune:v zerolatency -pix_fmt:v yuv420p -c:a libopus -application:a lowdelay -min_comp 0 -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp rtsp://127.0.0.1:8554/802bfa2f1f149eaa99fddbcbc83395c8" [rtsp @ 0x5572ab117040] Unable to open RTSP for listening rtsp://192.168.1.63:554/user=admin&password=MYSECRET&channel=1&stream=0.sdp: Cannot assign requested address 21:42:59.352 DBG [webrtc] add consumer error="streams: exec: [rtsp @ 0x5572ab117040] Unable to open RTSP for listening\nrtsp://192.168.1.63:554/user=admin&password=MYSECRET&channel=1&stream=0.sdp: Cannot assign requested address\n"

Interesting other information: FFPLAY works OK as ..

ffplay -hide_banner -v error -allowed_media_types video+audio -fflags nobuffer -flags low_delay -timeout 5000000 -user_agent go2rtc/ffmpeg -rtsp_flags prefer_tcp -i "rtsp://192.168.1.63:554/user=admin&password=MYSECRET&channel=1&stream=0.sdp"

Any hints what I could be doing wrong here or how I can further debug this.

AlexxIT commented 1 month ago

FFmpeg 4 not supported

stbuerger commented 1 month ago

FFmpeg 4 not supported

Sorry - what does that mean - any suggestion for a work around ?

AlexxIT commented 1 month ago

Update ffmpeg version

stbuerger commented 1 month ago

OK - switched to docker and had success with Chrome, while FF (125.0.3) now - with MSE is OK - but with WEBRTC complains: webrtc/offer : unable to populate media section, RTPSender created with no codecs. LOG: 5/30/2024, 1:39:53 PM error undefined error=unable to populate media section, RTPSender created with no codecs caller=github.com/AlexxIT/go2rtc/internal/webrtc/webrtc.go:183 PROBE:

producers   
0   
type    "RTSP passive producer"
url "rtsp://127.0.0.1:8554/802bfa2f1f149eaa99fddbcbc83395c8"
remote_addr "127.0.0.1:33822"
user_agent  "ffmpeg/go2rtc"
sdp "v=0\r\no=- 0 0 IN IP4 127.0.0.1\r\ns=RTSP Session\r\nc=IN IP4 127.0.0.1\r\nt=0 0\r\na=tool:libavformat 60.16.100\r\nm=video 0 RTP/AVP 96\r\na=rtpmap:96 H264/90000\r\na=fmtp:96 packetization-mode=1; sprop-parameter-sets=Z2QAKay0A8ARPyzUBAQFAAADAAEAAAMADI8YMqA=,aO8Pyw==; profile-level-id=640029\r\na=control:streamid=0\r\nm=audio 0 RTP/AVP 97\r\nb=AS:64\r\na=rtpmap:97 opus/48000/2\r\na=control:streamid=1\r\n"
medias  
0   "video, recvonly, H.264 High 4.1"
1   "audio, recvonly, OPUS/48000/2"
receivers   
0   "96 H264, bytes=0, senders=1"
1   "97 OPUS/48000/2, bytes=0, senders=1"
consumers   
0   
type    "probe"
remote_addr "192.168.1.15:39916"
user_agent  "Mozilla/5.0 (X11; Linux x86_64; rv:125.0) Gecko/20100101 Firefox/125.0"
medias  
0   "video, sendonly, ALL"
1   "audio, sendonly, ALL"
2   "audio, recvonly, ANY"
senders 
0   "96 H264, bytes=0, receivers=1"
1   "97 OPUS/48000/2, bytes=0, receivers=1"