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.65k stars 168 forks source link

Recording broken for Wyze Cam v2 Firmware 4.9.9.1433 #575

Closed pd-448482 closed 1 year ago

pd-448482 commented 2 years ago

Hi, I have two wyze cam v2s. One is on 4.9.9.1433 and the other is on the previous 4.9.8.1002 firmware. I have recording set up and the older firmware works fine. The newer firmware creates the files but they're all 0 bytes. I don't see any errors in the logs. I am able to see the preview picture on the web ui.

mrlt8 commented 2 years ago

There seems to be a weird bug with the recordings where it does the 0 bytes thing as we've had several reports of this from several users. I don't think it's related to the firmware version as it eventually starts working, but I will be trying to take another look.

pd-448482 commented 2 years ago

Thanks @mrlt8! I can also grab more logs if there are additional flags to set to get DEBUG level logs.

mrlt8 commented 2 years ago

DEBUG_FFMPEG=True would help.

pd-448482 commented 2 years ago

Here are the docker logs:

root@Nas:~# docker logs docker-wyze-bridge
2022/10/27 13:43:23 [WyzeBridge] 🚀 STARTING DOCKER-WYZE-BRIDGE v1.8.11

2022/10/27 13:43:24 [WyzeBridge] 🔍 Could not find local cache for 'user'
 * Serving Flask app 'frontend'
 * Debug mode: off
2022/10/27 13:43:24 [WyzeBridge] 🔍 Could not find local cache for 'auth'
2022/10/27 13:43:24 [WyzeBridge] ☁️ Fetching 'auth' from the Wyze API...
2022/10/27 13:43:24 [WyzeBridge] WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on all addresses (0.0.0.0)
 * Running on http://127.0.0.1:5000
 * Running on http://172.20.0.2:5000
