Lddr Keyframe Extractor
LDDR-based keyframe extractor for video attachments.
LDDRKeyframeExtractor(frame_budget=8, min_tokens=256, max_tokens=1024, tau=1.0, sample_fps=1.0, query=None, em_invoker=None, deinterlace=DeinterlaceMode.AUTO, decode_long_edge=DEFAULT_DECODE_LONG_EDGE)
Bases: BaseKeyframeExtractor
Extract keyframes using Linear-DPP + dynamic-resolution allocation.
The extractor performs:
1. Frame decoding at sample_fps.
2. Feature extraction for each sampled frame.
3. Greedy Linear-DPP frame selection.
4. Group-DPP-inspired importance scoring.
5. Token-budget allocation for dynamic frame resolution.
Initialize the LDDR keyframe extractor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frame_budget
|
int
|
Maximum number of keyframe candidates. Defaults to 8. |
8
|
min_tokens
|
int
|
Minimum per-frame token allocation. Defaults to 256. |
256
|
max_tokens
|
int
|
Maximum per-frame token allocation. Defaults to 1024. |
1024
|
tau
|
float
|
Query-density prior exponent. Defaults to 1.0. |
1.0
|
sample_fps
|
float
|
Sampling FPS used before selection.
Any positive rate is accepted. The nested
|
1.0
|
query
|
str | None
|
Optional query text for query-aware LDDR selection. Defaults to None. |
None
|
em_invoker
|
BaseEMInvoker | None
|
A gllm-inference EM invoker instance. When None, keyframe selection falls back to deterministic pseudo-embeddings and is NOT content-aware (intended for tests only). A warning is logged on this path. Defaults to None. |
None
|
deinterlace
|
DeinterlaceMode | bool | str
|
Deinterlace
policy for the nested frame extraction ( |
AUTO
|
decode_long_edge
|
int | None
|
Downscale decoded frames so
the longest edge is at most this many pixels (embeddings do not
need native resolution). Original dimensions are retained for
token-to-resolution mapping. |
DEFAULT_DECODE_LONG_EDGE
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If constructor arguments are invalid. |