Briefly looking into the PiCamera documentation (And with 0% knowledge in Python) I think you just may have a syntax error?
syntax error: 'break' outside loop.
Basically you are trying to break (a loop) from a non looped code. Causing a syntax error. Or break is not allowed in that context.
I suggest the following psuedo code changes.
import time
import cv2
import picamera
with picamera.PiCamera() as camera:
camera.resolution = (640, 360)
camera.framerate = 24
camera.start_recording('one_day.h264', quality=20, bitrate=750000)
///Above line will start recording. I dont think you explicilty need to use wait recording as its already recording on another thread.
#camera.wait_recording(24 * 60 * 60)
//Psuedo code here- I dont know Python
///start a never ending loop, like while stop!= true?
/// use pause(50) to allow recording to progress
/// see if the user pressed a key in the buffer
/// Not sure if this is correct? key = cv2.waitkey(1) & 0XFF
/// if key == ord("q")
/// exit your loop by setting stop = true (or break, since you are in a loop)
/// no key pressed, start the loop again until broken or another condition is met
/// Now only call stop
camera.stop_recording()
In the document it says using pause() will not raise errors. Only once you call stop recording. So it may result in half your video not being recorded. Maybe instead of pause() , use the wait_recording with a small time period (like 5 seconds?) If errors it should raise an error and tell you, instead of pretending to carry on and you only realising long time later.
I hope this helps, from a psuedo logical point of view.
if key == ord("q")line - all blocks are introduced by a colon in Python. If you want to record in .avi format you'll need to transcode the output (preferably on a faster machine); the Pi's camera firmware doesn't support it (probably because .avi doesn't officially support MPEG4 compression, not to mention it's an ancient format largely superseded at this point). – Dave Jones Dec 03 '15 at 16:55