2022/10/27 13:43:24 [WyzeBridge] Press CTRL+C to quit
2022/10/27 13:43:24 [WyzeBridge] 🔐 MFA Token Required
2022/10/27 13:43:24 [WyzeBridge] 🔏 Using TOTP_KEY to generate TOTP
2022/10/27 13:43:24 [WyzeBridge] 🔑 Using 981887 for authentication
2022/10/27 13:43:24 [WyzeBridge] ✅ Verification code accepted!
2022/10/27 13:43:24 [WyzeBridge] 💾 Saving 'auth' to local cache...
2022/10/27 13:43:24 [WyzeBridge] ☁️ Fetching 'user' from the Wyze API...
2022/10/27 13:43:25 [WyzeBridge] 💾 Saving 'user' to local cache...
2022/10/27 13:43:25 [WyzeBridge] 🔍 Could not find local cache for 'cameras'
2022/10/27 13:43:25 [WyzeBridge] ☁️ Fetching 'cameras' from the Wyze API...
2022/10/27 13:43:25 [WyzeBridge] 💾 Saving 'cameras' to local cache...
2022/10/27 13:43:25 [WyzeBridge] 
🎬 STARTING ALL 2 CAMERAS
2022/10/27 13:43:25 [WyzeBridge] Starting rtsp-simple-server v0.20.0
2022/10/27 13:43:25 [WyzeBridge] 🎉 Connecting to WyzeCam V2 - dining-room-cam on 192.168.107.20 (1/3)
2022/10/27 13:43:25 [WyzeBridge] 🎉 Connecting to WyzeCam V2 - living-room-cam on 192.168.107.21 (1/3)
2022/10/27 13:43:27 [Dining Room Cam] IOTC_ER_DEVICE_OFFLINE
2022/10/27 13:43:27 [Living Room Cam] IOTC_ER_DEVICE_OFFLINE
2022/10/27 13:43:27 [WyzeBridge] 👻 dining-room-cam offline. WILL retry in 10s.
2022/10/27 13:43:27 [WyzeBridge] 👻 living-room-cam offline. WILL retry in 10s.
2022/10/27 13:43:37 [WyzeBridge] 🎉 Connecting to WyzeCam V2 - dining-room-cam on 192.168.107.20 (1/3)
2022/10/27 13:43:37 [WyzeBridge] 🎉 Connecting to WyzeCam V2 - living-room-cam on 192.168.107.21 (1/3)
2022/10/27 13:43:38 [Dining Room Cam] IOTC_ER_DEVICE_OFFLINE
2022/10/27 13:43:38 [Living Room Cam] IOTC_ER_DEVICE_OFFLINE
2022/10/27 13:43:39 [WyzeBridge] 👻 dining-room-cam offline. WILL retry in 10s.
2022/10/27 13:43:39 [WyzeBridge] 👻 living-room-cam offline. WILL retry in 10s.
2022/10/27 13:43:49 [WyzeBridge] 🎉 Connecting to WyzeCam V2 - dining-room-cam on 192.168.107.20 (1/3)
2022/10/27 13:43:49 [WyzeBridge] 🎉 Connecting to WyzeCam V2 - living-room-cam on 192.168.107.21 (1/3)
2022/10/27 13:43:50 [Dining Room Cam] IOTC_ER_DEVICE_OFFLINE
2022/10/27 13:43:50 [Living Room Cam] IOTC_ER_DEVICE_OFFLINE
2022/10/27 13:43:51 [WyzeBridge] 👻 dining-room-cam offline. WILL retry in 10s.
2022/10/27 13:43:51 [WyzeBridge] 👻 living-room-cam offline. WILL retry in 10s.
2022/10/27 13:44:01 [WyzeBridge] 🎉 Connecting to WyzeCam V2 - dining-room-cam on 192.168.107.20 (1/3)
2022/10/27 13:44:01 [WyzeBridge] 🎉 Connecting to WyzeCam V2 - living-room-cam on 192.168.107.21 (1/3)
2022/10/27 13:44:02 [Dining Room Cam] IOTC_ER_DEVICE_OFFLINE
2022/10/27 13:44:02 [Living Room Cam] IOTC_ER_DEVICE_OFFLINE
2022/10/27 13:44:03 [WyzeBridge] 👻 dining-room-cam offline. WILL retry in 10s.
2022/10/27 13:44:03 [WyzeBridge] 👻 living-room-cam offline. WILL retry in 10s.
2022/10/27 13:44:13 [WyzeBridge] 🎉 Connecting to WyzeCam V2 - dining-room-cam on 192.168.107.20 (1/3)
2022/10/27 13:44:13 [WyzeBridge] 🎉 Connecting to WyzeCam V2 - living-room-cam on 192.168.107.21 (1/3)
2022/10/27 13:44:14 [Dining Room Cam] IOTC_ER_DEVICE_OFFLINE
2022/10/27 13:44:14 [Living Room Cam] IOTC_ER_DEVICE_OFFLINE
2022/10/27 13:44:15 [WyzeBridge] 👻 dining-room-cam offline. WILL retry in 10s.
2022/10/27 13:44:15 [WyzeBridge] 👻 living-room-cam offline. WILL retry in 10s.
2022/10/27 13:44:25 [WyzeBridge] 🎉 Connecting to WyzeCam V2 - dining-room-cam on 192.168.107.20 (1/3)
2022/10/27 13:44:25 [WyzeBridge] 🎉 Connecting to WyzeCam V2 - living-room-cam on 192.168.107.21 (1/3)
2022/10/27 13:44:26 [Dining Room Cam] IOTC_ER_DEVICE_OFFLINE
2022/10/27 13:44:26 [Living Room Cam] IOTC_ER_DEVICE_OFFLINE
2022/10/27 13:44:27 [WyzeBridge] 👻 dining-room-cam offline. WILL retry in 10s.
2022/10/27 13:44:27 [WyzeBridge] 👻 living-room-cam offline. WILL retry in 10s.
2022/10/27 13:44:37 [WyzeBridge] 🎉 Connecting to WyzeCam V2 - dining-room-cam on 192.168.107.20 (1/3)
2022/10/27 13:44:37 [WyzeBridge] 🎉 Connecting to WyzeCam V2 - living-room-cam on 192.168.107.21 (1/3)
2022/10/27 13:44:38 [Dining Room Cam] IOTC_ER_DEVICE_OFFLINE
2022/10/27 13:44:38 [Living Room Cam] IOTC_ER_DEVICE_OFFLINE
2022/10/27 13:44:39 [WyzeBridge] 👻 dining-room-cam offline. WILL retry in 10s.
2022/10/27 13:44:39 [WyzeBridge] 👻 living-room-cam offline. WILL retry in 10s.
2022/10/27 13:44:49 [WyzeBridge] 🎉 Connecting to WyzeCam V2 - dining-room-cam on 192.168.107.20 (1/3)
2022/10/27 13:44:49 [WyzeBridge] 🎉 Connecting to WyzeCam V2 - living-room-cam on 192.168.107.21 (1/3)
2022/10/27 13:44:50 [Dining Room Cam] IOTC_ER_DEVICE_OFFLINE
2022/10/27 13:44:50 [Living Room Cam] IOTC_ER_DEVICE_OFFLINE
2022/10/27 13:44:51 [WyzeBridge] 👻 dining-room-cam offline. WILL retry in 10s.
2022/10/27 13:44:51 [WyzeBridge] 👻 living-room-cam offline. WILL retry in 10s.
2022/10/27 13:45:01 [WyzeBridge] 🎉 Connecting to WyzeCam V2 - dining-room-cam on 192.168.107.20 (1/3)
2022/10/27 13:45:01 [WyzeBridge] 🎉 Connecting to WyzeCam V2 - living-room-cam on 192.168.107.21 (1/3)
2022/10/27 13:45:02 [Living Room Cam] IOTC_ER_DEVICE_OFFLINE
2022/10/27 13:45:03 [Dining Room Cam] 📡 Getting 120kb/s HD stream (15fps) via LAN mode (WiFi: 79%) FW: 4.9.9.1433 🔒 (DTLS) (2/3)
2022/10/27 13:45:03 [Dining Room Cam] 🔊 Audio Enabled - MULAW/8,000Hz
2022/10/27 13:45:03 [Dining Room Cam] 📹 Will record 300s clips to /record/DINING-ROOM-CAM/
2022/10/27 13:45:03 [Dining Room Cam] [FFMPEG_CMD] ffmpeg -loglevel verbose -fflags +genpts+flush_packets+nobuffer+bitexact -flags +low_delay -thread_queue_size 64 -threads 1 -analyzeduration 50 -probesize 50 -f h264 -i pipe: -f mulaw -ar 8000 -i /tmp/dining-room-cam.wav -flags +global_header -c:v copy -c:a copy -movflags +empty_moov+default_base_moof+frag_keyframe -map 0:v -map 1:a -shortest -f tee [f=rtsp:rtsp_transport=tcp:bsfs/v=dump_extra=freq=keyframe]rtsp://0.0.0.0:8554/dining-room-cam|[onfail=ignore:f=segment:segment_time=300:segment_atclocktime=1:segment_format=mp4:reset_timestamps=1:strftime=1:use_fifo=1]/record/DINING-ROOM-CAM/DINING-ROOM-CAM_%Y-%m-%d_%H-%M-%S_%Z.mp4
ffmpeg version 5.0 Copyright (c) 2000-2022 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      57. 17.100 / 57. 17.100
  libavcodec     59. 18.100 / 59. 18.100
  libavformat    59. 16.100 / 59. 16.100
  libavdevice    59.  4.100 / 59.  4.100
  libavfilter     8. 24.100 /  8. 24.100
  libswscale      6.  4.100 /  6.  4.100
  libswresample   4.  3.100 /  4.  3.100
  libpostproc    56.  3.100 / 56.  3.100
