From 86be5bf62142492347396c25d12c795aaab5ccf3 Mon Sep 17 00:00:00 2001 From: shoofle Date: Tue, 6 Aug 2024 10:55:51 -0400 Subject: [PATCH] setting up camera controls! --- readme.md | 12 +++++++++++- webcam.py | 11 +++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/readme.md b/readme.md index 61d53ee..352301f 100644 --- a/readme.md +++ b/readme.md @@ -22,4 +22,14 @@ screensaver = false dpms = false -maybe take security steps? disable keyboards? how are we gonna secure this? +maybe take security steps? disable keyboards? how are we gonna secure this? zipties. + +$ v4l2-ctl --list-ctrls-menus +$ v4l2-ctl -c brightness=64 +$ v4l2-ctl -c contrast=65 + +set screen resolution to 1280x720 (720p) + +install flatpak, install cameractls? + +cameractrls exists in the start menu in the "office" section for some reason. i think we're ready diff --git a/webcam.py b/webcam.py index f19d652..f62ace3 100644 --- a/webcam.py +++ b/webcam.py @@ -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