AlexxIT / WebRTC

Home Assistant custom component for real-time viewing of almost any camera stream using WebRTC and other technologies.
https://github.com/AlexxIT/Blog
MIT License
1.44k stars 169 forks source link

Green artifacts in image output #552

Open JohannCR opened 1 year ago

JohannCR commented 1 year ago

What could be the cause of some green artifacts in the image output ? Sometimes it's even an entire frame (or multiple) that are green... Is there some tweaking to do to reduce this ? Thanks

Screenshot_20230821-071646~2

AlexxIT commented 1 year ago

All of your cameras has problems simultaneously? How many you have cameras? How many with problems and without? Has cameras with problems same model?

JohannCR commented 1 year ago

I have 3 reolink RLC-510A and 1 shitty Keview PTZ cam which I don't know the model.

Curiously only the shitty one never has the problem lol The 3 Reolink ones show the green artifacts. Not always, only sometimes.

Mode is not configured in any of them. All show "MSE" while loading and then "RTC".

AlexxIT commented 1 year ago

Reolink. Thats the answer. Don't use RTSP and RTMP from Reolink cameras. They awful. Use HTTP-FLV links

http://192.168.1.123/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=admin&password=password

JohannCR commented 1 year ago

Oh awesome thanks ! Can't connect to the stream unfortunately... I've tried (replaced IP and logins of course) : http://192.168.x.x/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=admin&password=password http://192.168.x.x/flv?port=80&app=bcs&stream=channel0_main.bcs&user=admin&password=password https://192.168.x.x:443/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=admin&password=password

I've also tried to escape the '#' character in my password by %23, to no avail... Any idea ?

JohannCR commented 1 year ago

Also tried adding mode: flv it shows only the still image, even if no connection error Otherwise I keep getting a connect: no route to host error

AlexxIT commented 1 year ago

Try this link in the VLC. Check if you enable HTTP proto for your camera

JohannCR commented 1 year ago

Capture d’écran du 2023-08-24 15-15-27 Capture d’écran du 2023-08-24 15-14-59 Tried in VLC both ports 1935 and 80 with and without escaping the characters in the password. still no good :-/

AlexxIT commented 1 year ago

You can write to Reolink support. Also you can ask them for new firmware

JohannCR commented 1 year ago

Ok. I will update the issue if I get a fix. Thanks for your help !

JohannCR commented 1 year ago

Update: Reolink support sent me a firmware update that didn't change anything. But by looking further I found that the stream works in VLC using a password with no special character. Still doesn't work in HA though. In the card error message it says "tcp IP:80" connect no route to host". Does it try to use the port 80 instead of the 1935 one ? tried IP:1935 it didn't change anything, I get "tcp IP:1935" connect no route to host". I feel I'm getting close ! Any idea ?

AlexxIT commented 1 year ago

HTTP link should be with 80 port. 1935 port used by RTMP protocol. It also works badly.

JohannCR commented 1 year ago

Still not working with port=80

AlexxIT commented 1 year ago

Show link that works with VLC. Also try to change password without symbols.

JohannCR commented 1 year ago

So I've already changed the passwords to remove special characters and that's what made it work in VLC. Using the url listed above both port:80 and port:1935 work in VLC. But I may have an idea why it doesn't work in HA : the cameras are on a separate subnet... Both subnets are connected to my Synology Nas on which HAOS runs (2 different plugs), and Surveillance station has no problem accessing them, and DSM integration creates the camera entity that works (with the green artifacts). So I'm thinking of either:

I'll update the issue if I find a solution. Don't hesitate if you have any suggestion! Thx

JohannCR commented 1 year ago

So, found nothing in surveillance station to use flv stream. But I realized that HA cannot access the cameras subnet, so added it to the virtual machine. Now HA sees both subnets. The card throws a different error (that's progress !) : internal server error... Webrtc debug log says nothing though. How can I find out what's wrong ?

AlexxIT commented 1 year ago

Show screen with error

JohannCR commented 1 year ago

Screenshot_20230827-123822

AlexxIT commented 1 year ago

Check go2rtc WebUI. Try different links and technologies.

JohannCR commented 1 year ago

Problem solved ! Once the subnet access was fixed, I managed to get it working. port 80 definitely does not work, only 1935 does. http://192.168.x.x/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=user&password=password No more green artifacts ! The main stream quickly overloads the system though, and the stream freezes after less than a minute. So I only use the sub stream for now: http://192.168.x.x/flv?port=1935&app=bcs&stream=channel0_sub.bcs&user=user&password=password

I installed go2rtc in a docker container to free some resources. HA seems faster, but the main stream still freezes. I'll try allocating more cpu and see if that works. Thanks again for all the help !

JohannCR commented 1 year ago

Well even the sub stream freezes after some time... bummer. Is it because of the 1935 port ?

AlexxIT commented 1 year ago

HTTP-FLV source will be reworked in the next go2rtc version. Maybe this will helps. And you not using port 1935. You using port 80 (HTTP).

JohannCR commented 1 year ago

Great, we'll see if it makes a difference. Can I remove go2rtc from HA now that I use a docker container? Or disable it in the Webrtc custom component folder ?

AlexxIT commented 1 year ago

You can resetup WebRTC integration and set address of external go2rtc