connervieira/Predator

File Segmentation

Closed this issue · 3 comments

4g69 commented

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"

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.

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.

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.