Skip to content
Q-engineering edited this page Mar 9, 2022 · 1 revision

Overlay

As is known, an SD card will wear out over time. Especially when it's written on.
If you start recording events on your SD card, you not only run the risk of running out of space, but your SD card will wear out very quickly due to the constant writing.

Don't be surprised if your app stops working after a few months due to SD corruption.

Uploading the recordings to Gdrive does not help. You still have to write them to SD first before uploading them.
Streaming directly to GDrive would be an option, but Google Drive does not support such a feature.

It is better to use a USB memory stick. As the app starts, it checks the USB ports for memory. If available, the app will use the USB device. Still, you have the option to upload and then delete recordings, which limits USB usage. The USB solution will definitely reduce the number of writes to your SD card, extending its lifespan.

Best to use the overlay feature on the Raspberry Pi.

All reads are still from the SD card. All writes are redirected to RAM. You still have the same directory structure, but are now in RAM.
You'll never write a byte to your SD card again. (In theory - for the purists). Your SD card will now last for many years.
Use the menu option Performance in the Raspberry Pi Configuration to enable the overlay feature:

output image

To remove the overlay, reverse the procedure.

Two remarks.
Make sure you have enough RAM for recording. Use $free -m to check the available space. As a rule of thumb, 1 minute of mp4 takes about 4 to 6 MB.
The program doesn't check the memory before storing a recording; it just starts. In the worst case, your app will crash. It is more likely the case with the RPi Zero 2 with its 512 MB than with an RPi 4 with 8 GB of RAM.

When you start programming, remove the overlay beforehand! Otherwise, you will generate new code that will work fine as long as the power remains.
After a reboot, you lose all the hard work. Speaking from experience!

More information on our website

Clone this wiki locally