docker-wyze-bridge
docker-wyze-bridge copied to clipboard
Audio delay
So to start as a question, would 20-30 second audio delay be considered acceptable delay or is the expectation real time? I have 4 cameras, 2x v2, 1x cam pan v1, 1x outdoor v1 and they all have around the same time delay. I can confirm two playback outputs tinycam pro for live monitoring in the kitchen as well I have the feeds all being sent to blue iris for video history / playback. Same delay exists on from both output feeds when watching live, looks to be RTSP not syncing the audio and video.
Not the end of the world but two of them are being used as baby cams so I would of course rather they were real time. Thoughts?
What would you need to diagnose, bridge logs don't seem to show any issue. Maybe I have a setting wrong in the config?
Just to confirm, is the delay 20-30s behind real-time or behind the official app/tinycam?
I believe there is an option in the TUTK avclient to request that the data be synchronized, but it ended up causing the video frames to be dropped when I was playing around with it.
I'll have to look into this again and see what they're doing in the official app.
The video seems to be real time it's just the audio is delayed. So I'll see one of the kids make a noise and then I'll hear it later.
I can also hear them upstairs if they're really loud (real time of course) and then I get the 'echo' downstairs on tinycam after.
On Mon., May 23, 2022, 12:00 p.m. mrlt8, @.***> wrote:
Just to confirm, is the delay 20-30s behind real-time or behind the official app/tinycam?
I believe there is an option in the TUTK avclient to request that the data be synchronized, but it ended up causing the video frames to be dropped when I was playing around with it.
I'll have to look into this again and see what they're doing in the official app.
— Reply to this email directly, view it on GitHub https://github.com/mrlt8/docker-wyze-bridge/issues/388#issuecomment-1134858731, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWLQ5B7DU2AUUG2XWAARMCTVLOTS5ANCNFSM5WWIFMCQ . You are receiving this because you authored the thread.Message ID: @.***>
Any luck turning the data sync back on? I'm seeing considerable delays now on my wyze v3 that I just added. It's delayed about 2-3 minutes now.
Does the delay increase over time or is it a constant delay?
Can you post the audio codec for the cam with the 3-min delay? I believe they keep switching the audio codecs around with some of the firmware updates.
It might be increasing, I'm not exactly sure but I could try to time it?
Log is here, looks like it's using alaw: 2022/07/10 21:04:35 [WyzeBridge] 🎉 Connecting to WyzeCam V3 - on (1/3) 2022/07/10 21:04:38 [] 📡 Getting 120kb/s HD stream (20fps) via LAN mode (WiFi: 57%) FW: 🔒 (DTLS) (2/3) 2022/07/10 21:04:38 [] 🔊 Audio Enabled - ALAW/16,000Hz 2022/07/10 21:04:38 [] WARNING: Skipping smaller frame at start of stream (frame_size=1)
@mjb83 Is the audio distorted in any way compared to the stock app?
Actually... having checked the actual app the sound is kind of garbled... Maybe there is something wrong with the camera?
Strange though as I had a cam pan in there previously that I retired and replaced with the V3. Maybe I need to roll back firmware or something..
Can also confirm I get serious audio delay on my Wyze Cam v3 too... haven't dug in to how long or significant it is... I just stopped using the audio because of it.
hmm, I'm unable to replicate the delay. I tried comparing the audio from the bridge to the audio from firmware rtsp on a v2/v3 but they're both very similar.
Could this be a firmware and/or camera issue?
@tmeekes can you post the FW version your camera is on and what audio codec you're getting?
@mrlt8 Let's see here, I've got two cameras here, running 4.36.9.139. I've set the env variable to use AAC.
Interestingly, it's not just the rtsp stream... I popped open the HLS stream and there's delay on there as well. Could it possibly be an issue with computing power? I am running a series of services on this PC... I wonder what it would look like on hw running nothing else... hmmm. At the same time, the video runs with limited delay, so I can only imagine.
Thoughts?
Hmm. Could you try removing the AAC option to see if the re-encode is causing any issues?
I've just recently started using wyze-bridge with a pair of Wyze Cam v3 and Zoneminder. I too see a delay in the audio, and have tried both with and without the AAC setting. I've also noticed a pattern of my Linux host becoming nonresponse after some time, typically less than 24 hours. I suspect it's related to the audio issues as I disabled audio yesterday, and things have been stable since. The one time I was able to use top when the system was mostly non- responsive (I already had a console session open), the wyze-bridge container was thrashing the CPU and the io waits were massive.
I'm running OpenSuSE Leap 15.3, Zoneminder 1.36.25, and Wyze Cam v3 4.36.9.139 firmware.
Thanks for the data point! I did notice some delay with the RTSP firmware when audio was enabled, so I'll be taking another look at the audio.
I think I found the issue and pushed some updates to the ffmpeg command on the dev branch which should reduce the delay.
Would appreciate it if someone could test it out and see if it helps.
Thanks! I should be able to find some time to get it in place today. I'll let you know how it goes.
I pulled the dev branch and enabled audio. My results were that audio was still not synced, and one of the 2 cameras actually wouldn't record video. Went back to the main branch and things are back to normal. I have other things to pay attention to right now, but I will try again in the near future just to make sure I didn't do something wrong.
hmm, I'm unable to replicate the out of sync/delay on v4.36.9.139.. My rtsp stream is about 1/2 second off from the Wyze App.
Can you try rebooting the camera?
As for recording, there were some changes in the last release which will use the mov container if the camera is sending PCM audio which isn't compatible with the mp4 container.
Thanks again. I'm stepping back a bit on the audio issue right now as there's something else going on. I'm having a hard time troubleshooting it, but need to square it away first.
Basically, at dusk and dawn I end up with something tied to the video driving my system into high IO Wait, and the whole system becomes unresponsive. I'm going to systematically work through the cameras Night Vision settings and see if anything hits.
Once I can get this squared away I'll go back to the audio piece.
Thanks for your responsiveness, and you're putting this together in the first place. Greatly appreciate your effort!
I have stabilized my system. Turns out it was starved for memory. Upgraded the memory, and everything is much happier. Start with the simple stuff is the moral I guess.
With that, I gave the dev branch another go. It's definitely not happy. The audio is still out of sync, and it frequently causes the video into zoneminder to stop all together or break up at times. I used VLC to test outside of zoneminder and experienced similar issues there. Tried it both without and with the AAC switch.
As you aren't experiencing these issues, could it be tied to the ffmpeg version, of configuration, or something along those lines? I'm on 4.4 with my opensuse 15.3 fully patched up.
The container is using ffmpeg-for-homebridge for the default images and FFmpeg-Builds for the images with hardware acceleration enabled, so we should be on the same ffmpeg build inside the container.
When you say out of sync, does the video also fall behind (compared to video only mode) or is it just the audio that's a few seconds behind? Could you also check the audio in the wyze app to make sure everything is good in there?
Do you have any extra options in your docker-compose? Could you try using the minimal config and see if there is a delay in VLC:
docker run \
-e [email protected] \
-e WYZE_PASSWORD=password \
-p 8554:8554 \
mrlt8/wyze-bridge:latest
I've been poking at it for a few days with no progress made I've tried it with the really simple config as you reference with no change.
What I've noticed is that the logs in Zoneminder show pkt.dts errors. I'm attaching a screenshot of the errors. I've been poking around the Zoneminder forums and see references to others having the same issue with certain cameras, but no fixes.

