Sunoo / homebridge-camera-ffmpeg

Homebridge Plugin Providing FFmpeg-based Camera Support
https://sunoo.github.io/homebridge-camera-ffmpeg/
Apache License 2.0
1.08k stars 225 forks source link

[docker-wyze-bridge] RTSP feed will grab snapshot but not show video #1168

Closed RUHavingFun closed 3 years ago

RUHavingFun commented 3 years ago

Describe The Problem:

I have an RTSP feed from [docker-wyze-bridge]. I can view feed in VLC and LiveCams Pro on iPhone. FFmpeg seems to connect and get info, it can even get a snapshot. But the video feed does not display. Only issue I clearly see in logs is:

"[warning] attempted to set receive buffer to size 393216 but it only ended up set as 360448

To Reproduce:

You would have to setup a Wyze camera and connect [docker-wyze-bridge] to create a feed. The feed is currently in SD to try and make sure it was not a size or dimensions problem.

Logs:

Show the Homebridge logs here.

8/6/2021, 2:10:15 PM [Camera FFmpeg] [CAM Front] Snapshot requested: 1280 x 720
8/6/2021, 2:10:19 PM [Camera FFmpeg] [CAM Front] Fetching snapshot took 3.411 seconds.
8/6/2021, 2:10:19 PM [Camera FFmpeg] [CAM Front] Sending snapshot: 1280 x 720
8/6/2021, 2:10:19 PM [Camera FFmpeg] [CAM Front] Video stream requested: 1280 x 720, 30 fps, 299 kbps
8/6/2021, 2:10:19 PM [Camera FFmpeg] [CAM Front] Starting video stream: native x native, native fps, 299 kbps
8/6/2021, 2:10:19 PM [Camera FFmpeg] [CAM Front] [info] ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
8/6/2021, 2:10:19 PM [Camera FFmpeg] [CAM Front] [info]   built with gcc 6.3.0 (Raspbian 6.3.0-18+rpi1+deb9u1) 20170516
8/6/2021, 2:10:19 PM [Camera FFmpeg] [CAM Front] [info]   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-omx-rpi --enable-mmal --enable-indev=alsa --enable-outdev=alsa
8/6/2021, 2:10:19 PM [Camera FFmpeg] [CAM Front] [info]   libavutil      56. 51.100 / 56. 51.100
8/6/2021, 2:10:19 PM [Camera FFmpeg] [CAM Front] [info]   libavcodec     58. 91.100 / 58. 91.100
8/6/2021, 2:10:19 PM [Camera FFmpeg] [CAM Front] [info]   libavformat    58. 45.100 / 58. 45.100
8/6/2021, 2:10:19 PM [Camera FFmpeg] [CAM Front] [info]   libavdevice    58. 10.100 / 58. 10.100
8/6/2021, 2:10:19 PM [Camera FFmpeg] [CAM Front] [info]   libavfilter     7. 85.100 /  7. 85.100
8/6/2021, 2:10:19 PM [Camera FFmpeg] [CAM Front] [info]   libswscale      5.  7.100 /  5.  7.100
8/6/2021, 2:10:19 PM [Camera FFmpeg] [CAM Front] [info]   libswresample   3.  7.100 /  3.  7.100
8/6/2021, 2:10:19 PM [Camera FFmpeg] [CAM Front] [info]   libpostproc    55.  7.100 / 55.  7.100
8/6/2021, 2:10:19 PM [Camera FFmpeg] [CAM Front] [tcp @ 0x44e4940] [verbose] Starting connection attempt to 192.168.1.167 port 8554
8/6/2021, 2:10:19 PM [Camera FFmpeg] [CAM Front] [tcp @ 0x44e4940] [verbose] Successfully connected to 192.168.1.167 port 8554
8/6/2021, 2:10:19 PM [Camera FFmpeg] [CAM Front] [rtsp @ 0x44e2a10] [verbose] SDP:
8/6/2021, 2:10:19 PM [Camera FFmpeg] [CAM Front] v=0
8/6/2021, 2:10:19 PM [Camera FFmpeg] [CAM Front] o=- 0 0 IN IP4 127.0.0.1
8/6/2021, 2:10:19 PM [Camera FFmpeg] [CAM Front] s=Stream
8/6/2021, 2:10:19 PM [Camera FFmpeg] [CAM Front] c=IN IP4 0.0.0.0
8/6/2021, 2:10:20 PM [Camera FFmpeg] [CAM Front] t=0 0
8/6/2021, 2:10:20 PM [Camera FFmpeg] [CAM Front] m=video 0 RTP/AVP 96
8/6/2021, 2:10:20 PM [Camera FFmpeg] [CAM Front] a=rtpmap:96 H264/90000
8/6/2021, 2:10:20 PM [Camera FFmpeg] [CAM Front] a=fmtp:96 packetization-mode=1; sprop-parameter-sets=J00AMudAUBf8s1AQEB8AAAMAAQAAAwAoNGAE4gB1N//wKA==,KO48gAA=; profile-level-id=4D0032
8/6/2021, 2:10:20 PM [Camera FFmpeg] [CAM Front] a=control:trackID=0
8/6/2021, 2:10:20 PM [Camera FFmpeg] [CAM Front] 
8/6/2021, 2:10:20 PM [Camera FFmpeg] [CAM Front] [udp @ 0x44e76b0] [warning] attempted to set receive buffer to size 393216 but it only ended up set as 360448
8/6/2021, 2:10:20 PM [Camera FFmpeg] [CAM Front] [udp @ 0x44f7a10] [warning] attempted to set receive buffer to size 393216 but it only ended up set as 360448
8/6/2021, 2:10:20 PM [Camera FFmpeg] [CAM Front] [rtsp @ 0x44e2a10] [verbose] setting jitter buffer size to 500
8/6/2021, 2:10:20 PM [Camera FFmpeg] [CAM Front] [h264 @ 0x44e6b10] [verbose] Reinit context to 640x368, pix_fmt: yuv420p
8/6/2021, 2:10:22 PM [Camera FFmpeg] [CAM Front] [info] Input #0, rtsp, from 'rtsp://cams.local:8554/cam-front':
8/6/2021, 2:10:22 PM [Camera FFmpeg] [CAM Front] [info]   Metadata:
8/6/2021, 2:10:22 PM [Camera FFmpeg] [CAM Front] [info]     title           : Stream
8/6/2021, 2:10:22 PM [Camera FFmpeg] [CAM Front] [info]   Duration: N/A, start: 0.457422, bitrate: N/A
8/6/2021, 2:10:22 PM [Camera FFmpeg] [CAM Front] [info]     Stream #0:0: Video: h264 (Main), 1 reference frame, yuv420p(tv, bt709, progressive, left), 640x360 (640x368), 20 fps, 20 tbr, 90k tbn, 40 tbc
8/6/2021, 2:10:22 PM [Camera FFmpeg] [CAM Front] [info] Stream mapping:
8/6/2021, 2:10:22 PM [Camera FFmpeg] [CAM Front] [info]   Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
8/6/2021, 2:10:22 PM [Camera FFmpeg] [CAM Front] [info] Press [q] to stop, [?] for help
8/6/2021, 2:10:22 PM [Camera FFmpeg] [CAM Front] [h264 @ 0x45b0470] [verbose] Reinit context to 640x368, pix_fmt: yuv420p
8/6/2021, 2:10:23 PM [Camera FFmpeg] [CAM Front] [info] frame=    0 fps=0.0 q=0.0 size=       0kB time=-577014:32:22.77 bitrate=  -0.0kbits/s speed=N/A    
8/6/2021, 2:10:23 PM [Camera FFmpeg] [CAM Front] [graph 0 input from stream 0:0 @ 0x4590e60] [verbose] w:640 h:360 pixfmt:yuv420p tb:1/90000 fr:20/1 sar:0/1
8/6/2021, 2:10:23 PM [Camera FFmpeg] [CAM Front] FFmpeg exited with code: null and signal: SIGILL (Unexpected)
8/6/2021, 2:10:49 PM [Camera FFmpeg] [CAM Front] Stopped video stream.

