3

Is it possible to get two camera instances running at the same time - one is for capturing live feed to stream across network, the other one records video when motion is detected (PRI sensor is used)? I am using Picamera library and it is capable of recording multiple streams using splitter_port. I've tried using multiprocessing (this is a very basic example) :

from multiprocessing import Process
import time
import picamera
cam = picamera.PiCamera()

def loop_a():
    while 1:
        try:
           cam.start_recording('/home/pi/bin' + 'video1.h264')
           time.sleep(20)
           cam.stop_recording()
       except KeyboardInterrupt:
          cam.close()

def loop_b():
    while 1:
        try:
            cam.start_recording('/home/pi/bin' + 'video2.h264', splitter_port=2)
            time.sleep(20)
            cam.stop_recording(splitter_port=2)
        except KeyboardInterrupt:
          cam.close()

if __name__ == '__main__':
    Process(target=loop_a).start()
    Process(target=loop_b).start()

but it doesn't work as I get the following error: Camera component couldn't be enabled: Out of resources (other than memory) Any help would be much appreciated, thanks.

1

Just use motion. Based on your question I think it will do exactly what you want.

  • It does, but it has a few massive drawbacks - streaming across network has a maximum of 1 FPS. And the fram rate on recorded videos is not greater due to requiring a massive amount of processing power. So Motion isn't really a solution for a decent security project. – user3187135 Jul 29 '15 at 13:07
  • I'm using it with a Pi2 that is overclocked. No issues w/ 20fps for video, and 2fps for streaming. – ifermon Jul 29 '15 at 15:45

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.