2

I'm wanting to use my Pi as a dashcam and I'll have it set ffmpeg to make mpeg4 recordings. On the Motion website here they describe you being able to generate mpeg films "On the fly." I have done tests where i cut the Pi's power as its recording to simulate a "car crash" or the car stalling(with no UPS). I assumed that the recording that was happening as the Pi lost it's power would be saved up to the point where it lost power but the file was 0kb with no recording at all. I'm stuck here and have messed around with lots of settings trying to get this working. I need this to work "On the fly" because I'm planning to use one of these as a security camera and if someone was to cut the power supply cable I wouldn't get a video of the person. A UPS isn't an option as this has to be as tiny as possible(half the reason why I use the tiny Raspberry Pi Camera Board)

  • For a second I thought you were trying to run Apple Motion on the RPi! :) – AwesomeUser Apr 22 '14 at 21:30
2

First I recommend recording all time (not motion only) while You are driving. Second, it is important where Your raspberry pi is placed. If it is attached to a window, so that if the car crashes, Your PI can just fly somewhere (And cables may unplug automatically). If you want to be safer, You need an additional battery for PI (this means that You need some charging circuit). And also place PI in a safe place (behind radio ?)

Edit: Motion can save some frames before, when motion is detected. See pre_capture

P.S. sorry for bad English.

  • I'm not looking for a work-around for this issue. This issue also applies for if I was using it as a security camera and someone was to cut the power supply cable. – 11chubby11 Nov 6 '13 at 23:31
  • @11chubby11, You can record all the time and split recorded videos with ffmpeg segments. Look here also. If you want to protect from stealing recorded video, record it to remote storage. I am using ffmpeg with segmentation, but i am killing ffmpeg with command kill `pidof ffmpeg` and latest segment is playable by vlc. I don't know what happens with latest segment if power is removed. – Guntis Nov 7 '13 at 17:42
1

The raspberry pi should be shut down correctly, simply cutting off the power can cause corruption of the file system. Even if you record up to the last moment there's no guarantee that the file will be readable if you don't implement a UPS.

All you need is to implement a battery or capacitor UPS for a few seconds so data can be flushed to the flash and the system shut-down correctly. As the pi takes half an amp or so, something like a 40mAh battery would last 60*60*0.040 / 0.5 = 288 seconds which would give you a couple of minutes of recording after the power is cut before you had to shut down, and is not going to significantly increase the physical size of the system (this one would tuck inside a standard pi case, so not increase the size of the system at all).

Adafruit have published a how-to for running the pi on a battery then shutting it down safely here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.