That's most likely caused by the raw h264 from the camera. Might be able to tweak some setting in the ffmpeg command to fix some of them but it may require re-encoding the video.
Interestingly (and I'm not sure what's changed) I'm noticing that my audio stream has a more regular delay now (a half second or so). Things seem to be working better... the extreme audio delays seem like they are gone now.
I should add that I am now making more regular restarts on the related containers now... so that might also be helping to hide any possible delays that build over time.
@tmeekes Is that with the November firmware?
Still playing around with the buffer/sleep interval, but would appreciate some feedback with the changes on the dev branch.
Not sure if it's just the camera/firmware I'm testing with, but I've noticed that the audio from the bridge occasionally comes a fraction of a second ahead of the wyze app.
I've also noticed that it seems like the audio and video almost want to stay in sync, and that the video and audio will both lag equally when they fall behind.
Actually, Yea, that's a good point. I did update the cameras with the latest firmware... That's one of the few changes I can think I made to the system.
If I get some time, I'll see if I can take a look at the dev branch.
I have this issue too on v3 camera. Like 45s delay or so. Haven't tried the dev branch.
@Shadester Is that on a single camera or across multiple? There were some tweaks added to the latest release version that could potentially help with the audio delay.
Single camera.
@mrlt8 Do you know if there's any progress on this? I added 3 cameras and noticed the audio delay is 15-45 sec. long enough for me to go downstairs talk to the camera, walk upstairs, get sat down, then listen to it...
Current config
version: v1.11.10
WYZE_EMAIL: ***
WYZE_PASSWORD: ***
NET_MODE: ANY
SNAPSHOT: RTSP30
MQTT_DTOPIC: homeassistant
ENABLE_AUDIO: true
ON_DEMAND: false
CAM_OPTIONS: []
TOTP_KEY: ***
IMG_TYPE: png
WB_IP: 195.168.***.***
AUDIO_CODEC: LIBOPUS
FRESH_DATA: true
I'm using the card from https://github.com/AlexxIT/WebRTC to view the feed over RTC from the RTSP URL
type: custom:webrtc-camera
url: rtsp://192.168.***.***:8554/loft-cam
ui: true
title: Loft Cam
poster: http://192.168.***.***:8123/local/loft-cam.png
muted: true
mode: webrtc
Im using this custom card to cut all the video lag over RTSP as mentioned in https://github.com/mrlt8/docker-wyze-bridge/issues/221. I've tested all the audio codecs and am currently using libopus, but they all seem to have the same delay... I've tested using generic cam integration and got the same results.
Fatal Python error: init_sys_streams: can't initialize sys standard streams
Python runtime state: core initialized
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 1022, in _find_and_load
KeyboardInterrupt
Output file #0 does not contain any stream
Output file #0 does not contain any stream
Fatal Python error: init_import_site: Failed to import the site module
Python runtime state: initialized
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site.py", line 73, in <module>
import os
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 879, in exec_module
File "<frozen importlib._bootstrap_external>", line 1012, in get_code
File "<frozen importlib._bootstrap_external>", line 672, in _compile_bytecode
KeyboardInterrupt
Output file #0 does not contain any stream
Output file #0 does not contain any stream
Output file #0 does not contain any stream
Output file #0 does not contain any stream
Output file #0 does not contain any stream
Output file #0 does not contain any stream
Traceback (most recent call last):
File "/app/rtsp_event.py", line 5, in <module>
import signal
File "/usr/local/lib/python3.10/signal.py", line 3, in <module>
from enum import IntEnum as _IntEnum
File "/usr/local/lib/python3.10/enum.py", line 2, in <module>
from types import MappingProxyType, DynamicClassAttribute
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 674, in _load_unlocked
File "<frozen importlib._bootstrap>", line 577, in module_from_spec
File "<frozen importlib._bootstrap>", line 555, in _init_module_attrs
KeyboardInterrupt
Output file #0 does not contain any stream
Fatal Python error: init_import_site: Failed to import the site module
Python runtime state: initialized
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site.py", line 73, in <module>
import os
File "/usr/local/lib/python3.10/os.py", line 29, in <module>
from _collections_abc import _check_methods
File "/usr/local/lib/python3.10/_collections_abc.py", line 416, in <module>
class _CallableGenericAlias(GenericAlias):
KeyboardInterrupt
Output file #0 does not contain any stream
Output file #0 does not contain any stream
Traceback (most recent call last):
File "/app/rtsp_event.py", line 7, in <module>
from datetime import datetime as dt
File "/usr/local/lib/python3.10/datetime.py", line 758, in <module>
timedelta.max = timedelta(days=999999999, hours=23, minutes=59, seconds=59,
File "/usr/local/lib/python3.10/datetime.py", line 536, in __new__
microseconds = round(microseconds + usdouble)
KeyboardInterrupt
[h264 @ 0x2e1f2b0] Missing reference picture, default is 0
[h264 @ 0x2e1f2b0] decode_slice_header error
Output file #0 does not contain any stream
Traceback (most recent call last):
File "/app/rtsp_event.py", line 5, in <module>
import signal
File "/usr/local/lib/python3.10/signal.py", line 3, in <module>
from enum import IntEnum as _IntEnum
File "/usr/local/lib/python3.10/enum.py", line 2, in <module>
from types import MappingProxyType, DynamicClassAttribute
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 879, in exec_module
File "<frozen importlib._bootstrap_external>", line 975, in get_code
File "<frozen importlib._bootstrap_external>", line 1074, in get_data
KeyboardInterrupt
Output file #0 does not contain any stream
Output file #0 does not contain any stream
Output file #0 does not contain any stream
Output file #0 does not contain any stream
Fatal Python error: init_sys_streams: can't initialize sys standard streams
Python runtime state: core initialized
Traceback (most recent call last):
File "/usr/local/lib/python3.10/io.py", line 52, in <module>
import abc
File "/usr/local/lib/python3.10/abc.py", line 92, in <module>
class ABCMeta(type):
KeyboardInterrupt
Output file #0 does not contain any stream
Output file #0 does not contain any stream
Output file #0 does not contain any stream
Output file #0 does not contain any stream
Traceback (most recent call last):
File "/app/rtsp_event.py", line 7, in <module>
from datetime import datetime as dt
File "/usr/local/lib/python3.10/datetime.py", line 14, in <module>
from operator import index as _index
File "/usr/local/lib/python3.10/operator.py", line 408, in <module>
from _operator import *
KeyboardInterrupt
my log is full of these but I don't know if that's related to audio
fresh boot gives me an output of
🎬 STARTING ALL 3 CAMERAS
2023/02/24 02:52:56 [WyzeBridge] Starting rtsp-simple-server v0.21.2
2023/02/24 02:52:56 [WyzeBridge] 🎉 Connecting to WyzeCam Pan - kitchen-cam on 192.168.***.*** (1/3)
2023/02/24 02:52:56 [WyzeBridge] 🎉 Connecting to WyzeCam V3 - garage-door on 192.168.***.*** (1/3)
2023/02/24 02:52:56 [WyzeBridge] 🎉 Connecting to WyzeCam Pan - loft-cam on 192.168.***.*** (1/3)
2023/02/24 02:52:59 [Garage Door] 📡 Getting 120kb/s HD stream (H264/20fps) via LAN mode (WiFi: 69%) FW: 4.36.9.139 🔒 (DTLS) (2/3)
2023/02/24 02:52:59 [Garage Door] 🔊 Audio Enabled - ALAW > LIBOPUS/16,000Hz
2023/02/24 02:52:59 [Garage Door] WARNING: Skipping smaller frame at start of stream (frame_size=1)
2023/02/24 02:53:01 [RTSP][GARAGE-DOOR] ✅ '/garage-door' stream is UP! (3/3)
Output file #0 does not contain any stream
2023/02/24 02:53:02 [Kitchen Cam] 📡 Getting 120kb/s HD stream (H264/15fps) via LAN mode (WiFi: 88%) FW: 4.10.9.1851 🔒 (DTLS) (2/3)
2023/02/24 02:53:02 [Kitchen Cam] 🔊 Audio Enabled - MULAW > LIBOPUS/8,000Hz
2023/02/24 02:53:02 [Loft Cam] 📡 Getting 120kb/s HD stream (H264/15fps) via LAN mode (WiFi: 87%) FW: 4.10.9.1851 🔒 (DTLS) (2/3)
2023/02/24 02:53:02 [Loft Cam] 🔊 Audio Enabled - MULAW > LIBOPUS/8,000Hz
2023/02/24 02:53:03 [RTSP][LOFT-CAM] ✅ '/loft-cam' stream is UP! (3/3)
2023/02/24 02:53:03 [RTSP][KITCHEN-CAM] ✅ '/kitchen-cam' stream is UP! (3/3)
Output file #0 does not contain any stream
Output file #0 does not contain any stream
Love the work you've done ❤️