Base Ffmpeg Processor
Abstract base for FFmpeg CLI-backed processors.
Provides shared helpers for PATH checks, subprocess invocation, temp-file lifecycle, and config coercion so concrete FFmpeg backends only build their command lines.
Architecture
BaseFFmpegProcessor
├── config coercion (_coerce_config via config_model)
├── ffmpeg availability (_require_ffmpeg)
├── subprocess runner (_run_ffmpeg)
├── temp file helpers (_write_attachment_tempfile, _create_temp_path, _cleanup_paths)
└── file read (_read_file_bytes)
Subclass contract
Concrete backends typically multiple-inherit this base with their family class:
class FFmpegDeinterlaceProcessor(BaseFFmpegProcessor, DeinterlaceProcessor):
BACKEND = "ffmpeg"
IS_DEFAULT = True
def __init__(self, config=None):
super().__init__(config=config)
@classmethod
def config_model(cls):
return FFmpegDeinterlaceConfig
BaseFFmpegProcessor(config=None)
Bases: MediaToolkit[Attachment, Attachment]
Shared helpers for processors that shell out to the ffmpeg binary.
Unlike BaseGstreamerProcessor,
this base does not require ffmpeg at construction time — availability is
checked when a command is run. That keeps import / build paths light when
ffmpeg is only needed for optional I/O.
Attributes:
| Name | Type | Description |
|---|---|---|
INSTALL_HINT |
str
|
Human-readable install guidance for missing ffmpeg. |
config |
BaseModel
|
Coerced stable configuration from |
Initialize the FFmpeg helper base and coerce constructor config.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
dict[str, Any] | BaseModel | None
|
Stable config
dict, family/backend model, or |
None
|
config_model()
classmethod
Return the stable configuration model for this processor.
Concrete backends must override with their FFmpeg config type.
Returns:
| Type | Description |
|---|---|
type[BaseModel]
|
type[BaseModel]: The configuration class used at construction time. |
FFmpegBaseConfig
Bases: BaseModel
Minimal shared configuration for FFmpeg CLI processors.
Family backends extend this (or their own shared family config) with engine-specific fields. Kept intentionally thin — FFmpeg leaves share process helpers more than stable knobs.