2022/10/27 13:45:03 [WyzeBridge] 👻 living-room-cam offline. WILL retry in 10s.
[h264 @ 0x55949a306440] Reinit context to 1920x1088, pix_fmt: yuv420p
[h264 @ 0x55949a2f4a40] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, h264, from 'pipe:':
  Duration: N/A, bitrate: N/A
  Stream #0:0: Video: h264 (Main), 1 reference frame, yuv420p(progressive, left), 1920x1080 (1920x1088), 15 tbr, 1200k tbn
Guessed Channel Layout for Input Stream #1.0 : mono
Input #1, mulaw, from '/tmp/dining-room-cam.wav':
  Duration: N/A, bitrate: 64 kb/s
  Stream #1:0: Audio: pcm_mulaw, 8000 Hz, mono, s16, 64 kb/s
[tcp @ 0x55949a3b5380] Starting connection attempt to 0.0.0.0 port 8554
[tcp @ 0x55949a3b5380] Successfully connected to 0.0.0.0 port 8554
[rtsp @ 0x55949a3b5480] 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 59.16.100
m=video 0 RTP/AVP 96
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1; sprop-parameter-sets=Z01AKJ2oHgCJ+WEAAAMAAQAAAwAehA==,aO48gAA=; profile-level-id=4D4028
a=control:streamid=0
m=audio 0 RTP/AVP 0
b=AS:64
a=control:streamid=1

