website.p1 module

class website.p1.VideoRecorder[source]

Bases: object

A class to handle video recording, frame capturing, and live feed display.

recording

True if recording is active.

Type:

bool

show_feed

True if live camera feed is being displayed.

Type:

bool

video_writer

OpenCV video writer object.

Type:

cv2.VideoWriter

capture

OpenCV camera capture object.

Type:

cv2.VideoCapture

output_filename

Filename for saved video.

Type:

str

frame_timestamps

Timestamps for each recorded frame.

Type:

list

close_feed()[source]

Close the live camera feed display and stop the display thread if not recording.

display_feed()[source]

Start displaying the live camera feed in a separate window.

setup_camera()[source]

Initialize the camera.

Returns:

True if camera initialized successfully, False otherwise.

Return type:

bool

start_recording()[source]

Start recording video. Saves video to a timestamped file and stores frame timestamps.

stop_recording()[source]

Stop video recording and save frame timestamps to a JSON file. Releases the video writer object safely.

video_clean_up()[source]

Clean up all resources including stopping recording, releasing camera, and closing any open windows.

website.p1.command_listener(recorder, conn)[source]

Continuously listen for commands from the parent program and execute them.

Parameters:
  • recorder (VideoRecorder) – Instance to execute commands.

  • conn (multiprocessing.Connection) – Pipe connection to communicate with parent.

website.p1.handle_command(recorder, command, conn)[source]

Handle a command string received from the parent program.

Parameters:
  • recorder (VideoRecorder) – Instance of VideoRecorder to execute commands.

  • command (str) – Command string.

  • conn (multiprocessing.Connection) – Pipe connection to send back responses.

website.p1.main(conn)[source]

Main entry point for the video program.

Parameters:

conn (multiprocessing.Connection) – Pipe connection to receive commands.