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

Issues trying to get the Wyze Doorbell Cam working #133

Closed mrlt8 closed 2 years ago

mrlt8 commented 3 years ago

Moving the Doorbell/WYZEDB3 related discussion over to a new issue.

Originally posted by @tbrausch in https://github.com/mrlt8/docker-wyze-bridge/discussions/68#discussioncomment-1332804

mrlt8 commented 3 years ago

Does door_size 4 give you an SD picture?

When you guys get a chance can you test out some different DOOR_SIZE values?

nwhistler commented 3 years ago

Yes, door_size=4 gives me 480x640. I don't think it is SD, because I noticed that if open the app, it has downshifted the image to 480p. Like I change it to HD, fire up the bridge and it's back to 480p.

Here is a screenshot of what VLC is showing as the encoding.

Screen Shot 2021-10-02 at 11 31 19 AM

If I try anything else, the debug says [FFMPEG] Wrong resolution: 4. I even tried going into the Wyze app and changing it there to HD. But that didn't seem to help.

famewolf commented 3 years ago

What do I add and where do I add it to fix the "wrong resolution 4" showing in the log for my doorbell? WIll whatever I need to add conflict with my other cam's especially if they are using relay mode?

mrlt8 commented 3 years ago

I still need to go back and look into this issue, but a temporary solution would be to ignore the error with IGNORE_RES=4.

All other cameras should use res 1 or 2 so should be unaffected.

ItherNiT commented 2 years ago

Does anyone currently have the doorbell working?

With the last few releases, I haven't been able to get it running

NET_MODE: LAN SNAPSHOT: RTSP15 MQTT_DTOPIC: homeassistant FILTER_MODELS: WYZEDB3 DEBUG_FFMPEG: true DEBUG_FRAMES: false FRESH_DATA: false ROTATE_DOOR: true IGNORE_RES: 3 DOOR_SIZE: 4 QUALITY: HD60

