blakeblackshear / frigate

NVR with realtime local object detection for IP cameras
https://frigate.video
MIT License
19.46k stars 1.79k forks source link

[Camera Support]: Wyze Audio not syncd with video #5614

Closed ratbich closed 1 year ago

ratbich commented 1 year ago

Describe the problem you are having

When watching playback of clips/recordings, the audio is not in sync. The audio seems to play ~15 seconds or more later on. I am using Wyzebridge, Wyze camera v3. Docker container on Ubuntu Host.

Version

0.11.1-2eada21

Frigate config file

mqtt:
  host: IP
ffmpeg:
  output_args:
    record: -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v copy -c:a aac
cameras:
  patio:
    ffmpeg:
      inputs:
        - path: rtsp://IP:8554/CAMERA NAME
          roles:
            - detect
            - record
      hwaccel_args: -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format yuv420p
    rtmp:
      enabled: false
    detect:
      width: 1920
      height: 1080
    snapshots:
      enabled: True
    record:
      enabled: True
      retain:
        days: 14
        mode: all
motion:
  threshold: 50
  contour_area: 35
  mask: 
    - 881,0,785,347,584,458,0,495,0,0
    - 1920,1003,1920,1080,1376,1080,1378,999
    - 1920,0,1920,363,1811,522,1165,428,1157,0
    - 798,130,1209,133,1204,0,812,0
    - 1019,624,1480,719,1492,277,1043,264
    - 1419,622,1870,663,1920,277,1458,197
    - 719,216,915,226,983,69,736,29

Relevant log output

no errors on this

FFprobe output from your camera

ffprobe version n5.1-2-g915ef932a3-20220731 Copyright (c) 2007-2022 the FFmpeg developers
  built with gcc 12.1.0 (crosstool-NG 1.25.0.55_3defb7b)
  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-ffbuild-linux-gnu- --arch=x86_64 --target-os=linux --enable-gpl --enable-version3 --disable-debug --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --enable-libpulse --enable-libvmaf --enable-libxcb --enable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-mbedtls --enable-librist --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libmfx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --disable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --enable-libdrm --enable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags=-pie --extra-libs='-ldl -lgomp' --extra-version=20220731
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
[rtsp @ 0x55da543bb140] method SETUP failed: 461 Unsupported Transport
[h264 @ 0x55da543bfcc0] Missing reference picture, default is 0
[h264 @ 0x55da543bfcc0] decode_slice_header error
Input #0, rtsp, from 'rtsp://IP:8554/CAM':
  Metadata:
    title           : Stream
  Duration: N/A, start: 0.115188, bitrate: N/A
  Stream #0:0: Video: h264 (Main), yuv420p(tv, bt709, progressive), 1920x1080, 20 fps, 20 tbr, 90k tbn
  Stream #0:1: Audio: pcm_alaw, 16000 Hz, mono, s16, 128 kb/s

Frigate stats

detection_fps   0
detectors   
cpu 
detection_start 0
inference_speed 107.83
pid 216
patio   
camera_fps  5.1
capture_pid 221
detection_fps   0
pid 220
process_fps 5.1
skipped_fps 0
service 
latest_version  "0.11.1"
storage 
/dev/shm    
free    63.4
mount_type  "tmpfs"
total   67.1
used    3.7
/media/frigate/clips    
free    287759.2
mount_type  "ext4"
total   491107.6
used    178326.2
/media/frigate/recordings   
free    287759.2
mount_type  "ext4"
total   491107.6
used    178326.2
/tmp/cache  
free    998.9
mount_type  "tmpfs"
total   1000
used    1.1
temperatures    {}
uptime  191052
version "0.11.1-2eada21"

Operating system

Other Linux

Install method

Docker Compose

Coral version

CPU (no coral)

Network connection

Wireless

Camera make and model

Wyze V3

Any other information that may be helpful

No response

NickM-27 commented 1 year ago

You'll maybe need to set the input args as

input_args: -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport tcp -timeout 5000000 -use_wallclock_as_timestamps 1 -async 1

ratbich commented 1 year ago

You'll maybe need to set the input args as

input_args: -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport tcp -timeout 5000000 -use_wallclock_as_timestamps 1 -async 1

I will try this then report back. Thx!

ballakers commented 1 year ago

I would suggest not using wyze cams, and the wyze bridge when I tried it a long while ago also brought my network (with good hardware) to a crawl. Even my amcrest wifi cams could work better - as Blake (great name - same as mine lol) says it's best used with POE / hardwired network cams. Maybe the da-fang hacks would be better but not sure if V3 is supported.

ratbich commented 1 year ago

You'll maybe need to set the input args as input_args: -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport tcp -timeout 5000000 -use_wallclock_as_timestamps 1 -async 1

I will try this then report back. Thx!

Just reviewed a clip that would be easy to tell how the audio is, unfortunately the change did not resolve the delay. Still about 15 or more seconds off.

I also wanted to make sure the feed itself was in sync outside Frigate, which was in audio sync when I watched the Wyze feed directly.

NickM-27 commented 1 year ago

How did you watch the wyze feed directly? Watching via the app for example is not a direct comparison

ratbich commented 1 year ago

How did you watch the wyze feed directly? Watching via the app for example is not a direct comparison

I actually was using the Wyze App to watch and had my phone with me to listen to the audio. If i watch the feed via VLC on the RTSP from wyzebridge and listen audio there, would that be better to try?

NickM-27 commented 1 year ago

Yes that's better, the wyze app doesn't use RTSP so it's an apple to oranges comparison when doing that.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.