Posts: 26
Joined: Wed Sep 11, 2013 1:26 pm
Location: NRW, Germany

recording length if powered down while recording

Sat Sep 14, 2013 10:47 pm


Today I got my camera board and started testing immediately.

My intention is to use it as a dashcam in my car. The plan is rather simple. On starting the car, the raspberry powers up and starts recording. Turning the car off will immediately shut down the raspberry.
And here's the problem.
I noticed, that when it is recording, and power is shut down, the actual saved data seems to be quantised in length.

If I record for less then 35 seconds, the resulting file is empty. Everything between 35 seconds and about 1:20 minute, will be 35 seconds long, disregarding everything after that mark. After that the limit seems to be at 1:20 min. So, worst case is I loose maybe half a minute of recording when I simply power off. I also tried it with -g 10, but it had no effect.

Can this be controlled? Or does it rather have to do with the way data is stored on the sd card? Could this be helped if it would save on usb rather than SD? It would be great if a power loss would not lose much data, or none at all.


Posts: 1337
Joined: Sat Dec 17, 2011 5:05 pm

Re: recording length if powered down while recording

Sun Sep 15, 2013 4:33 am

I'm sure there is a way but you might need to force flushing the data to disk... also the pi is good at corrupting sdcards so using an external disk or a small ups might be advisable... maybe just use the gpio to have the pi turn itself off when you turn off the car letting it use some car battary for a second or so.
SBC with 32GB RAM:



Posts: 62
Joined: Sat Jan 26, 2013 7:29 pm
Contact: Website

Re: recording length if powered down while recording

Mon Sep 16, 2013 2:55 pm

Depending on how serious of a project this was you could power the Pi from the accessory bus (which receives power when you turn the key to the first notch after off) and boot on the ignition signal (which gets power when the key is turned to the "on" position, where it usually is when the engine in running).
You could then use a GPIO pin to poll the ignition signal and when it detects the engine has stopped it will stop the video capture and shutdown the Pi.
I believe this should be possible but it has been a while since I looked at automotive electrics.

Return to “Camera board”