[libx264 @ 0x55ee25f50000] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 16% 19% 28% 5% 5% 5% 6% 6% 9% [libx264 @ 0x55ee25f50000] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 22% 19% 7% 7% 6% 6% 5% 6% [libx264 @ 0x55ee25f50000] i8c dc,h,v,p: 100% 0% 0% 0% [libx264 @ 0x55ee25f50000] Weighted P-Frames: Y:9.1% UV:0.0% [libx264 @ 0x55ee25f50000] kb/s:2320.96 [AVIOContext @ 0x55ee25f48900] Statistics: 1648589 bytes read, 0 seeks Exiting normally, received signal 15. 2021/12/06 20:02:31 [Front Doorbell] [FFMPEG] AV_ER_SESSION_CLOSE_BY_REMOTE 2021/12/06 20:02:35 [Front Doorbell] ๐ŸŽ‰ Starting HD 60kB/s Stream for WyzeCam Doorbell "LAN mode" FW: 4.25.0.244 IP: 192.168.5.47 WiFi: 43% 2021/12/06 20:02:35 [Front Doorbell] [FFMPEG_CMD] ffmpeg -loglevel verbose -fflags +flush_packets+genpts+discardcorrupt+nobuffer -i - -vcodec libx264 -vf transpose=1 -preset veryfast -crf 20 -rtsp_transport tcp -f rtsp rtsp://0.0.0.0:8554 ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516 configuration: --pkgconfigdir=/build/workspace/lib/pkgconfig --prefix=/build/workspace --pkg-config-flags=--static --extra-cflags=-I/build/workspace/include --extra-ldflags=-L/build/workspace/lib --extra-libs='-lpthread -lm' --enable-static --disable-debug --disable-shared --disable-ffplay --disable-doc --enable-openssl --enable-gpl --enable-version3 --enable-nonfree --enable-pthreads --enable-libvpx --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libx264 --enable-runtime-cpudetect --enable-libfdk-aac --enable-avfilter --enable-libopencore_amrwb --enable-libopencore_amrnb --enable-filters --enable-decoder=h264 --enable-network --enable-protocol=tcp --enable-libspeex --enable-demuxer=rtsp --enable-indev=alsa --enable-outdev=alsa libavutil 56. 51.100 / 56. 51.100 libavcodec 58. 91.100 / 58. 91.100 libavformat 58. 45.100 / 58. 45.100 libavdevice 58. 10.100 / 58. 10.100 libavfilter 7. 85.100 / 7. 85.100 libswscale 5. 7.100 / 5. 7.100 libswresample 3. 7.100 / 3. 7.100 libpostproc 55. 7.100 / 55. 7.100 2021/12/06 20:02:36 [Front Doorbell] WARNING: Frame not available [h264 @ 0x55fb9e472600] Reinit context to 640x480, pix_fmt: yuv420p [h264 @ 0x55fb9e470a00] max_analyze_duration 5000000 reached at 5020000 microseconds st:0 Input #0, h264, from 'pipe:': Duration: N/A, bitrate: N/A Stream #0:0: Video: h264 (Main), 1 reference frame, yuv420p(tv, unknown/bt709/unknown, progressive, left), 640x480 [SAR 1:1 DAR 4:3], 21.33 fps, 20 tbr, 1200k tbn, 40 tbc Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264)) [h264 @ 0x55fb9e59b580] Reinit context to 640x480, pix_fmt: yuv420p [h264 @ 0x55fb9e59b580] concealing 1141 DC, 1141 AC, 1141 MV errors in P frame [h264 @ 0x55fb9e4a62c0] concealing 937 DC, 937 AC, 937 MV errors in P frame [h264 @ 0x55fb9e4bd540] concealing 1120 DC, 1120 AC, 1120 MV errors in P frame [h264 @ 0x55fb9e4ac0c0] concealing 1056 DC, 1056 AC, 1056 MV errors in P frame [h264 @ 0x55fb9e4f0f40] concealing 1155 DC, 1155 AC, 1155 MV errors in P frame [h264 @ 0x55fb9e50dbc0] concealing 1083 DC, 1083 AC, 1083 MV errors in P frame [h264 @ 0x55fb9e52a840] concealing 984 DC, 984 AC, 984 MV errors in P frame frame= 0 fps=0.0 q=0.0 size=N/A time=-577014:32:22.77 bitrate=N/A speed=N/A [h264 @ 0x55fb9e5474c0] concealing 1052 DC, 1052 AC, 1052 MV errors in P frame [h264 @ 0x55fb9e564140] concealing 910 DC, 910 AC, 910 MV errors in P frame [h264 @ 0x55fb9e59b580] concealing 935 DC, 935 AC, 935 MV errors in P frame [h264 @ 0x55fb9e4a62c0] concealing 888 DC, 888 AC, 888 MV errors in P frame [h264 @ 0x55fb9e4bd540] Reinit context to 1728x1296, pix_fmt: yuv420p [graph 0 input from stream 0:0 @ 0x55fb9e59a700] w:1728 h:1296 pixfmt:yuv420p tb:1/1200000 fr:20/1 sar:0/1 [Parsed_transpose_0 @ 0x55fb9e650b00] w:1728 h:1296 dir:1 -> w:1296 h:1728 rotation:clockwise vflip:0 [libx264 @ 0x55fb9e473d40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 [libx264 @ 0x55fb9e473d40] profile High, level 5.0, 4:2:0, 8-bit [libx264 @ 0x55fb9e473d40] 264 - core 160 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=2 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=12 lookahead_threads=4 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=1 keyint=250 keyint_min=20 scenecut=40 intra_refresh=0 rc_lookahead=10 rc=crf mbtree=1 crf=20.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00 [tcp @ 0x55fb9ec727c0] Starting connection attempt to 0.0.0.0 port 8554 [tcp @ 0x55fb9ec727c0] Successfully connected to 0.0.0.0 port 8554 [rtsp @ 0x55fb9e480480] SDP: v=0 o=- 0 0 IN IP4 127.0.0.1 s=No Name c=IN IP4 127.0.0.1 t=0 0 a=tool:libavformat 58.45.100 m=video 0 RTP/AVP 96 a=rtpmap:96 H264/90000 a=fmtp:96 packetization-mode=1; sprop-parameter-sets=Z2QAMqzZQFEDZoQAAAMABAAAAwCgPGDGWA==,aO+G8sA=; profile-level-id=640032 a=control:streamid=0 Output #0, rtsp, to 'rtsp://0.0.0.0:8554/front-doorbell': Metadata: encoder : Lavf58.45.100 Stream #0:0: Video: h264 (libx264), 1 reference frame, yuv420p(left), 1296x1728, q=-1--1, 20 fps, 90k tbn, 20 tbc Metadata: encoder : Lavc58.91.100 libx264 Side data: cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A 2021/12/06 20:02:44 [RTSP][FRONT-DOORBELL] โœ… '/front-doorbell' stream is UP! 2021/12/06 20:02:44 [RTSP][FRONT-DOORBELL] ๐Ÿ“– New client reading 2021/12/06 20:02:53 [Front Doorbell] ๐Ÿงน Cleaning up FFMPEG... frame= 2 fps=1.2 q=0.0 size=N/A time=00:00:00.00 bitrate=N/A speed= 0x frame= 11 fps=4.7 q=0.0 size=N/A time=00:00:00.00 bitrate=N/A speed= 0x frame= 17 fps=5.9 q=0.0 size=N/A time=00:00:00.00 bitrate=N/A speed= 0x frame= 19 fps=3.3 q=0.0 size=N/A time=00:00:00.00 bitrate=N/A speed= 0x frame= 32 fps=4.9 q=25.0 size=N/A time=00:00:00.70 bitrate=N/A speed=0.108x frame= 42 fps=6.0 q=25.0 size=N/A time=00:00:01.20 bitrate=N/A speed=0.172x frame= 54 fps=7.1 q=25.0 size=N/A time=00:00:01.80 bitrate=N/A speed=0.238x frame= 60 fps=7.4 q=25.0 size=N/A time=00:00:02.10 bitrate=N/A speed=0.26x frame= 75 fps=8.7 q=25.0 size=N/A time=00:00:02.85 bitrate=N/A speed=0.33x frame= 91 fps=9.9 q=25.0 size=N/A time=00:00:03.65 bitrate=N/A speed=0.398x frame= 99 fps= 10 q=25.0 size=N/A time=00:00:04.05 bitrate=N/A speed=0.414x frame= 106 fps=9.7 q=-1.0 Lsize=N/A time=00:00:05.70 bitrate=N/A speed=0.523x video:1539kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown Input file #0 (pipe:): Input stream #0:0 (video): 125 packets read (856545 bytes); 107 frames decoded; Total: 125 packets (856545 bytes) demuxed Output file #0 (rtsp://0.0.0.0:8554/front-doorbell): Output stream #0:0 (video): 106 frames encoded; 106 packets muxed (1575571 bytes); Total: 106 packets (1575571 bytes) muxed 2021/12/06 20:02:542021/12/06 20:02:54 [RTSP][FRONT-DOORBELL] โŒ '/front-doorbell' stream is down [RTSP][FRONT-DOORBELL] ๐Ÿ“• Client stopped reading [libx264 @ 0x55fb9e473d40] frame I:1 Avg QP:15.36 size:211178 [libx264 @ 0x55fb9e473d40] frame P:27 Avg QP:17.68 size: 43691 [libx264 @ 0x55fb9e473d40] frame B:78 Avg QP:21.47 size: 2360 [libx264 @ 0x55fb9e473d40] consecutive B-frames: 1.9% 0.0% 0.0% 98.1% [libx264 @ 0x55fb9e473d40] mb I I16..4: 3.7% 7.7% 88.7% [libx264 @ 0x55fb9e473d40] mb P I16..4: 1.5% 3.9% 4.4% P16..4: 27.2% 13.7% 10.2% 0.0% 0.0% skip:39.1% [libx264 @ 0x55fb9e473d40] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 10.0% 2.3% 0.2% direct: 0.6% skip:86.8% L0:45.1% L1:47.2% BI: 7.6% [libx264 @ 0x55fb9e473d40] 8x8 transform intra:31.2% inter:29.2% [libx264 @ 0x55fb9e473d40] coded y,uvDC,uvAC intra: 95.2% 0.0% 0.0% inter: 4.5% 0.0% 0.0% [libx264 @ 0x55fb9e473d40] i16 v,h,dc,p: 12% 14% 61% 13% [libx264 @ 0x55fb9e473d40] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 16% 20% 28% 5% 5% 5% 6% 6% 9% [libx264 @ 0x55fb9e473d40] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 22% 18% 7% 7% 6% 6% 6% 6% [libx264 @ 0x55fb9e473d40] i8c dc,h,v,p: 100% 0% 0% 0% [libx264 @ 0x55fb9e473d40] Weighted P-Frames: Y:3.7% UV:0.0% [libx264 @ 0x55fb9e473d40] kb/s:2377.20 2021/12/06 20:02:54 [Front Doorbell] [FFMPEG] AV_ER_SESSION_CLOSE_BY_REMOTE [AVIOContext @ 0x55fb9e479900] Statistics: 1344331 bytes read, 0 seeks Exiting normally, received signal 15.

