mrlt8 / docker-wyze-bridge

WebRTC/RTSP/RTMP/LL-HLS bridge for Wyze cams in a docker container
GNU Affero General Public License v3.0
2.67k stars 170 forks source link

Streaming not working on latest build #952

Open alienjon opened 1 year ago

alienjon commented 1 year ago

I was using Wyze-Bridge successfully for 2 cameras for several months after an initial install. I recently added a third camera and, at the same time, tried updating wyze-bridge and have had nothing but headaches. The web-ui seems to be able to pull snapshots okay, but I can't get a live stream to work in the web-ui for the life of me. My ultimate goal is to connect to Home Assistant (which worked great before). It's not working with home assistant at all right now (I sometimes get "Unable to load valid image from still image URL (e.g. invalid host, URL or authentication failure). Review log for more info." errors, but not all the time, for the snapshot and for the streaming link I get "Timeout while loading URL").

As I can't get the camera videos to stream in the web-ui, though, I figured that's where I should focus my energy now and if I can get that working then to see if there's still issues with HA. I've kept wyze-bridge up to date (currently at v2.3.14). My docker-compose.yml looks like:

`version: '2.4' services: wyze-bridge: container_name: wyze-bridge restart: unless-stopped image: mrlt8/wyze-bridge:latest ports:

When I load with 'docker compose up', load the web-ui (adding the token, which appears to load correctly), I get snapshots from my 3 cameras. I tried playing the stream for upstairs-hallway and after a few moments this is the output (the video never steams, by the way):

[+] Running 1/0 βœ” Container wyze-bridge Created 0.0s Attaching to wyze-bridge wyze-bridge | wyze-bridge | πŸš€ DOCKER-WYZE-BRIDGE v2.3.14 wyze-bridge | wyze-bridge | * Serving Flask app 'frontend' wyze-bridge | * Debug mode: off wyze-bridge | [WyzeBridge] πŸ“š Using 'auth' from local cache... wyze-bridge | [WyzeBridge] πŸ“š Using 'user' from local cache... wyze-bridge | [WyzeBridge] WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. wyze-bridge | * Running on all addresses (0.0.0.0) wyze-bridge | * Running on http://127.0.0.1:5000 wyze-bridge | * Running on http://172.18.0.2:5000 wyze-bridge | [WyzeBridge] Press CTRL+C to quit wyze-bridge | [WyzeBridge] πŸ“š Using 'cameras' from local cache... wyze-bridge | [WyzeBridge] [+] Adding Upstairs Hallway [WYZE_CAKP2JFUS] wyze-bridge | [WyzeBridge] [+] Adding Front Entrance [WYZE_CAKP2JFUS] wyze-bridge | [WyzeBridge] [+] Adding Basement [WYZEC1-JZ] wyze-bridge | [WyzeBridge] starting MediaMTX 0.23.8 wyze-bridge | [WyzeBridge] 🎬 3 streams enabled wyze-bridge | [WyzeBridge] 192.168.1.149 - - [06/Aug/2023 18:10:01] "GET / HTTP/1.1" 200 - wyze-bridge | [WyzeBridge] 192.168.1.149 - - [06/Aug/2023 18:10:02] "GET /static/site.css HTTP/1.1" 304 - wyze-bridge | [WyzeBridge] 192.168.1.149 - - [06/Aug/2023 18:10:02] "GET /img/basement.jpg HTTP/1.1" 304 - wyze-bridge | [WyzeBridge] 192.168.1.149 - - [06/Aug/2023 18:10:02] "GET /img/front-entrance.jpg HTTP/1.1" 304 - wyze-bridge | [WyzeBridge] 192.168.1.149 - - [06/Aug/2023 18:10:02] "GET /img/upstairs-hallway.jpg HTTP/1.1" 304 - wyze-bridge | [WyzeBridge] 192.168.1.149 - - [06/Aug/2023 18:10:02] "GET /static/site.js HTTP/1.1" 304 - wyze-bridge | [WyzeBridge] 192.168.1.149 - - [06/Aug/2023 18:10:02] "GET /img/upstairs-hallway.jpg HTTP/1.1" 304 - wyze-bridge | [WyzeBridge] 192.168.1.149 - - [06/Aug/2023 18:10:02] "GET /img/basement.jpg HTTP/1.1" 304 - wyze-bridge | [WyzeBridge] 192.168.1.149 - - [06/Aug/2023 18:10:02] "GET /img/front-entrance.jpg HTTP/1.1" 304 - wyze-bridge | [WyzeBridge] 192.168.1.149 - - [06/Aug/2023 18:10:02] "GET /api/sse_status HTTP/1.1" 200 - wyze-bridge | [WyzeBridge] πŸŽ‰ Connecting to WyzeCam V3 - Upstairs Hallway on 192.168.1.49 wyze-bridge | [upstairs-hallway] πŸ“‘ Getting 180kb/s HD stream (H264/20fps) via LAN mode (WiFi: 84%) FW: 4.36.10.4054 πŸ”’ (DTLS) (2/3) wyze-bridge | [upstairs-hallway] WARNING: Skipping smaller frame at start of stream (frame_size=1) wyze-bridge | [upstairs-hallway] WARNING: frame too old wyze-bridge | [WyzeBridge] πŸŽ‰ Connecting to WyzeCam V3 - Front Entrance on 192.168.1.199 wyze-bridge | [WyzeBridge] πŸŽ‰ Connecting to WyzeCam V2 - Basement on 192.168.1.228 wyze-bridge | [WyzeBridge] βœ… '/upstairs-hallway stream is UP! (3/3) wyze-bridge | [basement] πŸ“‘ Getting 180kb/s HD stream (H264/15fps) via LAN mode (WiFi: 97%) FW: 4.28.4.49 (2/3) wyze-bridge | [basement] WARNING: frame too old wyze-bridge | [WyzeBridge] βœ… '/basement stream is UP! (3/3) wyze-bridge | [WyzeBridge] ⏰ Timed out connecting to Front Entrance. wyze-bridge | [WyzeBridge] 192.168.1.149 - - [06/Aug/2023 18:10:32] "GET /img/upstairs-hallway.jpg HTTP/1.1" 304 - wyze-bridge | [WyzeBridge] 192.168.1.149 - - [06/Aug/2023 18:10:32] "GET /img/front-entrance.jpg HTTP/1.1" 304 - wyze-bridge | [WyzeBridge] 192.168.1.149 - - [06/Aug/2023 18:10:32] "GET /img/basement.jpg HTTP/1.1" 304 - wyze-bridge | [WyzeBridge] πŸŽ‰ Connecting to WyzeCam V3 - Front Entrance on 192.168.1.199 wyze-bridge | [front-entrance] πŸ“‘ Getting 180kb/s HD stream (H264/20fps) via LAN mode (WiFi: 55%) FW: 4.36.10.4054 πŸ”’ (DTLS) (2/3) wyze-bridge | [front-entrance] WARNING: Skipping smaller frame at start of stream (frame_size=1) wyze-bridge | [front-entrance] WARNING: frame too old wyze-bridge | [WyzeBridge] βœ… '/front-entrance stream is UP! (3/3) wyze-bridge | [WyzeBridge] 192.168.1.149 - - [06/Aug/2023 18:11:03] "GET /img/basement.jpg HTTP/1.1" 304 - wyze-bridge | [WyzeBridge] 192.168.1.149 - - [06/Aug/2023 18:11:03] "GET /img/front-entrance.jpg HTTP/1.1" 304 - wyze-bridge | [WyzeBridge] 192.168.1.149 - - [06/Aug/2023 18:11:03] "GET /img/upstairs-hallway.jpg HTTP/1.1" 304 -

In the web-up, some text over the overlay displays (after a few moments) "The media could not be loaded, either because the server or network failed or because the format is not supported."

mrlt8 commented 1 year ago

"The media could not be loaded, either because the server or network failed or because the format is not supported."

That seems like videojs/HLS issue. The logs seem to indicate that it's able to connect to the cameras. Can you try the rtsp stream?

You may also want to try enabling webrtc to see if that works better than the HLS stream.

Setting ON_DEMAND=False may also help in your situation.

alienjon commented 1 year ago

Can you try the rtsp stream? You mean to select 'RTSP' in the Steam option for a particular camera, right? When I do that I get a red error bar at the top saying that I lost connection to the bridge. Right clicking to open the link in a new window gives me a browser error that it can't understand the protocol:

`The address wasn’t understood

