Recorder Module

Thermal Recorder

Records thermal camera data to files using the shared memory interface.

class pythermal.record.ThermalRecorder(output_dir: str = 'recordings', color: bool = True, device_index: int | None = None, native_dir: str | None = None)[source]

Bases: object

Records thermal camera data to files.

Records both YUYV frames and temperature arrays with timestamps.

__init__(output_dir: str = 'recordings', color: bool = True, device_index: int | None = None, native_dir: str | None = None)[source]

Initialize thermal recorder.

Parameters:
  • output_dir – Directory to save recordings

  • color – If True, also record colored RGB frames

  • device_index – Index of the USB device to use (0 for first device, 1 for second, etc.). Default is 0. Each device uses a separate shared memory segment.

  • native_dir – Optional path to native directory containing pythermal-recorder. If None, uses default package location.

start(device: ThermalDevice | None = None) bool[source]

Start recording.

Parameters:

device – Optional ThermalDevice instance. If None, creates a new one.

Returns:

True if successful, False otherwise

stop()[source]

Stop recording and close output file.

record_frame() bool[source]

Record a single frame from shared memory.

Returns:

True if frame was recorded, False otherwise

record_loop(duration: float | None = None)[source]

Record frames in a loop.

Parameters:

duration – Optional duration in seconds. If None, records until stopped.

cleanup()[source]

Cleanup resources.

static replay(file_path: str, view_mode: str = 'yuyv', fps: float | None = None)[source]

Replay a recorded thermal camera file.

Parameters:
  • file_path – Path to the .tseq recording file

  • view_mode – ‘yuyv’ or ‘temperature’ view mode

  • fps – Target FPS for playback. If None, uses original timestamps.