nwhistler commented 2 years ago

I tried this weekend and was successful. I did a docker pull to get the latest image and removed all the parameters. All that is baked in now without having to change anything.

So remove all this:

ROTATE_DOOR: true IGNORE_RES: 3 DOOR_SIZE: 4 QUALITY: HD60

ItherNiT commented 2 years ago

I tried this weekend and was successful. I did a docker pull to get the latest image and removed all the parameters. All that is baked in now without having to change anything.

So remove all this:

ROTATE_DOOR: true IGNORE_RES: 3 DOOR_SIZE: 4 QUALITY: HD60

Mine only seems to run for a few seconds, then I get an error. Running in docker and home assist, both yield the same result:

image

mrlt8 commented 2 years ago

Seems like it could be a WiFi issue.. might want to check your 2.4Ghz network for interference on your channel or non-standard WiFi enhancements like airtime fairness.

ItherNiT commented 2 years ago

I don't think it's my wifi, all the other cams are fine. And according to unifi it has a score of 80. When the stream loads it still shows the door to the side and needs to be flipped, that's easy to do in HA (extra_arguments: -vf "transpose=1") Can I send you any logs to assist?

image

ItherNiT commented 2 years ago

Update:

I was able to get the doorbell working using tinycam pro. I had an old andorid media player laying around. Its showing correctly in HA, I just had to limit the frames to get a okay performing stream.

I'm a bit hamstrung with the media player cpu: image

mrlt8 commented 2 years ago

I don't have an android device, but I believe they're using the same tutk method to grab the stream, so we should be able to get a similar result.

Do you see any freezes in the tinycam stream?

ItherNiT commented 2 years ago

No freezes, but 25-30% dropped frames.

mrlt8 commented 2 years ago

I added a MAX_NOREADY env option to the edge branch. This should allow you to bump the number of consecutive "Frame not available" errors from the 500 default.

- DEBUG_FRAMES=true should also allow you to debug the current number of "Frame not available" errors.

ItherNiT commented 2 years ago

Thanks!!!!

This fixed my issue :)

mrlt8 commented 2 years ago

Awesome! Can you post the number that worked for you? I can try to add it the main branch so that it works out of the box.

mrlt8 commented 2 years ago

Marking this as resolved. Please feel free to open a new topic if you need additional assistance.