CCTVGDriveSync is a collection of shell scripts designed to facilitate the seamless synchronization of CCTV video footage with Google Drive using ffmpeg and rclone. This project ensures continuous recording, efficient storage management, and reliable cloud backup.
Make sure the following tools are installed on your system:
ffmpegrclonecurl
-
Clone the repository:
git clone https://github.com/your-username/CCTVGDriveSync.git cd CCTVGDriveSync -
Make the scripts executable:
chmod +x check_heartbeat.sh clean_drive.sh cleaner.sh record_front_door.sh sync_videos.sh
Ensure that your ffmpeg and rclone configurations are set up correctly. Update any necessary parameters in the scripts, such as RTSP stream details, file paths, and Google Drive paths. To configure you google drive account with rclone follow the steps in rclone document.
Configure the scripts as cron jobs to run every minute for continuous monitoring and synchronization.
* * * * * /path/to/CCTVGDriveSync/check_heartbeat.sh
* * * * * /path/to/CCTVGDriveSync/cleaner.sh
* * * * * /path/to/CCTVGDriveSync/record_front_door.sh
* * * * * /path/to/CCTVGDriveSync/sync_videos.sh
0 */10 * * * /path/to/CCTVGDriveSync/clean_drive.shThis script monitors the last update time of CCTV footage and triggers alerts if no updates occur within a specified timeframe.
Deletes old files from the Google Drive directory to maintain storage efficiency.
Cleans incomplete and older files from local storage, frees up disk space, and copies current footage to Google Drive.
Initiates continuous recording of the front door CCTV stream using ffmpeg and manages the synchronization process.
Ensures synchronized copying of recorded videos to Google Drive, preventing data loss.