Firefox doesn’t know how to open this address, because one of the following protocols (rtsp) isn’t associated with any program or is not allowed in this context.`

Webrtc, however, seems to work just fine, so maybe it's just RTSP as the issue? Can I stream directly to home assistant with webrtc? I tried replacing it as the URL in the generic camera and I get a timeout error.

mrlt8 commented 1 year ago

Most browsers don't support RTSP, so you'd need to use something like VLC.

HA should be able to stream directly from RTSP.

alienjon commented 1 year ago

I was getting a timeout error when configuring in HA with RTSP. I installed the webrtc add-on, though and with that custom lovelace card I can stream via rtsp. The card code is this:

type: custom:webrtc-camera url: rtsp://192.168.1.4:8554/front-entrance

When that rtsp link is used in generic camera, though, it doesn't seem to want to connect:

Still Image: http://192.168.1.4:5000/snapshot/front-entrance.jpg I get: Unable to load valid image from still image URL (e.g. invalid host, URL or authentication failure). Review log for more info.

Stream Source: rtsp://192.168.1.4:8554/front-entrance Timeout while loading URL

mrlt8 commented 1 year ago

hmm not sure about that. Does the the still image url work directly?

Does the loopback address work in the HA card? http://0.0.0.0:5000/snapshot/front-entrance.jpg or rtsp://0.0.0.0:8554/front-entrance

alienjon commented 1 year ago

http://192.168.1.4:5000/snapshot/front-entrance.jpg seems to pull the snapshot okay directly (ie: when I use it in the URL bar in my browser it loads the picture).

In HA, though, I use the 'http://192.168.1.4:5000/snapshot/front-entrance.jpg' URL for the snapshot and I get the following error: Unable to load valid image from still image URL (e.g. invalid host, URL or authentication failure). Review log for more info.

The stream still gets a time out error with the 'rtsp://0.0.0.0:8554/front-entrance'.

I'm not sure where to check in the log for this. The HA log doesn't seem to show recent integration additions, just actions within HA (maybe the logfiles, not the internal HA stuff?)