[tee @ 0x55949a3b2680] filename:'rtsp://0.0.0.0:8554/dining-room-cam' format:rtsp
[tee @ 0x55949a3b2680]     stream:0 codec:h264 type:video bsfs: AVBSFContext
[tee @ 0x55949a3b2680]     stream:1 codec:pcm_mulaw type:audio bsfs: null
[tee @ 0x55949a3b2680] filename:'/record/DINING-ROOM-CAM/DINING-ROOM-CAM_%Y-%m-%d_%H-%M-%S_%Z.mp4' format:fifo
[tee @ 0x55949a3b2680]     stream:0 codec:h264 type:video bsfs: null
[tee @ 0x55949a3b2680]     stream:1 codec:pcm_mulaw type:audio bsfs: null
Output #0, tee, to '[f=rtsp:rtsp_transport=tcp:bsfs/v=dump_extra=freq=keyframe]rtsp://0.0.0.0:8554/dining-room-cam|[onfail=ignore:f=segment:segment_time=300:segment_atclocktime=1:segment_format=mp4:reset_timestamps=1:strftime=1:use_fifo=1]/record/DINING-ROOM-CAM/DINING-ROOM-CAM_%Y-%m-%d_%H-%M-%S_%Z.mp4':
  Metadata:
    encoder         : Lavf59.16.100
  Stream #0:0: Video: h264 (Main), 1 reference frame, yuv420p(progressive, left), 1920x1080 (0x0), q=2-31, 15 tbr, Selected stream id:0 type:video
15 tbn
  Stream #0:1: Audio: pcm_mulaw, 8000 Hz, mono, s16, 64 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #1:0 -> #0:1 (copy)
[segment @ 0x55949a3307c0] Opening '/record/DINING-ROOM-CAM/DINING-ROOM-CAM_2022-10-27_13-45-04_EDT.mp4' for writing
[mp4 @ 0x147b44001400] Could not find tag for codec pcm_mulaw in stream #1, codec not currently supported in container
[AVIOContext @ 0x147b44003380] Statistics: 0 bytes written, 0 seeks, 0 writeouts
2022/10/27 13:45:04 [RTSP][DINING-ROOM-CAM] ✅ '/dining-room-cam' stream is UP! (3/3)
[tee @ 0x55949a3b2680] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
[mulaw @ 0x55949a30b500] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
[tee @ 0x55949a3b2680] Slave muxer #1 failed: Invalid argument, continuing with 1/2 slaves.
2022/10/27 13:45:13 [WyzeBridge] 🎉 Connecting to WyzeCam V2 - living-room-cam on 192.168.107.21 (1/3)
2022/10/27 13:45:14 [Living Room Cam] IOTC_ER_DEVICE_OFFLINE
2022/10/27 13:45:15 [WyzeBridge] 👻 living-room-cam offline. WILL retry in 10s.
2022/10/27 13:45:19 [Dining Room Cam] WARNING: Frame not available yet
2022/10/27 13:45:25 [WyzeBridge] 🎉 Connecting to WyzeCam V2 - living-room-cam on 192.168.107.21 (1/3)
2022/10/27 13:45:26 [Living Room Cam] IOTC_ER_DEVICE_OFFLINE
2022/10/27 13:45:27 [WyzeBridge] 👻 living-room-cam offline. WILL retry in 10s.
2022/10/27 13:45:37 [WyzeBridge] 🎉 Connecting to WyzeCam V2 - living-room-cam on 192.168.107.21 (1/3)
2022/10/27 13:45:38 [Living Room Cam] IOTC_ER_DEVICE_OFFLINE
2022/10/27 13:45:38 [Dining Room Cam] WARNING: Audio pipe closed
No more output streams to write to, finishing.:16.20 bitrate=N/A speed=0.479x    
frame=  216 fps=6.3 q=-1.0 Lsize=N/A time=00:00:16.33 bitrate=N/A speed=0.48x    
video:1390kB audio:128kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Input file #0 (pipe:):
  Input stream #0:0 (video): 245 packets read (1542558 bytes); 
  Total: 245 packets (1542558 bytes) demuxed
