continuous — functions
The rolling history, and cutting clips out of it.
Nothing is started at the interesting moment, because by then it is already recorded. A continuous recording writes everything the camera sees into a directory of segments, prunes the oldest against a retention bound, and what somebody wants to keep comes out afterwards as a clip::
camera.continuous.start(ContinuousOptions(
directory='/var/history', max_duration_s=3600))
...
result = camera.continuous.save_clip(from_s, to_s, 'keep.mkv')
print(result.path, result.frames, result.incomplete)
The cut is a container copy -- no frame is decoded and none is re-encoded -- so a clip's temperatures are the history's temperatures exactly.
Two things are easy to get wrong and are worth saying once here.
A history is not a take. camera.is_recording stays False while
this runs, camera.start_recording() still works alongside it and
writes its own file, and the two count different frames. So
ContinuousStats.frames_written and a take's statistics
disagree by design.
The clip's in and out points are on the camera's clock, in
seconds, the same domain TimelineSpan.from_s reports and the
same one a frame's timestamp_us carries. It is a stopwatch
reading, not a date: TimelineSpan.unix_us is the wall clock,
and it is a label for a transport bar rather than a seek key.
prune_reason_name(reason)
A prune reason, spelled out rather than as an ordinal.