frigate icon indicating copy to clipboard operation
frigate copied to clipboard

UTC Time for file management.

Open mattthewclayton opened this issue 3 years ago • 6 comments

Use UTC time for file management to avoid issues around daylights saving time.

I found out that there is a way for ffmpeg to output filenames based on UTC. Updated the code to parse these correctly and then force UTC time where required.

I decided to add ".utc." to the output filenames to side step an issue where on first update with this change some users (if they are ahead of UTC) will miss 1+ hours of recordings due to possible clash of output file names. There might be a nicer solution, I didn't think too hard about this.

I also figured exc_info=True would be useful for debugging future issues with recordings.

There is a work around for this: just set the timezone of your machine to UTC, but this may not be possible/sensible for everyone and it would mean that debug logs would be in UTC which might actually confuse trying to debug issues.

mattthewclayton avatar Nov 10 '21 14:11 mattthewclayton

This should work. I was considering just using epochs in the file names instead and re-evaluating the folder structure, but this may be better. I think I will save this for 0.11.

Also, thanks a ton for your recent assistance in troubleshooting issues here. It is getting difficult to respond to issues and continue to make progress on new features.

blakeblackshear avatar Nov 11 '21 13:11 blakeblackshear

No worries. Truth be told I wrote my own version of this project (with no front end) but using the Intel NCS2 to accelerate I just never got to a point where it was good enough to share - But then I found Frigate and it's incredibly impressive, I will continue to help improve it. I don't know how I didn't find it earlier, I looked around for similar solutions before I started on my own.

On that note, I was running with 0.10 branch just to check out the stationary object stuff, I am sure there is more work to do but I found a few issues and didn't know how/where to raise them because the PR is locked. Let me know where best to share my feedback.

mattthewclayton avatar Nov 11 '21 15:11 mattthewclayton

I will unlock the PR

blakeblackshear avatar Nov 11 '21 15:11 blakeblackshear

Have a a regarding time stamp processing. Gstreamer splitmux does not have functionality to put a time stamp or date time into the file name itself. How bad would be to read file last modified date and subtract the known length of the chunk to get the actual time stamp?

yury-sannikov avatar Jan 16 '22 06:01 yury-sannikov

Have a a regarding time stamp processing. Gstreamer splitmux does not have functionality to put a time stamp or date time into the file name itself. How bad would be to read file last modified date and subtract the known length of the chunk to get the actual time stamp?

You would want the file creation date. I'm guessing it will be the same. It would probably be best to use the same approach regardless of whether it was ffmpeg or gstreamer.

blakeblackshear avatar Jan 16 '22 13:01 blakeblackshear

Please open a new PR to release-0.11.0.

blakeblackshear avatar Feb 19 '22 04:02 blakeblackshear