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

ffmpeg live doesn’t work only stills with Yi hack 6FUS #393

Closed Vannixxo closed 4 years ago

Vannixxo commented 4 years ago

Hello, anyone experiencing the same problem as me? I’m trying to use my Yi 1080p camera hacked with Roleo 6FUS YI HACK

The RTSP works flawlessly with VLC, it is using live555 library.

I’ve tried every setting, resolution, frame rate etc. Even "-rtsp_transport tcp"

ffmpeg instance starts correctly but then I get this from the log when requesting the live stream and in home app I get the red circle icon (so stream not working) and it streams for about 2 seconds then stops on a still frame (that slowly becomes clearly visible without artifacts)

LOG (this is an extract as it is very long):

[libx264 @ 0xb4df8500] frame=1223 QP=16.07 NAL=2 Slice:P Poc:446 I:3 P:154 SKIP:8003 size=867 bytes

[rtp @ 0xb4523030] Sending NAL 1 of len 195 M=0 [rtp @ 0xb4523030] Sending NAL 1 of len 207 M=0 [rtp @ 0xb4523030] Sending NAL 1 of len 331 M=0 [rtp @ 0xb4523030] Sending NAL 1 of len 121 M=1

[libx264 @ 0xb4df8500] frame=1224 QP=21.97 NAL=2 Slice:P Poc:448 I:314 P:3522 SKIP:4324 size=15908 bytes

[rtp @ 0xb4523030] Sending NAL 1 of len 2905 M=0 [rtp @ 0xb4523030] NAL size 2905 > 1290

[rtp @ 0xb4523030] Sending NAL 1 of len 5003 M=0 [rtp @ 0xb4523030] NAL size 5003 > 1290

[rtp @ 0xb4523030] Sending NAL 1 of len 4731 M=0 [rtp @ 0xb4523030] NAL size 4731 > 1290

[rtp @ 0xb4523030] Sending NAL 1 of len 3256 M=1 [rtp @ 0xb4523030] NAL size 3256 > 1290

frame= 1225 fps=6.0 q=25.0 Lsize= 1140kB time=00:00:42.43 bitrate= 220.1kbits/s dup=1175 drop=0 speed=0.208x video:1126kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.247702% Input file #0 (rtsp://user:psw@192.168.1.......:554/ch0_0.h264): Input stream #0:0 (video): 116 packets read (772670 bytes); 51 frames decoded ; Total: 116 packets (772670 bytes) demuxed Output file #0 (srtp://192.168.1.101:64070?rtcpport=64070&localrtcpport=64070&pkt_size=1316): Output stream #0:0 (video): 1225 frames encoded; 1225 packets muxed (1153160 bytes); Total: 1225 packets (1153160 bytes) muxed

51 frames successfully decoded, 0 decoding errors

[AVIOContext @ 0xb48a1bc0] Statistics: 0 seeks, 1560 writeouts

[libx264 @ 0xb4df8500] frame I:5 Avg QP:35.08 size: 25381 [libx264 @ 0xb4df8500] frame P:1220 Avg QP:22.90 size: 841

[libx264 @ 0xb4df8500] mb I I16..4: 33.6% 57.2% 9.2% [libx264 @ 0xb4df8500] mb P I16..4: 0.1% 0.1% 0.0% P16..4: 1.7% 0.2% 0.2% 0.0% 0.0% skip:97.7% [libx264 @ 0xb4df8500] 8x8 transform intra:55.6% inter:61.4% [libx264 @ 0xb4df8500] coded y,uvDC,uvAC intra: 18.4% 28.7% 1.0% inter: 0.4% 0.9% 0.0% [libx264 @ 0xb4df8500] i16 v,h,dc,p: 31% 35% 13% 21% [libx264 @ 0xb4df8500] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 16% 50% 1% 1% 1% 1% 1% 1% [libx264 @ 0xb4df8500] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 35% 33% 15% 3% 2% 3% 4% 2% 4%

[libx264 @ 0xb4df8500] i8c dc,h,v,p: 74% 14% 11% 1% [libx264 @ 0xb4df8500] Weighted P-Frames: Y:0.0% UV:0.0% [libx264 @ 0xb4df8500] ref P L0: 90.2% 5.3% 3.3% 1.2% [libx264 @ 0xb4df8500] kb/s:225.93

Exiting normally, received signal 15.

Vannixxo commented 4 years ago

No one has my problem?

gadget-monk commented 4 years ago

hi! I was able to get it to work. I am using Homebridge on a raspberry PI with a Yi Dome camera with Roleo's firmware. I set video codec to "copy" source is "-re -i rtsp://CAM_IP/ch0_0.h264" and still image source is "-i http://CAM_IP:8080/cgi-bin/snapshot.sh"

Vannixxo commented 4 years ago

hi! I was able to get it to work. I am using Homebridge on a raspberry PI with a Yi Dome camera with Roleo's firmware. I set video codec to "copy" source is "-re -i rtsp://CAM_IP/ch0_0.h264" and still image source is "-i http://CAM_IP:8080/cgi-bin/snapshot.sh"

Best new year gift! Thanks! It works flawlessly now, and much much better thank stock YI cloud app streaming!

So I don't get why other users are using omxh264 or other video codecs when the YI hack is already passing an H264 stream to homebridge... If a cam rtsp stream is already in h264, shouldn't alway be "copy" the best video codec settings? So ffmpeg doesn't have to decode/rencode anything?

gadget-monk commented 4 years ago

Glad you got it to work. I think the "normal" config is to reencode with ffmpeg so you can change the frame rate, resolution, etc. If you use copy, you can't change any of the video parameters from source.

Vannixxo commented 4 years ago

Glad you got it to work. I think the "normal" config is to reencode with ffmpeg so you can change the frame rate, resolution, etc. If you use copy, you can't change any of the video parameters from source.

Okay, maybe not every other camera RTSP is working this well without re-encoding so... and ffmpeg action is needed. In this case, is still strange that ffmpeg cannot process correctly the roleo live555 rtsp stream

github-actions[bot] commented 4 years 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.