|
|
|
@ -13,7 +13,7 @@ def five_minute_segment_from(the_time): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def path_to_video_at(time_stamp): |
|
|
|
|
return 'videos/' + str(time_stamp) + '.mkv' # mkv required for h264 encoding |
|
|
|
|
return 'videos/' + str(time_stamp) + '.mp4' # mkv required for h264 encoding |
|
|
|
|
|
|
|
|
|
#delay for long delay |
|
|
|
|
long_delay = timedelta(minutes=1) |
|
|
|
@ -27,7 +27,10 @@ if not camera.isOpened(): |
|
|
|
|
exit() |
|
|
|
|
|
|
|
|
|
# video writer |
|
|
|
|
fourcc = cv2.VideoWriter_fourcc(*'x264') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fourcc = cv2.VideoWriter_fourcc(*'mp4v') |
|
|
|
|
camera.set(cv2.CAP_PROP_FPS, 60.0) |
|
|
|
|
camera_fps = camera.get(cv2.CAP_PROP_FPS) |
|
|
|
|
camera.set(cv2.CAP_PROP_FRAME_WIDTH, 1280) |
|
|
|
|
camera.set(cv2.CAP_PROP_FRAME_HEIGHT, 720) |
|
|
|
@ -35,7 +38,7 @@ video_writer = cv2.VideoWriter(path_to_video_at(last_time_stamp), |
|
|
|
|
fourcc, |
|
|
|
|
camera_fps, |
|
|
|
|
(int(camera.get(3)),int(camera.get(4))), #resolution |
|
|
|
|
|
|
|
|
|
(cv2.VIDEOWRITER_PROP_HW_ACCELERATION, cv2.VIDEO_ACCELERATION_ANY) |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
# video feed from previously captured video |
|
|
|
@ -109,7 +112,7 @@ with gpiod.request_lines( |
|
|
|
|
last_time_stamp = five_minute_segment_from(datetime.now()) |
|
|
|
|
|
|
|
|
|
ret, frame = camera.read() |
|
|
|
|
frame = cv2.flip(frame, 1) |
|
|
|
|
#frame = cv2.flip(frame, 1) |
|
|
|
|
# record the frame to the appropriate file, and also to the short term buffer |
|
|
|
|
video_writer.write(frame) |
|
|
|
|
queue[idx] = ret, frame |
|
|
|
|