Input file #1 (/tmp/dining-room-cam.wav):
  Input stream #1:0 (audio): 409 packets read (130880 bytes); 
  Total: 409 packets (130880 bytes) demuxed
Output file #0 ([f=rtsp:rtsp_transport=tcp:bsfs/v=dump_extra=freq=keyframe]rtsp://0.0.0.0:8554/dining-room-cam|[onfail=ignore:f=segment:segment_time=300:segment_atclocktime=1:segment_format=mp4:reset_timestamps=1:strftime=1:use_fifo=1]/record/DINING-ROOM-CAM/DINING-ROOM-CAM_%Y-%m-%d_%H-%M-%S_%Z.mp4):
  Output stream #0:0 (video): 216 packets muxed (1423008 bytes); 
  Output stream #0:1 (audio): 408 packets muxed (130560 bytes); 
  Total: 624 packets (1553568 bytes) muxed
[AVIOContext @ 0x55949a305bc0] Statistics: 1605454 bytes read, 0 seeks
[AVIOContext @ 0x55949a33eac0] Statistics: 130880 bytes read, 0 seeks
2022/10/27 13:45:38 [RTSP][DINING-ROOM-CAM] ❌ '/dining-room-cam' stream is down
2022/10/27 13:45:39 [WyzeBridge] 👻 living-room-cam offline. WILL retry in 10s.
2022/10/27 13:45:39 [Dining Room Cam] Stream did not receive a frame for over 20s
2022/10/27 13:45:40 [WyzeBridge] 🎉 Connecting to WyzeCam V2 - dining-room-cam on 192.168.107.20 (1/3)
2022/10/27 13:45:42 [Dining Room Cam] 📡 Getting 120kb/s HD stream (15fps) via LAN mode (WiFi: 82%) FW: 4.9.9.1433 🔒 (DTLS) (2/3)
2022/10/27 13:45:42 [Dining Room Cam] 🔊 Audio Enabled - MULAW/8,000Hz
2022/10/27 13:45:42 [Dining Room Cam] 📹 Will record 300s clips to /record/DINING-ROOM-CAM/
2022/10/27 13:45:42 [Dining Room Cam] [FFMPEG_CMD] ffmpeg -loglevel verbose -fflags +genpts+flush_packets+nobuffer+bitexact -flags +low_delay -thread_queue_size 64 -threads 1 -analyzeduration 50 -probesize 50 -f h264 -i pipe: -f mulaw -ar 8000 -i /tmp/dining-room-cam.wav -flags +global_header -c:v copy -c:a copy -movflags +empty_moov+default_base_moof+frag_keyframe -map 0:v -map 1:a -shortest -f tee [f=rtsp:rtsp_transport=tcp:bsfs/v=dump_extra=freq=keyframe]rtsp://0.0.0.0:8554/dining-room-cam|[onfail=ignore:f=segment:segment_time=300:segment_atclocktime=1:segment_format=mp4:reset_timestamps=1:strftime=1:use_fifo=1]/record/DINING-ROOM-CAM/DINING-ROOM-CAM_%Y-%m-%d_%H-%M-%S_%Z.mp4
ffmpeg version 5.0 Copyright (c) 2000-2022 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      57. 17.100 / 57. 17.100
  libavcodec     59. 18.100 / 59. 18.100
  libavformat    59. 16.100 / 59. 16.100
  libavdevice    59.  4.100 / 59.  4.100
  libavfilter     8. 24.100 /  8. 24.100
  libswscale      6.  4.100 /  6.  4.100
  libswresample   4.  3.100 /  4.  3.100
  libpostproc    56.  3.100 / 56.  3.100
[h264 @ 0x555e12506440] Reinit context to 1920x1088, pix_fmt: yuv420p
[h264 @ 0x555e124f4a40] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, h264, from 'pipe:':
  Duration: N/A, bitrate: N/A
  Stream #0:0: Video: h264 (Main), 1 reference frame, yuv420p(progressive, left), 1920x1080 (1920x1088), 15 tbr, 1200k tbn
