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.46k stars 151 forks source link

FORCE_FPS doesn't appear to be working #1161

Closed jarrah31 closed 1 month ago

jarrah31 commented 2 months ago

Hello,

I have Wyze-bridge 2.8.1 running as a Docker container. It connects to the following three Wyze cams:

Wyze Cam v3 - v4.36.11.8391 Wyze Cam v3 Pro - v4.58.11.8391 Wyze Cam Pan v3 - v4.50.4.9222

In my Docker environment variables I have the following set:

    environment:
      # [REQUIRED] Fill the following two lines:
      - WYZE_EMAIL=$WYZE_EMAIL
      - WYZE_PASSWORD=$WYZE_PASSWORD
      - RTSP_PATHS_ALL_READUSER=$WYZE_RTSP_USER
      - RTSP_PATHS_ALL_READPASS=$WYZE_RTSP_PASS
      - FORCE_FPS_FRONTCAMTOP=10
      - FORCE_FPS_GARAGECAM=10
      - FORCE_FPS_KITCHENCAMPAN=10
      - TOTP_KEY=$WYZE_TOTP
      - NET_MODE=LAN
      - ENABLE_AUDIO_GARAGECAM=True
      - MQTT_HOST=${MQTT_HOST}
      - MQTT_AUTH=${MQTTAUTH}
      - MQTT_TOPIC=wyzebridge
      - MQTT_DTOPIC=homeassistant
      # - FRESH_DATA=true
      # - AUDIO_CODEC=AAC
      - WB_IP=${DOCKER_HOST_IP}
      - DEBUG_FFMPEG=true

I use the RTSP streams to feed into SecuritySpy which is reporting 20fps for all three cameras.

Looking at the docker logs, on startup it says the following:

[WyzeBridge] [CONTROL] Connecting to kitchencampan
[kitchencampan] Attempting to force fps=10
[kitchencampan] Requesting frame_size=0, bitrate=180, fps=10
[kitchencampan] πŸ“‘ Getting 180kb/s HD stream (H264/10fps) via LAN mode (WiFi: 56%) FW: 4.50.4.9222 πŸ”’
[kitchencampan] [CONTROL] Attempting to SET: rotary_degree=up
[kitchencampan] WARNING: Skipping wrong frame_size at start of stream [frame_size=1]
[WyzeBridge] βœ… '/kitchencampan stream is UP! (3/3)
[kitchencampan] [CONTROL] response=None
[WyzeBridge] [CONTROL] Disconnecting from kitchencampan
[WyzeBridge] ❌ '/kitchencampan' stream is down
[kitchencampan] Attempting to force fps=10
[kitchencampan] Requesting frame_size=0, bitrate=180, fps=10
[kitchencampan] πŸ“‘ Getting 180kb/s HD stream (H264/10fps) via LAN mode (WiFi: 48%) FW: 4.50.4.9222 πŸ”’
[kitchencampan] WARNING: Skipping wrong frame_size at start of stream [frame_size=1]
[kitchencampan] [video] super slow
[kitchencampan] WARNING: clear buffer
[WyzeBridge] βœ… '/kitchencampan stream is UP! (3/3)
[WyzeBridge] πŸ“– New client reading from kitchencampan
[WyzeBridge] πŸ“– New client reading from kitchencampan
[WyzeBridge] πŸ“• Client stopped reading from kitchencampan

[frontcamtop] Attempting to force fps=10
[frontcamtop] Requesting frame_size=3, bitrate=180, fps=10
[frontcamtop] πŸ“‘ Getting 180kb/s 2K stream (H264/10fps) via LAN mode (WiFi: 56%) FW: 4.58.11.8391 πŸ”’
[frontcamtop] WARNING: Skipping wrong frame_size at start of stream [frame_size=1]
[frontcamtop] [video] super slow
[frontcamtop] WARNING: clear buffer

[garagecam] Attempting to force fps=10
[garagecam] Requesting frame_size=0, bitrate=180, fps=10
[garagecam] πŸ“‘ Getting 180kb/s HD stream (H264/10fps) via LAN mode (WiFi: 63%) FW: 4.36.11.8391 πŸ”’
[garagecam] Re-encoding audio for compatibility with WebRTC in MTX
[garagecam] πŸ”Š Audio Enabled - ALAW > LIBOPUS/16,000Hz
[garagecam] WARNING: Skipping wrong frame_size at start of stream [frame_size=1]

As you can see here it tries for force 10fps, however when I look at the Wyze-Bridge web GUI and select the 'I' icon on each camera, it says fps = 20:

videoParm   { "bitRate": "30", "fps": "20", "horizontalFlip": "1", "logo": "2", "resolution": "2", "time": "1", "type": "H264", "verticalFlip": "1" }

This is also backed up in the SecuritySpy app:

Capto_Annotation

Trying other versions seems to work better:

v2.6.0 is close to 10fps

Capto_Capture 2024-04-25_07-36-09_PM

v2.7.0 does 20fps with one of the cams

Capto_Capture 2024-04-25_07-38-41_PM

The main reason for reporting this is because it helps reduce my wifi bandwidth, especially for the Pan Cam because that is further away from the router. (or does it? I guess the camera always sends 20fps and wyze bridge just re-encodes as 10fps?)

mrlt8 commented 2 months ago

hmm I'll have to look into this.

jarrah31 commented 2 months ago

Thank you, hopefully it’s not just me seeing this difference.

mrlt8 commented 1 month ago

Could you try the latest dev build to see if that helps?

I noticed that FPS was a little sticky on some cameras, and I needed to reboot the camera via the webUI for the FPS to updates sometimes.

jarrah31 commented 1 month ago

Thanks for the update, I should be able to try this on Monday when back home.

mrlt8 commented 1 month ago

@jarrah31 could you try the dev branch to see if that helps?

jarrah31 commented 1 month ago

Very sorry @mrlt8 it's been a busy week at work and I clean forgot to test the dev branch. I've now just installed 2.9.0 and can confirm FORCE_FPS now works great. Thank you very much!

jdeath commented 1 month ago

how set force_fps in home assistant mode (using latest dev container)? Tried FORCE_FPS_KITCHENCAMPAN: 10 and FORCE_FPS:10 under cam_options

neither seems to work (do not see it trying to request lower fps in log).

I am trying to reduce memory usage. High usage of the bridge appears to crash my system.

mrlt8 commented 1 month ago

hmm, I think we're missing the fps options for HA. will have to look into that!

edit: in the meantime, you should be able to use the api or MQTT to change the FPS manually.

jdeath commented 1 month ago

2.9.2 works great for fps in HA. Lowered my memory usage by using 5fps. Hopefully no more crashes.