Remove any sensitive information.

Homebridge Config:

Show your homebridge config.json here.

        "name": "CAM Front",
        "videoConfig": {
            "source": "-i rtsp://cams.local:8554/cam-front",
            "maxStreams": 2,
            "maxWidth": 0,
            "maxHeight": 0,
            "maxFPS": 0,
            "audio": false,
            "debug": true

Remove any sensitive information, such as your homebridge-gsh / google-smarthome token.

Screenshots:

Environment:

Sunoo commented 3 years ago

Are you using a Raspberry Pi Zero by any chance?

You can try setting vcodec to copy and seeing if that helps.

RUHavingFun commented 3 years ago

That did it! I had actually removed that from old config for older cams. I thought Copy was the default. Not sure what Copy truly means - other than use what is sent.

I am using a Pi Zero. You think I need to move to a more powerful Pi with more memory?

Sunoo commented 3 years ago

The Zero is pretty underpowered for handling video, but if it’s working for you, no real reason to switch.

The reason I thought it was a Zero was the SIGILL error is something I see rarely, but only on that model of Pi. I’ve never been able to reproduce it myself though, so I really have no idea what causes it. Copy typically still works when it happens.

As for why copy isn’t default, it’s less compatible, as certain cameras send streams that HomeKit apparently can’t handle. I try to keep the defaults as likely to work out of the box as possible.

RUHavingFun commented 3 years ago

Thanks for the info and super quick help. I may move to a better Pi, I was not doing much video for a while. I am seeing spikes to 100% more now.

Sunoo commented 3 years ago

Yea, video (even with the copy codec) takes a bit of grunt.