5

Background Information:

I built a smart door solution with a RPi B+ (Raspbian) which makes use of three sensors (PIR, Gyroscope [I2C] and an Ultrasound). Depending on the sensor status managed by a Python script, I start recording a video by using the raspivid command and/or play sounds on Bluetooth speakers. I also have a USB WIFI dongle connected to the RPi.

This is how I call the Pi NoIR camera in my .sh file:

raspivid -w 800 -h 600 -t 15000 -o file.h264 -n -rot 270

Problem description:

The camera works fine for a while (I cannot precise for how long [2 hours maybe] nor what triggers the issue), but then it stops working. The funny thing is that I get no error message.

What did I do to identify the root cause:

  • I tried to manually kill the child process (Raspivid) but it simply doesn't work. If I kill the parent process (.sh file) then my child process gets assigned to the PID 1 (init.d).

  • I tried recording a new video in a new terminal window but the new process hangs too.

  • Rebooting the Pi doesn't work neither. It says it is rebooting but it does not (not even with the -f option).

  • I installed a new Pi Camera ensuring it was not a hardware or ribbon problem.

Have you ever faced this issue? How can I get it fixed? Thanks!

  • Have you looked at the temperature? It may be overheating – aidan Jan 19 '16 at 5:22
1

Raspivid has historically had issues handling files over 2GB. It also has an enormous default bitrate of 17Mbps. I think it's plausible that these two factors, combined with your barebones raspivid arguments, are combining to screw things up.

This answer, and the truly epic one posted to the same question, suggest a couple of approaches of varying complexity to deal with the 2GB limitation. I don't have a camera to hand unfortunately, but I think (presuming the option is enabled/working in the current build) you should be able to segment the video into smaller chunks using the -segment flag:

--segment, -sg Segment the stream in to multiple files

Rather than creating a single file, the file is split up in to segments of approximately the numer of milliseconds specified. In order to provide different filenames, you should add %04d or similar at the point in the filename where you want a segment count number to appear. e.g:

--segment 3000 -o video%04d.h264

will produce video clips of approximately 3000ms (3s) long, named video0001.h264, video0002.h264 etc. The clips should be seamless (no frame drops between clips), but the accuracy of each clip length will depend on the intraframe period, as the segments will always start on an I-frame. They will therefore always be equal or longer to the specified period.

I'd also strongly recommend experimenting with the -b flag to find the lowest possible quality/smallest possible files that you can accept. If you're going to record for upwards of 2 hours at a time you're going to need the space eventually.

0

I'm not sure, but maybe it is a power consumption problem. You are using WiFi, camera and some other devices at the same time. All of these consume lots of power. I had some similar experiences and by using an external power adapter they where solved. Maybe using a USB hub with external power adapter solves your problem.

Regards

Saeed

  • Hi there. Thanks for your comments. Power supply is fine. I have a 2A power adapter. The red led remains on all the time. – user22948 Mar 25 '15 at 8:17

Your Answer

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