bropat / ioBroker.eusec

This ioBroker adapter allows to control Eufy security devices by connecting to the Eufy cloud servers.
MIT License
132 stars 17 forks source link

ffmpeg fails on event video #140

Closed anarchocactus closed 2 years ago

anarchocactus commented 3 years ago

Describe the bug
ffmeg fails on video for event:

eufy-security.0 | 2021-06-20 06:00:56.295 | error | - Cancelling download...
eufy-security.0 | 2021-06-20 06:00:56.295 | error | (22107) Station: T8010N231949122D channel: 0 - Error: Error: ffmpeg    exited with code 1: unix:/tmp/eufy-security.0.2.sock: End of file
eufy-security.0 | 2021-06-20 06:00:56.295 | error | unix:/tmp/eufy-security.0.2.sock: End of file

To Reproduce
Steps to reproduce the behavior:

  1. trigger movement event on eufyCam 2C
  2. observe the logs

Expected behavior
The video should be downloaded and encoded correctly

Screenshots & Logfiles
eufylog.txt

Versions:

Additional context
I stumbled upon this while testing the datapoints last_event_pic_url/html. In my case they only got updated when polling the cloud e.g. after restarting the adapter. No idea why it's working on polling. I had the impression that the last_event_pic is generated by processing the downloaded event video through ffmpeg, but I may be on the wrong track. The problem also exists when the adapter has direct access to the station.

I am not really sure if ffmeg might just fail due to missing data

bropat commented 3 years ago

The latest p2p livestream fixes caused a regression in p2p video download. This needs to be fixed.

bropat commented 3 years ago

@anarchocactus Fixed in version 0.6.0. Please test it and let me know.

anarchocactus commented 3 years ago

The last_eventpic* datapoints now appear to get updated correctly and fast, not only on polling or restart. So this is fixed and great for eventually having real fast updates of the camera snapshots in our visualisations when motion was detected.

When writing the ticket I had the misconception that the the last_eventpic* datapoints need a full download of the event video to be updated but that somehow appears to happen before the video actually gets fully downloaded from what I can see in the logs. No idea how it really works behind the scene, but the timeline is essentially like that:


2021-08-14 10:28:30.252  - info: eufy-security.0 (25323) Downloading video event for device T8113N1319521F10 in 19.388 seconds...

[...]

2021-08-14 10:28:30.741  - debug: eufy-security.0 (25323) [EufySecurity.onStateChange] state eufy-security.0.T8010N231949122D.cameras.T8113N1319521F10.picture_url changed: https://security-app-eu.eufylife.com/v1/s/g/vEkcgcfDd (ack = true) was already acknowledged, ignore it...
2021-08-14 10:28:30.971  - debug: eufy-security.0 (25323) [EufySecurity.onStateChange] state eufy-security.0.T8010N231949122D.cameras.T8113N1319521F10.last_event_pic_url changed: /eufy-security.0/T8010N231949122D/last_event/T8113N1319521F10.jpeg (ack = true) was already acknowledged, ignore it...
2021-08-14 10:28:30.971  - debug: eufy-security.0 (25323) [EufySecurity.onStateChange] state eufy-security.0.T8010N231949122D.cameras.T8113N1319521F10.last_event_pic_html changed: [...]

[...]

2021-08-14 10:28:49.759  - debug: eufy-security.0 (25323) [Station.startDownload] P2P connection to station T8010N231949122D present, download video path: /media/mmcblk0p1/Camera00/20210814102827.dat

After the video got downloaded, I still get an ffmpeg error:

