DashCam based on a raspberry PI

This is a project of mine that is meant to replace the standard dashcam that i am using on my bike with a Raspberry PI based cam.
The goal is to create a camera that will record my ride, nothing fancy so far, not for a high quality footage meanwhile,
just a cam that produces videos to be later used mainly to clean yourself in court if a bad cop says you didn’t stop at the STOP sign when you completely did stop.
on a later versions the functionality will expand, and GPS module and additional camera (rear) will be added.

Prerequisites:
Raspberry PI 3 B+
PiCamera V1.3
USB 16GB where the OS will be installed
another USB to be the location where the videos are stored
PowerBank

1. install ‘Raspbian Scretch’ as an OS.
     for detailed explanation refer here: https://www.raspberrypi.org/documentation/installation/installing-images/
2. Connect and enable the camera module.
     for detailed explanation refer here:
 https://projects.raspberrypi.org/en/projects/getting-started-with-picamera
3. Create a configuration file to be referred by the camera components.
     this is an example of a config file: https://github.com/EliBukin/dash_cam_1.8.2/blob/master/dc.config
     here the other scripts will refer for information, it’s better that way, you don’t need to hardcode stuff into the scripts.

4. Write the main camera loop.

     I decided to write the main thread in python, no special reason, i could use the native API (raspivid) as well,
     you can take a look here: https://github.com/EliBukin/dash_cam_1.8.2/blob/master/bin/start_video_recording.py
     All you need to do is start a sequential video recording, set framerate, resolution and stabilization (this i think is a blof, same results as without), as well as the destination
     and naming format for the videos.
     as you can see i set the loop to run 1111 times, this non realistic value makes sure that the loop will run enough time.

5. Write a mechanism that will allow the destination hold the latest videos.

     In this script i am defining a folder to be “watched” and once the size cross certain percentage of the hole drive the script will delete the oldest file/files,
     if the destination is on a dedicated drive (not on the OS drive) so i guess you could set the limit to 95%.
     here, take a look here: https://github.com/EliBukin/dash_cam_1.8.2/blob/master/bin/limit_folder_size.sh
          Line 15: folder to limit, this is the destination folder that we chose.
          line 23: the percentage of watched folder out of the hole drive.
          Line 55: the number of files to delete every run.
     all values are read from the configuration file we talked about on third step.

6. Write a file that will call main and deleting scripts.

     With this file we call the other ones, and this file we will call from the crontab job.
     https://github.com/EliBukin/dash_cam_1.8.2/blob/master/start_dc.sh
     Line 3-4: get the path of the connected USB drive to be used as destination.
     Line 7-13: set the path on config file as a variable.
     Line 16-19: allow the access to config file and call the main thread and the limit script.

7. Add a crontab job that will start the camera on startup.

     Connect to the PI, VNC or SSH doesn’t matter,
     and set a crontab job to run the initial script (start_dc) to execute whenever the PI starts, you could use mine idea of the structure of the app for paths.