video
Class info¶
🛈 DocStrings¶
Video and animated-image inputs: exact seeks, dense samples, pacing checks.
Seek exact media times in Chromium, sample densely, check pacing (static stretches,
black/blank frames, cuts, mark overlaps), compose the sheet with marks and a timeline.
Ported 1:1 in js/src/video.ts.
CUT_NEIGHBOUR
module-attribute
¶
... while both neighbouring steps change at most a quarter of that is an abrupt cut.
SAMPLE_STEP
module-attribute
¶
Dense samples are at most this far apart (seconds), up to MAX_SAMPLES.
STATIC_RATIO
module-attribute
¶
A sample step changing fewer than 0.05% of pixels counts as "no visible change".
UNIFORM_SHARE
module-attribute
¶
A frame is black/blank if this share of pixels has one colour (4 bits per channel).
abrupt_cuts
¶
abrupt_cuts(samples: Sequence[ActivitySample]) -> list[float]
Sample times where one step changes >= CUT_RATIO and its neighbours little.
Source code in src/framesheet/video.py
dense_times
¶
Evenly spaced pacing samples over [start, end] (both ends included).
Source code in src/framesheet/video.py
frame_stats
¶
(black, blank): one colour (4 bits/channel) covers >= 99.5% of the pixels.
Source code in src/framesheet/video.py
mark_overlaps
¶
Span boxes (captions) covering target region boxes while both are active.
Source code in src/framesheet/video.py
plan_times
¶
plan_times(
total: float,
*,
start: float | None = None,
end: float | None = None,
frames: int = 12,
every: float | None = None,
times: Sequence[float] | Literal["marks"] | None = None,
marks: Marks | None = None,
) -> tuple[float, float, list[float], str]
Range and tile times: (start, end, times, mode).
Source code in src/framesheet/video.py
sharpness
¶
Mean absolute luma gradient (|dx| + |dy| per pixel, 0-510).
Source code in src/framesheet/video.py
static_stretches
¶
static_stretches(samples: Sequence[ActivitySample], threshold: float) -> list[tuple[float, float]]
Maximal runs of sample steps without visible change lasting > threshold s.
Source code in src/framesheet/video.py
video_findings
¶
video_findings(
samples: Sequence[ActivitySample],
stats: dict[float, tuple[bool, bool]],
threshold: float,
marks: Marks | None,
start: float,
end: float,
) -> tuple[list[Finding], list[dict[str, Any]]]
Findings plus timeline issues ({"kind", "start", "end"}).