Package-level declarations

Types

Link copied to clipboard
data class Aresample(val sampleRate: Int) : FilterStep

Resamples to sampleRate.

Link copied to clipboard
data class Atempo(val tempo: Double) : FilterStep

Changes the tempo by the factor tempo and keeps the pitch. FFmpeg takes 0.5 to 100.

Link copied to clipboard
data class AudioEncoderTuning(val profile: String? = null, val bitrateBps: Long? = null)

Typed audio encoder settings, which applyTo folds into an AudioEncoderSpec.

Link copied to clipboard

Collects the steps of an audio FilterChain. See audioFilters.

Link copied to clipboard
data class AudioFormat(val sampleFormat: SampleFormat? = null, val sampleRate: Int? = null, val channelLayout: String? = null) : FilterStep

Pins the sample format, the rate or the channel layout that the next stage receives.

Link copied to clipboard
data class Crop(val width: Int, val height: Int, val x: Int? = null, val y: Int? = null) : FilterStep

Crops to width by height pixels at x and y. With both offsets null the crop is centred.

Link copied to clipboard
data class DecoderOptions(val skipLoopFilter: DecoderSkip? = null, val skipFrame: DecoderSkip? = null, val errorDetection: Set<ErrorDetection> = emptySet(), val threadType: DecoderThreadType? = null, val options: Map<String, String> = emptyMap())

Typed decoder options, applied through the EXISTING av_opt_set funnel between codec-context creation and open. Control plane only: these configure an open, never a per-frame call. compile is the pure, golden-tested mapping to option pairs; a wrong key in options reproduces the funnel's measured EINVAL path rather than being filtered here.

Link copied to clipboard

avcodec's skip ladder, by its own option value names.

Link copied to clipboard

How a decoder spreads its work across threads: whole frames, slices of one frame, or both.

Link copied to clipboard
data class Deinterlace(val with: Deinterlacer = Deinterlacer.Bwdif) : FilterStep

Deinterlaces with with.

Link copied to clipboard

The deinterlacing filters Deinterlace can use.

Link copied to clipboard
enum class DemuxFlag : Enum<DemuxFlag>

A demuxer behaviour flag, by FFmpeg's own fflags value name.

Link copied to clipboard
data class DemuxOptions(val probeSizeBytes: Long? = null, val analyzeDurationMicros: Long? = null, val fpsProbeFrames: Int? = null, val flags: Set<DemuxFlag> = emptySet(), val formatWhitelist: Set<String> = emptySet(), val protocolWhitelist: Set<String> = emptySet(), val ioTimeoutMicros: Long? = null, val options: Map<String, String> = emptyMap(), val format: String? = null)

Typed demuxer options for MediaSource.open, applied between allocation and open, the only moment probe sizes, flags and whitelists can act. compile is the pure mapping to FFmpeg's own option pairs. A key FFmpeg does not consume comes back through MediaSource.unusedOpenOptions instead of being dropped.

Link copied to clipboard
data class DrawBox(val x: Int, val y: Int, val width: Int, val height: Int, val color: String = "red", val thickness: Int = 3) : FilterStep

Draws the outline of a width by height box at x and y, in color, thickness pixels wide.

Link copied to clipboard

The x264 and x265 speed presets, fastest first. A slower preset spends more time for a smaller file.

Link copied to clipboard

How closely a decoder checks the bitstream, by the flag names of FFmpeg's err_detect option.

Link copied to clipboard
data class FilterChain(val steps: List<FilterStep>)

Typed steps in order. compile joins them into the description a filter graph takes.

Link copied to clipboard
sealed interface FilterStep

The typed filter DSL: a compilation layer onto the description STRINGS the existing FilterGraph.buildVideo/buildAudio already take. Nothing here crosses into C; the rules that bind it:

Link copied to clipboard
data class Format(val format: PixelFormat) : FilterStep

Converts the pixels to format.

Link copied to clipboard
data class Fps(val rate: Rational) : FilterStep

Converts to the constant rate, dropping or repeating frames.

Link copied to clipboard
data class Loudnorm(val integrated: Double = -24.0, val truePeak: Double = -2.0, val range: Double = 7.0) : FilterStep

EBU R128 loudness normalisation with the filter's own defaults.

Link copied to clipboard
data class Pad(val width: Int, val height: Int, val x: Int = -1, val y: Int = -1, val color: String = "black") : FilterStep

Pads to width by height pixels with color, with the input at x and y. -1 centres it.

Link copied to clipboard
data class Pan(val layout: String, val outputs: List<String>) : FilterStep

A downmix or routing matrix: Pan("stereo", "c0=FL+0.7*FC", "c1=FR+0.7*FC"). The channel expressions are FFmpeg's own pan syntax, escaped as one value because pan's separator is the pipe, which the chain separator must not see.

Link copied to clipboard

A quarter turn for Transpose, with or without a mirror.

Link copied to clipboard
sealed interface RateControl

How an encoder spends bits.

Link copied to clipboard
data class Raw(val fragment: String) : FilterStep

The escape hatch: any chain fragment the typed set lacks, joined verbatim. Capability checks cannot see inside it; the caller owns that claim.

Link copied to clipboard
data class Scale(val width: Int, val height: Int) : FilterStep

Scales to width by height pixels. -1 on one side keeps the aspect ratio.

Link copied to clipboard
data class Transpose(val turn: QuarterTurn) : FilterStep

Turns the picture a quarter turn.

Link copied to clipboard
data class VideoEncoderTuning(val preset: EncoderPreset? = null, val profile: String? = null, val tune: String? = null, val rateControl: RateControl? = null)

The typed encoder layer: sugar compiling INTO the existing options maps of the encoder specs. Zero C, zero new funnel; applyTo returns a new spec whose options carry the typed knobs as the exact av_opt_set strings the wrappers already send.

Link copied to clipboard

Collects the steps of a video FilterChain. See videoFilters.

Link copied to clipboard
data class Volume(val gain: Double) : FilterStep

Linear gain: 1.0 is unity, 0.5 is half amplitude.

Functions

Link copied to clipboard

An audio FilterChain built in block, such as audioFilters { volume(0.5); atempo(1.25) }.

Link copied to clipboard

The one escaping function every typed filter argument passes through.

Link copied to clipboard

A video FilterChain built in block, such as videoFilters { scale(1280, -1); fps(Rational(30, 1)) }.