Base
Deinterlace processor family.
Converts interlaced video attachments into progressive video. Concrete backends
(FFmpeg yadif, later GStreamer deinterlace / yadif) register under
this family so callers only change backend=.
Shared constructor / process knobs live on
DeinterlaceConfig
and
DeinterlaceProcessConfig.
Backend modules inherit those bases and add engine-specific fields.
DeinterlaceConfig
Bases: BaseModel
Backend-agnostic stable configuration for deinterlace processors.
Only knobs that apply across FFmpeg / GStreamer (and future engines) belong here. Engine-specific fields (yadif mode, x264 CRF, GST element props, …) live on backend subclasses that inherit this model.
Attributes:
| Name | Type | Description |
|---|---|---|
strip_audio |
bool
|
Drop audio when producing progressive output. Defaults to True. |
DeinterlaceProcessConfig
Bases: ProcessorProcessConfig
Backend-agnostic per-invocation overrides for deinterlace.
None fields fall back to the stable constructor config. Backend
process-config models inherit this class and add engine-specific overrides.
DeinterlaceProcessor()
Bases: BackendSelectableProcessor[Attachment, Attachment], ABC
Family base for deinterlacing video attachments.
Why use this base class?
- Portability: Swap FFmpeg vs GStreamer without changing call sites.
- I/O boundary: Deinterlace is media transform I/O, not a segmenter algorithm.
- Tunable: Shared knobs on
DeinterlaceConfig; backends extend for engine-specific settings via inheritance.
Usage
from gllm_multimodal.media_toolkit.processor.deinterlace_processor import (
DeinterlaceConfig,
DeinterlaceProcessor,
)
processor = DeinterlaceProcessor.build(
backend="ffmpeg",
config=DeinterlaceConfig(strip_audio=True),
)
progressive = await processor.process(video_attachment)
is_interlaced(attachment)
staticmethod
Return whether ffprobe reports an interlaced field order for an attachment.
Writes attachment.data to a temporary file, probes field_order, then
cleans up. Returns False when ffprobe is unavailable, the probe fails,
or the field order is progressive or unknown (fail-open: unknown is
treated as progressive so callers skip the deinterlace pass; a warning
is logged whenever the probe cannot determine interlacing).
Callers that need fail-safe behavior (deinterlace when unknown) should check ffprobe availability separately instead of relying on this gate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
attachment
|
Attachment
|
Video attachment to probe. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
|
is_interlaced_path(video_path)
staticmethod
Return whether ffprobe reports an interlaced field order for a local path.
Public alias of
is_interlaced_path
kept on the family base so frame-extraction and other families do not
reach into a private member.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
video_path
|
str
|
Path to a local video file. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
|
is_interlaced_path(video_path)
Return whether ffprobe reports an interlaced field order for a local path.
General-purpose fail-open ffprobe helper shared by the deinterlace and
frame-extraction families. Prefer
DeinterlaceProcessor.is_interlaced
for Attachment call sites.
Fail-open: returns False (with a warning) when ffprobe is missing
or the probe fails, so callers skip deinterlacing rather than raising.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
video_path
|
str
|
Path to a local video file. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
|