What’s the best way to store the dash cam footage?

As I get ready to add a USB webcam to the Pi to use as a dash camera I have to ask: How should the dash camera recording be stored? The textbook definition of recording for a dash camera is to overwrite the oldest footage as storage space fills up. That way you get continuous recording while keeping the storage maxed out. In the Pi’s case, I’ve got ‘motion’ running continuously while a cron job deletes the oldest video in order to keep the SD card from filling up. The cron job removes video files based on last modified time. This is easy for a home security situation where the recording is constant so you can do the math to predict growth and determine hold far back in modified time from current time you need to delete files. But with a car, you might have a lot of video in a few days or none.

The next level in complexity for managing disk usage is to have a daemon running that continuously checks the amount of free disk space and appropriately removes the oldest files until the target amount of free space is reached. For example:

SD card = 16 GB
Free space after installing OS and needed software = 14 GB
Free space to maintain for OS and other tasks = 1 GB

That means we’re allowing ourselves 13 GB of space for videos. A daemon would check any time there’s less than 1 GB of free space and delete the oldest video file until that 1 GB is available.

Archiving dash camera footage permanently

The simple solution is to keep dash cam footage on the Pi. Ideally I’d like it if footage could be synced to the cloud service at www.blackboxpi.com for archival. The existing syncing daemon that syncs GPS data could also sync video files. But the daemon syncs data by grabbing local DB data via SQL and uploading it via a web API. For file upload and sync we’ll need something else. BTSync is great, but we can also use FTP or something more custom.  Is this feasible? Disk usage can grow outlandishly. Plus you’d have to take the Pi inside and plug it into a network cable (or use a USB wifi adapter to make it easier). Then the sync happens in the background.

For retrieval, users could enter their API key and gets a listing of video files to download. Archive can go back X days depending on available resources. Maybe a premium feature is to go back further?

This will only make sense if user syncs before the Pi fills up and starts overwriting old files. Otherwise you’re only getting what’s on the Pi at that moment. That might still be helpful if something happened that the user wants to store online.


There are a few different directions I can take the dash camera functionality next. I’ll start with keeping it on the Pi and consider upgrading to allow for syncing to the website for long term archival. How would you like dash camera footage stored? Do you want to keep it archived for long term storage? Or is it enough to keep it on the Pi for access as needed if anything happens during your drive?

2 thoughts on “What’s the best way to store the dash cam footage?”

  1. don’t use the install sd card for ur data or u will kill it with read/writing. instaed u should use a usb device. An actual hdd would be best but of course a carputer needs to be able to take some wild bumps And platters don’t like bouncing. This leaves u with option of USB stick which will also die from read/writing data slowly but is not holding the OS

    1. Thanks, and I’m paying attention to SD card activity to see if it fails me. So far it hasn’t. There are so many variations of SD cards that it makes it impossible to tell which will fail long term and which won’t. So far, no problems.

Leave a Reply

Your email address will not be published. Required fields are marked *