Guessed Channel Layout for Input Stream #1.0 : mono
Input #1, mulaw, from '/tmp/dining-room-cam.wav':
  Duration: N/A, bitrate: 64 kb/s
  Stream #1:0: Audio: pcm_mulaw, 8000 Hz, mono, s16, 64 kb/s
[tcp @ 0x555e125b6c00] Starting connection attempt to 0.0.0.0 port 8554
[tcp @ 0x555e125b6c00] Successfully connected to 0.0.0.0 port 8554
[rtsp @ 0x555e125b7440] 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 59.16.100
m=video 0 RTP/AVP 96
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1; sprop-parameter-sets=Z01AKJ2oHgCJ+WEAAAMAAQAAAwAehA==,aO48gAA=; profile-level-id=4D4028
a=control:streamid=0
m=audio 0 RTP/AVP 0
b=AS:64
a=control:streamid=1

[tee @ 0x555e125b4600] filename:'rtsp://0.0.0.0:8554/dining-room-cam' format:rtsp
[tee @ 0x555e125b4600]     stream:0 codec:h264 type:video bsfs: AVBSFContext
[tee @ 0x555e125b4600]     stream:1 codec:pcm_mulaw type:audio bsfs: null
[tee @ 0x555e125b4600] filename:'/record/DINING-ROOM-CAM/DINING-ROOM-CAM_%Y-%m-%d_%H-%M-%S_%Z.mp4' format:fifo
[tee @ 0x555e125b4600]     stream:0 codec:h264 type:video bsfs: null
[tee @ 0x555e125b4600]     stream:1 codec:pcm_mulaw type:audio bsfs: null
Output #0, tee, to '[f=rtsp:rtsp_transport=tcp:bsfs/v=dump_extra=freq=keyframe]rtsp://0.0.0.0:8554/dining-room-cam|[onfail=ignore:f=segment:segment_time=300:segment_atclocktime=1:segment_format=mp4:reset_timestamps=1:strftime=1:use_fifo=1]/record/DINING-ROOM-CAM/DINING-ROOM-CAM_%Y-%m-%d_%H-%M-%S_%Z.mp4':
  Metadata:
    encoder         : Lavf59.16.100
  Stream #0:0: Video: h264 (Main), 1 reference frame, yuv420p(progressive, left), 1920x1080 (0x0), q=2-31, Selected stream id:0 type:video
15 tbr, 15 tbn
  Stream #0:1: Audio: pcm_mulaw, 8000 Hz, mono, s16, 64 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #1:0 -> #0:1 (copy)
[segment @ 0x555e12531580] Opening '/record/DINING-ROOM-CAM/DINING-ROOM-CAM_2022-10-27_13-45-44_EDT.mp4' for writing
[mp4 @ 0x14e9b0001400] Could not find tag for codec pcm_mulaw in stream #1, codec not currently supported in container
[AVIOContext @ 0x14e9b0003380] Statistics: 0 bytes written, 0 seeks, 0 writeouts
2022/10/27 13:45:44 [RTSP][DINING-ROOM-CAM] ✅ '/dining-room-cam' stream is UP! (3/3)
[tee @ 0x555e125b4600] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
[mulaw @ 0x555e1250b500] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
[tee @ 0x555e125b4600] Slave muxer #1 failed: Invalid argument, continuing with 1/2 slaves.
2022/10/27 13:45:49 [WyzeBridge] 🎉 Connecting to WyzeCam V2 - living-room-cam on 192.168.107.21 (1/3)
2022/10/27 13:45:50 [Living Room Cam] IOTC_ER_DEVICE_OFFLINE
2022/10/27 13:45:51 [WyzeBridge] 👻 living-room-cam offline. WILL retry in 10s.
2022/10/27 13:46:01 [WyzeBridge] 🎉 Connecting to WyzeCam V2 - living-room-cam on 192.168.107.21 (1/3)
2022/10/27 13:46:02 [Living Room Cam] IOTC_ER_DEVICE_OFFLINE
2022/10/27 13:46:03 [WyzeBridge] 👻 living-room-cam offline. WILL retry in 10s.
2022/10/27 13:46:13 [WyzeBridge] 🎉 Connecting to WyzeCam V2 - living-room-cam on 192.168.107.21 (1/3)
2022/10/27 13:46:14 [Living Room Cam] IOTC_ER_DEVICE_OFFLINE
2022/10/27 13:46:15 [WyzeBridge] 👻 living-room-cam offline. WILL retry in 10s.
2022/10/27 13:46:25 [WyzeBridge] 🎉 Connecting to WyzeCam V2 - living-room-cam on 192.168.107.21 (1/3)
2022/10/27 13:46:26 [Living Room Cam] IOTC_ER_DEVICE_OFFLINE
2022/10/27 13:46:27 [WyzeBridge] 👻 living-room-cam offline. WILL retry in 10s.
2022/10/27 13:46:33 [WyzeBridge] Stopping the cameras...
No more output streams to write to, finishing.:51.40 bitrate=N/A speed=1.05x    
frame=  747 fps= 15 q=-1.0 Lsize=N/A time=00:00:51.73 bitrate=N/A speed=1.04x    
video:4784kB audio:404kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Input file #0 (pipe:):
  Input stream #0:0 (video): 776 packets read (5056121 bytes); 
  Total: 776 packets (5056121 bytes) demuxed
