connervieira / Predator

A multi-purpose camera system focused on offline license plate and object recognition
https://v0lttech.com/predator.php
GNU Affero General Public License v3.0
104 stars 14 forks source link

File Segmentation #2

Closed 4g69 closed 1 year ago

4g69 commented 1 year ago

Feature Description: Ability to save videos in multiple segments.

Usage: I've been using Predator in headless dashcam mode, and wanted to organize and parse through footage easier. Additionally, file segments can reduce risk of corrupting an entire driving session in case of power loss/overheating/storage unmounting unexpectedly.

ffmpeg allows for file segmentation. I added the following to main.py, right after dashcam_device[device], on line 1641: "-f","segment", "-segment_time", "30", "-reset_timestamps", "1", I have a short commute, so I chose 30 second segments. Setting -reset_timestamps to 1 allows each segment to reset the timer.

I also appended the file extension to enable saving the segments in sequence: "_%03d.mkv"

connervieira commented 1 year ago

This is a really useful feature. I've actually been considering adding it for a while, but I just never got around to it. I'll add some configuration options for it before the official release.

connervieira commented 1 year ago

I've just published a commit that should add this functionality, along with a corresponding configuration value.

Unfortunately, I don't have any cameras on me to test, so let me know if you run into any problems.

connervieira commented 1 year ago

I just made pretty significant changes to the dashcam recording process, and thought I'd post an update. Dashcam recording is now launched from a function found in utils.py. Dashcam video segmentation is a part of this function, and it seemed to work properly in my testing.

When the segment length is set to 0 (or lower) in the configuration, segmentation is disabled.