Skip to main content

Module fx

Module fx 

Source
Expand description

ffmpeg-backed dialogue treatments. Port of audio_fx.py.

Audio goes through ffmpeg as raw PCM over pipes, exactly as the Python does: same filter graphs, same argument lists, same trim-or-pad back to the input length. For a deterministic graph that makes the output bytes identical; film draws its grain from anoisesrc with ffmpeg’s default random seed, so no two renders of it — in either language — match.

Failures degrade: a treatment that cannot run leaves the stem as it was and warns once per (treatment, reason). Setting XIL_STRICT_FX turns that into an error instead.

Structs§

AudioFxError
AudioFxError — only raised under XIL_STRICT_FX.
State 🔒
Treatment
A named treatment, as written in a cast config filter field.

Constants§

CACHE_MAX_ENTRIES 🔒
FIFO-bounded result cache, keyed on the input bytes and every parameter.
CODEC_FALLBACK 🔒
FILM
PHONE
SPEAKERPHONE
STRICT_ENV_VAR
TREATMENTS
TREATMENTS, in the order the Python dict is built.
UNTREATED 🔒

Statics§

STATE 🔒

Functions§

apply_treatment
apply_treatment(segment, name).
codec_round_trip 🔒
_codec_round_trip: encode through a lossy codec and decode straight back.
encoder_available
encoder_available(name): does ffmpeg -encoders list it as a token?
fail 🔒
_fail: warn once with the fallback spelled out, or error when strict.
fit_length 🔒
_fit_length: trim or pad with silence to exactly target bytes.
last_stderr_line 🔒
missing_codecs
missing_codecs(names): treatment → encoder, for encoders this ffmpeg lacks.
py_repr
Python repr() of a str.
raw_format 🔒
ffmpeg’s raw format name for a sample width.
run_ffmpeg_filter
run_ffmpeg_filter(segment, graph, label=..., codec=..., ...) with preserve_length=True.
run_piped 🔒
Run a command with input on stdin, collecting stdout and stderr, as subprocess.run(..., input=..., capture_output=True) does.
s 🔒
signal_code 🔒
Python reports a signal death as a negative return code.
treatment
warn_once
_warn_once(label, reason, message) — the message is already formatted.
with_state 🔒

Type Aliases§

CacheKey 🔒