Input file #1 (/tmp/dining-room-cam.wav):
  Input stream #1:0 (audio): 1294 packets read (414080 bytes); 
  Total: 1294 packets (414080 bytes) demuxed
Output file #0 ([f=rtsp:rtsp_transport=tcp:bsfs/v=dump_extra=freq=keyframe]rtsp://0.0.0.0:8554/dining-room-cam|[onfail=ignore:f=segment:segment_time=300:segment_atclocktime=1:segment_format=mp4:reset_timestamps=1:strftime=1:use_fifo=1]/record/DINING-ROOM-CAM/DINING-ROOM-CAM_%Y-%m-%d_%H-%M-%S_%Z.mp4):
  Output stream #0:0 (video): 747 packets muxed (4899244 bytes); 
  Output stream #0:1 (audio): 1293 packets muxed (413760 bytes); 
  Total: 2040 packets (5313004 bytes) muxed
[AVIOContext @ 0x555e12505bc0] Statistics: 5120740 bytes read, 0 seeks
[AVIOContext @ 0x555e12540280] Statistics: 418560 bytes read, 0 seeks
2022/10/27 13:46:34 [RTSP][DINING-ROOM-CAM] ❌ '/dining-room-cam' stream is down
2022/10/27 13:46:34 [Dining Room Cam] WARNING: Audio pipe closed
2022/10/27 13:46:34 [Dining Room Cam] Stream is down.
2022/10/27 13:46:34 [WyzeBridge] Stopping rtsp-simple-server...
2022/10/27 13:46:34 [WyzeBridge] 👋 goodbye!

And the files that were written to outside of the container:

root@Nas:/mnt/user/Wyze Recordings/DINING-ROOM-CAM# ls  -l
total 0
-rw-r--r-- 1 root root 0 Oct 27 13:45 DINING-ROOM-CAM_2022-10-27_13-45-04_EDT.mp4
-rw-r--r-- 1 root root 0 Oct 27 13:45 DINING-ROOM-CAM_2022-10-27_13-45-44_EDT.mp4
mrlt8 commented 2 years ago

Thank you! I was able to replicate the issue! I think it's related to the audio, so it is probably related to the firmware version after all!

The raw audio we're getting from the camera pcm_mulaw isn't supported in the mp4 container, so that's why it's failing to write the files. I think we'll either have to re-encode the audio or use another container like mov or mkv..

In the meantime, you can use AUDIO_CODEC=AAC which will force the bridge to re-encode the audio

edit: another option could be to strip out the audio when saving to mp4...

mrlt8 commented 2 years ago

@pldimarco v1.8.12 should use the mov container if the audio is PCM and mp4 if AAC. Could you see if this fixes the issue for you?

pd-448482 commented 2 years ago

@mrlt8 Tested docker-wyze-bridge with version v1.8.12 against two Wyze Cam V2s with latest firmware, 4.9.9.1472, and both are recording great. Thanks!