go2rtc icon indicating copy to clipboard operation
go2rtc copied to clipboard

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

Open stbuerger opened this issue 1 year ago • 4 comments

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.

stbuerger avatar May 28 '24 21:05 stbuerger

FFmpeg 4 not supported

AlexxIT avatar May 29 '24 03:05 AlexxIT

FFmpeg 4 not supported

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

stbuerger avatar May 29 '24 06:05 stbuerger

Update ffmpeg version

AlexxIT avatar May 29 '24 08:05 AlexxIT

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"

stbuerger avatar May 30 '24 11:05 stbuerger

@stbuerger I also try to get the L620 streaming in go2rtc or frigate... I can open the SD stream in VLC and it plays. The HD stream only is a still image but audio plays.

In go2rtc and frigate I only get an error that the connection has a timeout.

Any good hints for this camera?

thesebastianf avatar Sep 21 '24 15:09 thesebastianf

Hints:

  • disable backchannel
  • set manual timeout
  • use ffmpeg source

AlexxIT avatar Sep 22 '24 03:09 AlexxIT

@thesebastianf

Any good hints for this camera?

Here is my current config which works "somehow" - i.e. I get

  • a lot of protocol error
  • crashes of ffmpeg process - but frigate recovers from this But overall it detects motion and I can connect other programs and browsers to the re-stream URL

As AlexxIT said: Use ffmpeg source

go2rtc:
  streams:
    L620HT:
    - ffmpeg:rtsp://myCamIP:554/user=admin&password=myPWD&channel=1&stream=0.sdp#video=h264
  webrtc:
    candidates:
      - myFrigateIP:8555
      - stun:8555

detectors:
  cpu1:
    type: cpu
    num_threads: 3

cameras:
  L620HT: # <------ Name the camera
    enabled: true
    ffmpeg:
      inputs:
      - path: rtsp://127.0.0.1:8554/L620HT
        input_args: preset-rtsp-restream

stbuerger avatar Sep 22 '24 13:09 stbuerger

I also have this running without ffmpeg with two Steinel:


   steinel_camera_Haustuer:
      - rtsp://Cam-Haustuer:554/user=MyAdmin&password=MyPasswd&channel=1&stream=0.sdp

HubertusH avatar Feb 19 '25 12:02 HubertusH