ep1cman / unifi-protect-backup

Python tool to backup unifi event clips in realtime
MIT License
635 stars 31 forks source link

sometimes videos are too short #14

Closed timotab closed 2 years ago

timotab commented 2 years ago

Description

video clips are sometimes shorter than expected (eg, vehicles already in frame at start of clip or still in frame at end of clip)

What I Did

Ran software, captured clips to AWS, downloaded clips, and viewed them.

Suggestion

Two separate options to allow specifying a length of time in seconds before and after the "standard" clip value that the Protect device reports. That way a user can adjust those values to suit their set up.

ep1cman commented 2 years ago

Can you compare such a clip as backup up by this tool, and the protect webui, or even better export the same clip from the web UI. I would like to know if both are the same or if indeed this script is not fetching correct clips.

If the unifi protect web UI is also producing clips with this issue then I think the best solution is to (as per your comment on reddit, which I will put here incase others search for this issue) adjust the settings for each camera in the unifi protect ui:

image
timotab commented 2 years ago

I've just taken a look. The clip I downloaded from the UI is considerably longer than the one I got from my backup. So it appears the API is not using those settings to inform about the right length of clip to export. That's annoying. :(

timotab commented 2 years ago

It would be nice to have this setting on a per-camera basis. Would it be better to put the info in a config file?

ep1cman commented 2 years ago

I have so far resisted the urge to use a configuration file. I would like to keep this tool quite simple and just serve as glue logic between rclone and unifi protect. I think I will do some investigations to see what the cause of these miss matches in length is so that the tool instead backs up the correct length of clips

ep1cman commented 2 years ago

In the examples where the clip from the UI is longer vs the clip from the tool. Can you tell which part its missing? e.g. the begining, end or both? and could you share your pre/post recording settings to go along with that. In the examples I am seeing it seems to be missing the end more so than the start

ep1cman commented 2 years ago

Hi, can you test v0.5.0 I have added two things:

  1. If ffprobe is present, it will now report the length of the clip that was downloaded, along with if it was longer/shorter than expected when run on verbosity level >= 1 (aka -v)
  2. It now delays downloading clips, this should help with clips being too short
timotab commented 2 years ago

I've installed 0.5.0 and will report back

timotab commented 2 years ago

I should add - also installed ffprobe and am running it on with -v

ep1cman commented 2 years ago

I've been running this for a while and have not seen any videos that are significantly too short (ive only seen clips missing 1 frame but very rarely). If this issue still occurs feel free to re-open with additional details