Problem with start_recording() / stop_recording() - Raspberry Pi Forums
hi, i'm new in forum , i've problem video recording using picamera. looking answer on google , documentation haven't found similar problem.
code: try record 0.1s videos in while loop. program stucks between "before stop recording" , "after stop recording" print. thought it's memory leaks problem create , close in every loop still doesn't works. , doesn't throws errors.
wrong? i'll grateful help.
code:
code: select all
import sys import socket import picamera import io import time import thread import gc camera = none photo = none flag = 0 ind = 0 def main(): try: thread.start_new_thread(make_vid,()) except: print 'thread error.' def make_vid(): print 'make' while 1: record() def record(): print str(ind) global ind ind += 1 try: global camera camera = picamera.picamera() camera.resolution = (640,480) camera.framerate = 90 camera.start_preview() stream = picamera.picameracirculario(camera,seconds=1) print ' make stream' camera.start_recording(stream, format='h264',quality=10) print ' start recording' camera.wait_recording(0.1) print ' wait recording' print ' before stop recording' camera.stop_recording() print ' after stop recording' finally: camera.stop_preview() print ' stop preview' camera.close() print ' close camera' stream.truncate() print ' stream truncate' stream.seek(0) print ' stream seek' if(flag == 0): global photo photo = stream.getvalue() print ' stream photo' stream.close() print ' stream close' stream = none print ' stream none' time.sleep(0.1)
wrong? i'll grateful help.
i ran similar problem. seems can called once. you're calling in while loop, problem. should call 'camera = picamera.picamera()' outside of loop , pass camera parameter function in loop.
code: select all
camera = picamera.picamera()
raspberrypi
Comments
Post a Comment