Looking to achieve two things with a raspberry pi and pi cam but can't work out the best way to approach it.
I have the camera working using the record. sequence code from the pi website. I would like to spilt recording into a new file on a keypress.
I would also like to add a text annotation based on a different keypress. I currently have annotation showing current time which works I want a separate counter annotation showing the count from the keypress.
Sorry feel like both should be simple and asked before but can't seem to find the answers.
Thanks in advance
[Edit to add a bit more context] - I am trying to record a video split into separate files with each video a set length. say 2 mins, This bit I understand. I want to have a counter displayed on the screen which increments with a key press (probably spacebar). I also want to display current time. I can put both bits of information using annotate.text but would rather have 2 distinct boxes.
I have the camera working using the record. sequence code from the pi website. I would like to spilt recording into a new file on a keypress.
I would also like to add a text annotation based on a different keypress. I currently have annotation showing current time which works I want a separate counter annotation showing the count from the keypress.
Sorry feel like both should be simple and asked before but can't seem to find the answers.
Thanks in advance
[Edit to add a bit more context] - I am trying to record a video split into separate files with each video a set length. say 2 mins, This bit I understand. I want to have a counter displayed on the screen which increments with a key press (probably spacebar). I also want to display current time. I can put both bits of information using annotate.text but would rather have 2 distinct boxes.
import picamera import datetime as dt import functools import operator ##initialise camera print('running') def convertTuple(tup): str = functools.reduce(operator.add, (tup)) return str with picamera.PiCamera() as camera: camera.resolution = (1280, 720) camera.framerate = 24 camera.start_preview(fullscreen=False, window = (100, 20, 640, 480)) camera.annotate_background = picamera.Color('black') text = ('finish',dt.datetime.now().strftime('%Y-%m-%d %H:%M:%S')) text = convertTuple(text) camera.annotate_text = text start = dt.datetime.now() sheetcount = 0 while (dt.datetime.now() - start).seconds < 30: for filename in camera.record_sequence( '%d.h264' % i for i in range(1, 11)): currentfile = dt.datetime.now() sheetcount +=1 while (dt.datetime.now() - currentfile).seconds < 10: text = ('Finish Sheet ',str(sheetcount),' ',dt.datetime.now().strftime('%Y-%m-%d %H:%M:%S')) text = convertTuple(text) camera.annotate_text = text camera.wait_recording(0.2) camera.stop_recording() print('stopped')