021-08-14 10:28:55.910  - debug: eufy-security.0 (25323) [P2PClientProtocol.handleDataControl] Station T8010N231949122D - CMD_DOWNLOAD_FINISH [{"channel":0}]
2021-08-14 10:28:55.911  - debug: eufy-security.0 (25323) [P2PClientProtocol.handleMsg] Station T8010N231949122D - DATA CONTROL - Received expected sequence (seqNo: 31 queuedData.size: 0)
2021-08-14 10:28:55.917  - debug: eufy-security.0 (25323) [FfmpegCommand] ffmpegStreamToHls(): Processing finished!
2021-08-14 10:28:55.928  - debug: eufy-security.0 (25323) [EufySecurity.onStateChange] state eufy-security.0.T8010N231949122D.cameras.T8113N1319521F10.last_event_video_url changed: /eufy-security.0/T8010N231949122D/last_event/T8113N1319521F10.m3u8 (ack = true) was already acknowledged, ignore it...
2021-08-14 10:28:55.959  - error: eufy-security.0 (25323) ffmpegPreviewImage(): An error occurred: ffmpeg exited with code 1: Output #0, image2, to '/opt/iobroker/iobroker-data/eufy-security.0/T8010N231949122D/last_event/T8113N1319521F10.jpeg':
Output file #0 does not contain any stream

2021-08-14 10:28:55.959  - error: eufy-security.0 (25323) ffmpegPreviewImage(): ffmpeg output:

2021-08-14 10:28:55.959  - error: eufy-security.0 (25323) ffmpegPreviewImage(): ffmpeg stderr:
ffmpeg version 4.4-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 8 (Debian 8.3.0-6)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
[hls @ 0x5cc9880] Skip ('#EXT-X-VERSION:3')
[hls @ 0x5cc9880] Cannot get correct #EXTINF value of segment /opt/iobroker/iobroker-data/eufy-security.0/T8010N231949122D/last_event/T8113N1319521F100.ts, set to default value to 1ms.
[hls @ 0x5cc9880] Opening '/opt/iobroker/iobroker-data/eufy-security.0/T8010N231949122D/last_event/T8113N1319521F100.ts' for reading
[aac @ 0x5cd7540] More than one AAC RDB per ADTS frame is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[aac @ 0x5cd7540] Sample rate index in program config element does not match the sample rate index configured by the container.
[aac @ 0x5cd7540] Inconsistent channel configuration.
[aac @ 0x5cd7540] get_buffer() failed
[aac @ 0x5cd7540] Number of bands (14) exceeds limit (4).
[aac @ 0x5cd7540] channel element 1.14 is not allocated
[aac @ 0x5cd7540] Multiple frames in a packet.
[aac @ 0x5cd7540] Sample rate index in program config element does not match the sample rate index configured by the container.
[aac @ 0x5cd7540] Inconsistent channel configuration.
[aac @ 0x5cd7540] get_buffer() failed
[aac @ 0x5cd7540] channel element 1.14 is not allocated
[aac @ 0x5cd7540] channel element 3.7 is not allocated
[hls @ 0x5cc9880] decoding for stream 1 failed
[hls @ 0x5cc9880] Could not find codec parameters for stream 0 (Video: h264 ([27][0][0][0] / 0x001B), none): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[hls @ 0x5cc9880] Could not find codec parameters for stream 1 (Audio: aac (SSR) ([15][0][0][0] / 0x000F), stereo, fltp): unspecified sample rate
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, hls, from '/opt/iobroker/iobroker-data/eufy-security.0/T8010N231949122D/last_event/T8113N1319521F10.m3u8':
  Duration: 00:00:00.00, start: 1.400000, bitrate: 1232 kb/s
  Program 0 
    Metadata:
      variant_bitrate : 0
  Stream #0:0: Video: h264 ([27][0][0][0] / 0x001B), none, 90k tbr, 90k tbn, 180k tbc
    Metadata:
      variant_bitrate : 0
  Stream #0:1: Audio: aac (SSR) ([15][0][0][0] / 0x000F), stereo, fltp
    Metadata:
      variant_bitrate : 0
Output #0, image2, to '/opt/iobroker/iobroker-data/eufy-security.0/T8010N231949122D/last_event/T8113N1319521F10.jpeg':
Output file #0 does not contain any stream

2021-08-14 10:28:55.960  - error: eufy-security.0 (25323) ffmpegPreviewImage - station: T8010N231949122D device: T8113N1319521F10 - Error [{}]
bropat commented 3 years ago

@anarchocactus Please test version 0.6.1 and let me know.