Go2rtc USB Wecam - Works on VLC but not on HA


I’ve a machine in my network that is running go2rtc in order to create a stream from a USB webcam attached to that same machine.

Now with VLC I can access the video stream without any issues by using:

rtsp://user:[email protected]:8554/linux_usbcam

Now whenever I try to set it up as generic camera on HA (on another machine) it simply times out:

I tried to enable logging on the go2rtc and it seems to be streaming while HA is trying to configure the camera:

20:15:27.120 TRC [rtsp] server response:
RTSP/1.0 200 OK
Cseq: 4
Session: 59199486

frame=   61 fps= 17 q=-1.0 size=N/A time=00:00:03.56 bitrate=N/A speed=1.01x

But then it changes to:

20:15:37.386 DBG [rtsp] handle=read tcp> read: connection reset by peer
20:15:37.387 DBG [streams] stop producer url=ffmpeg:device?video=/dev/video4&input_format=h264&video_size=1920x1080
20:15:37.387 DBG [rtsp] disconnect stream=linux_usbcam
20:15:37.387 TRC [streams] stop reconnect url=ffmpeg:device?video=/dev/video4&input_format=h264&video_size=1920x1080
av_interleaved_write_frame(): Broken pipe
frame=  163 fps= 16 q=-1.0 Lsize=N/A time=00:00:10.36 bitrate=N/A speed=   1x
video:3993kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Conversion failed!
20:15:37.710 TRC [exec] close url="exec:ffmpeg -hide_banner -f v4l2 -input_format h264 -video_size 1920x1080 -i /dev/video4 -c copy -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp {output}"
20:15:47.390 TRC [rtsp] server request:
OPTIONS rtsp:// RTSP/1.0
Cseq: 1
User-Agent: Lavf60.3.100

Any ideias on why this might be happening? It seems like HA is just going away and ignoring the stream…

Thank you.

I just solved this by opening the stream on a browser while configuring HA at the same time. lol