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
7.29k stars 525 forks source link

mse stream fails when password includes a ? #1227

Open lachlanmacphee opened 5 months ago

lachlanmacphee commented 5 months ago

Howdy all,

I am a Frigate user but figured this issue would be best filed here. While trying to setup my Dahua camera today, I was unable to get my mse / go2rtc stream working.

I received an error message along the following lines on the WebSocket which gave me some direction that it was to do with the URL and perhaps how it was being parsed:

Invalid port after host \FRIGATE_RTSP_PASSWORD_HERE\

Here was the URL I was using: rtsp://{FRIGATE_RTSP_USERNAME}:{FRIGATE_RTSP_PASSWORD}@10.0.0.197:554/cam/realmonitor?channel=1&subtype=0

I then looked to the go2rtc docs and found that the port was unnecessary, so it became: rtsp://{FRIGATE_RTSP_USERNAME}:{FRIGATE_RTSP_PASSWORD}@10.0.0.197/cam/realmonitor?channel=1&subtype=0

This still didn't work, so decided to look at my password and recalled it had a ? at the end of it, so perhaps when being parsed something was going wrong, with it thinking it was a query parameter...

After changing the password, everything started working fine in the Frigate UI: rtsp://{FRIGATE_RTSP_USERNAME}:{FRIGATE_RTSP_PASSWORD_WITHOUT_?}@10.0.0.197/cam/realmonitor?channel=1&subtype=0

Just wanted to share this here in case something's required to change on the go2rtc side or maybe just something added to the docs.

Cheers, Lachlan

ofcedwards commented 5 months ago

Special characters in the go2rtc password need to be html encoded. I'm not sure if it's in the docs, but I ran into the same issue some time ago. I don't think it's all special characters though. I use an exclamation point that doesn't need to be html encoded.

AlexxIT commented 5 months ago

This not in the docs, but there are some other similar issues.