Skip to content

sources

FFmpeg sources.

Functions:

Name Description
abuffer

Buffer audio frames, and make them available to the filter chain.

acrossfade

Apply cross fade from one input audio stream to another input audio stream.

aevalsrc

Generate an audio signal specified by an expression.

afdelaysrc

Generate a fractional delay FIR coefficients.

afireqsrc

Generate a FIR equalizer coefficients.

afirsrc

Generate a FIR coefficients using frequency sampling method.

ainterleave

Temporally interleave frames from several inputs.

allrgb

The allrgb source returns frames of size 4096x4096 of all rgb colors.

allyuv

The allrgb source returns frames of size 4096x4096 of all rgb colors.

amerge

Merge two or more audio streams into a single multi-channel stream.

amix

Mixes multiple audio inputs into a single output.

amovie

This is the same as movie source, except it selects an audio

anoisesrc

Generate a noise audio signal.

anullsrc

The null audio source, return unprocessed audio frames. It is mainly useful

astreamselect

Select video or audio streams.

avsynctest

Generate an Audio/Video Sync Test.

bm3d

Denoise frames using Block-Matching 3D algorithm.

buffer

Buffer video frames, and make them available to the filter chain.

cellauto

Create a pattern generated by an elementary cellular automaton.

color

The allrgb source returns frames of size 4096x4096 of all rgb colors.

color_vulkan

Video source that creates a Vulkan frame of a solid color.

colorchart

The allrgb source returns frames of size 4096x4096 of all rgb colors.

colorspectrum

The allrgb source returns frames of size 4096x4096 of all rgb colors.

concat

Concatenate audio and video streams, joining them together one after the

decimate

Drop duplicated frames at regular intervals.

fieldmatch

Field matching filter for inverse telecine. It is meant to reconstruct the

flite

Synthesize a voice utterance using the libflite library.

frei0r_src

Provide a frei0r source.

gradients

Generate several gradients.

guided

Apply guided filter for edge-preserving smoothing, dehazing and so on.

haldclutsrc

The allrgb source returns frames of size 4096x4096 of all rgb colors.

headphone

Apply head-related transfer functions (HRTFs) to create virtual

hilbert

Generate odd-tap Hilbert transform FIR coefficients.

hstack

Stack input videos horizontally.

hstack_vaapi

Stack input videos horizontally.

interleave

Temporally interleave frames from several inputs.

join

Join multiple input streams into one multi-channel stream.

ladspa

Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.

life

Generate a life pattern.

limitdiff

Apply limited difference filter using second and optionally third video stream.

lv2

Load a LV2 (LADSPA Version 2) plugin.

mandelbrot

Generate a Mandelbrot set fractal, and progressively zoom towards the

mergeplanes

Merge color channel components from several video streams.

mix

Mix several video input streams into one video stream.

movie

Read audio and/or video stream(s) from a movie container.

mptestsrc

Generate various test patterns, as generated by the MPlayer test filter.

nullsrc

The allrgb source returns frames of size 4096x4096 of all rgb colors.

openclsrc

Generate video using an OpenCL program.

pal100bars

The allrgb source returns frames of size 4096x4096 of all rgb colors.

pal75bars

The allrgb source returns frames of size 4096x4096 of all rgb colors.

perlin

Generate Perlin noise.

premultiply

Apply alpha premultiply effect to input video stream using first plane

program_opencl

Filter video using an OpenCL program.

rgbtestsrc

The allrgb source returns frames of size 4096x4096 of all rgb colors.

sierpinski

Generate a Sierpinski carpet/triangle fractal, and randomly pan around.

signature

Calculates the MPEG-7 Video Signature. The filter can handle more than one

sinc

Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.

sine

Generate an audio signal made of a sine wave with amplitude 1/8.

smptebars

The allrgb source returns frames of size 4096x4096 of all rgb colors.

smptehdbars

The allrgb source returns frames of size 4096x4096 of all rgb colors.

streamselect

Select video or audio streams.

testsrc

The allrgb source returns frames of size 4096x4096 of all rgb colors.

testsrc2

The allrgb source returns frames of size 4096x4096 of all rgb colors.

unpremultiply

Apply alpha unpremultiply effect to input video stream using first plane

vstack

Stack input videos vertically.

vstack_vaapi

Stack input videos vertically.

xmedian

Pick median pixels from several input videos.

xstack

Stack video inputs into custom layout.

xstack_vaapi

Stack video inputs into custom layout.

yuvtestsrc

The allrgb source returns frames of size 4096x4096 of all rgb colors.

zoneplate

Generate a zoneplate test video pattern.

abuffer

abuffer(
    *,
    time_base: Rational = Default("0/1"),
    sample_rate: Int = Default("0"),
    sample_fmt: Sample_fmt = Default("none"),
    channel_layout: String = Default(None),
    channels: Int = Default("0"),
    extra_options: dict[str, Any] | None = None
) -> AudioStream

Buffer audio frames, and make them available to the filter chain.

This source is mainly intended for a programmatic use, in particular through the interface defined in libavfilter/buffersrc.h.

It accepts the following parameters:

Parameters:

Name Type Description Default
time_base Rational

The timebase which will be used for timestamps of submitted frames. It must be either a floating-point number or in numerator/denominator form.

Default('0/1')
sample_rate Int

The sample rate of the incoming audio buffers.

Default('0')
sample_fmt Sample_fmt

The sample format of the incoming audio buffers. Either a sample format name or its corresponding integer representation from the enum AVSampleFormat in libavutil/samplefmt.h

Default('none')
channel_layout String

The channel layout of the incoming audio buffers. Either a channel layout name from channel_layout_map in libavutil/channel_layout.c or its corresponding integer representation from the AV_CH_LAYOUT_* macros in libavutil/channel_layout.h

Default(None)
channels Int

The number of channels of the incoming audio buffers. If both channels and channel_layout are specified, then they must be consistent.

Default('0')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default AudioStream

the audio stream

References

FFmpeg Documentation

acrossfade

acrossfade(
    *streams: VideoStream,
    inputs: Int = Default("2"),
    nb_samples: Int64 = Default("44100"),
    duration: Duration = Default("0"),
    overlap: Boolean = Default("true"),
    curve1: (
        Int
        | Literal[
            "nofade",
            "tri",
            "qsin",
            "esin",
            "hsin",
            "log",
            "ipar",
            "qua",
            "cub",
            "squ",
            "cbr",
            "par",
            "exp",
            "iqsin",
            "ihsin",
            "dese",
            "desi",
            "losi",
            "sinc",
            "isinc",
            "quat",
            "quatr",
            "qsin2",
            "hsin2",
        ]
        | Default
    ) = Default("tri"),
    curve2: (
        Int
        | Literal[
            "nofade",
            "tri",
            "qsin",
            "esin",
            "hsin",
            "log",
            "ipar",
            "qua",
            "cub",
            "squ",
            "cbr",
            "par",
            "exp",
            "iqsin",
            "ihsin",
            "dese",
            "desi",
            "losi",
            "sinc",
            "isinc",
            "quat",
            "quatr",
            "qsin2",
            "hsin2",
        ]
        | Default
    ) = Default("tri"),
    extra_options: dict[str, Any] | None = None
) -> AudioStream

Apply cross fade from one input audio stream to another input audio stream. The cross fade is applied for specified duration near the end of first stream.

The filter accepts the following options:

Parameters:

Name Type Description Default
inputs Int

Specify the number of inputs to crossfade. When crossfading multiple inputs, each input will be concatenated and crossfaded in sequence, similar to the concat filter. Default is 2.

Default('2')
nb_samples Int64

Specify the number of samples for which the cross fade effect has to last. At the end of the cross fade effect the first input audio will be completely silent. Default is 44100.

Default('44100')
duration Duration

Specify the duration of the cross fade effect. See the Time duration section in the ffmpeg-utils(1) manual for the accepted syntax. By default the duration is determined by nb_samples. If set this option is used instead of nb_samples.

Default('0')
overlap Boolean

Should first stream end overlap with second stream start. Default is enabled.

Default('true')
curve1 Int | Literal['nofade', 'tri', 'qsin', 'esin', 'hsin', 'log', 'ipar', 'qua', 'cub', 'squ', 'cbr', 'par', 'exp', 'iqsin', 'ihsin', 'dese', 'desi', 'losi', 'sinc', 'isinc', 'quat', 'quatr', 'qsin2', 'hsin2'] | Default

Set curve for cross fade transition for first stream.

Default('tri')
curve2 Int | Literal['nofade', 'tri', 'qsin', 'esin', 'hsin', 'log', 'ipar', 'qua', 'cub', 'squ', 'cbr', 'par', 'exp', 'iqsin', 'ihsin', 'dese', 'desi', 'losi', 'sinc', 'isinc', 'quat', 'quatr', 'qsin2', 'hsin2'] | Default

Set curve for cross fade transition for second stream. For description of available curve types see afade filter description.

Default('tri')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default AudioStream

the audio stream

References

FFmpeg Documentation

aevalsrc

aevalsrc(
    *,
    exprs: String = Default(None),
    nb_samples: Int = Default("1024"),
    sample_rate: String = Default("44100"),
    duration: Duration = Default("-0.000001"),
    channel_layout: String = Default(None),
    extra_options: dict[str, Any] | None = None
) -> AudioStream

Generate an audio signal specified by an expression.

This source accepts in input one or more expressions (one for each channel), which are evaluated and used to generate a corresponding audio signal.

This source accepts the following options:

Parameters:

Name Type Description Default
exprs String

Set the '|'-separated expressions list for each separate channel. In case the channel_layout option is not specified, the selected channel layout depends on the number of provided expressions. Otherwise the last specified expression is applied to the remaining output channels.

Default(None)
nb_samples Int

Set the number of samples per channel per each output frame, default to 1024.

Default('1024')
sample_rate String

Specify the sample rate, default to 44100.

Default('44100')
duration Duration

Set the minimum duration of the sourced audio. See the Time duration section in the ffmpeg-utils(1) manual for the accepted syntax. Note that the resulting duration may be greater than the specified duration, as the generated audio is always cut at the end of a complete frame. If not specified, or the expressed duration is negative, the audio is supposed to be generated forever.

Default('-0.000001')
channel_layout String

Set the channel layout. The number of channels in the specified layout must be equal to the number of specified expressions.

Default(None)
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default AudioStream

the audio stream

References

FFmpeg Documentation

afdelaysrc

afdelaysrc(
    *,
    delay: Double = Default("0"),
    sample_rate: Int = Default("44100"),
    nb_samples: Int = Default("1024"),
    taps: Int = Default("0"),
    channel_layout: String = Default("stereo"),
    extra_options: dict[str, Any] | None = None
) -> AudioStream

Generate a fractional delay FIR coefficients.

The resulting stream can be used with afir filter for filtering the audio signal.

The filter accepts the following options:

Parameters:

Name Type Description Default
delay Double

Set the fractional delay. Default is 0.

Default('0')
sample_rate Int

Set the sample rate, default is 44100.

Default('44100')
nb_samples Int

Set the number of samples per each frame. Default is 1024.

Default('1024')
taps Int

Set the number of filter coefficients in output audio stream. Default value is 0.

Default('0')
channel_layout String

Specifies the channel layout, and can be a string representing a channel layout. The default value of channel_layout is "stereo".

Default('stereo')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default AudioStream

the audio stream

References

FFmpeg Documentation

afireqsrc

afireqsrc(
    *,
    preset: (
        Int
        | Literal[
            "custom",
            "flat",
            "acoustic",
            "bass",
            "beats",
            "classic",
            "clear",
            "deep bass",
            "dubstep",
            "electronic",
            "hardstyle",
            "hip-hop",
            "jazz",
            "metal",
            "movie",
            "pop",
            "r&b",
            "rock",
            "vocal booster",
        ]
        | Default
    ) = Default("flat"),
    gains: String = Default(
        "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"
    ),
    bands: String = Default(
        "25 40 63 100 160 250 400 630 1000 1600 2500 4000 6300 10000 16000 24000"
    ),
    taps: Int = Default("4096"),
    sample_rate: Int = Default("44100"),
    nb_samples: Int = Default("1024"),
    interp: (
        Int | Literal["linear", "cubic"] | Default
    ) = Default("linear"),
    phase: (
        Int | Literal["linear", "min"] | Default
    ) = Default("min"),
    extra_options: dict[str, Any] | None = None
) -> AudioStream

Generate a FIR equalizer coefficients.

The resulting stream can be used with afir filter for filtering the audio signal.

The filter accepts the following options:

Parameters:

Name Type Description Default
preset Int | Literal['custom', 'flat', 'acoustic', 'bass', 'beats', 'classic', 'clear', 'deep bass', 'dubstep', 'electronic', 'hardstyle', 'hip-hop', 'jazz', 'metal', 'movie', 'pop', 'r&b', 'rock', 'vocal booster'] | Default

Set equalizer preset. Default preset is flat. Available presets are: @end table

Default('flat')
gains String

Set custom gains for each band. Only used if the preset option is set to custom. Gains are separated by white spaces and each gain is set in dBFS. Default is 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.

Default('0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0')
bands String

Set the custom bands from where custom equalizer gains are set. This must be in strictly increasing order. Only used if the preset option is set to custom. Bands are separated by white spaces and each band represent frequency in Hz. Default is 25 40 63 100 160 250 400 630 1000 1600 2500 4000 6300 10000 16000 24000.

Default('25 40 63 100 160 250 400 630 1000 1600 2500 4000 6300 10000 16000 24000')
taps Int

Set number of filter coefficients in output audio stream. Default value is 4096.

Default('4096')
sample_rate Int

Set sample rate of output audio stream, default is 44100.

Default('44100')
nb_samples Int

Set number of samples per each frame in output audio stream. Default is 1024.

Default('1024')
interp Int | Literal['linear', 'cubic'] | Default

Set interpolation method for FIR equalizer coefficients. Can be linear or cubic.

Default('linear')
phase Int | Literal['linear', 'min'] | Default

Set phase type of FIR filter. Can be linear or min: minimum-phase. Default is minimum-phase filter.

Default('min')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default AudioStream

the audio stream

References

FFmpeg Documentation

afirsrc

afirsrc(
    *,
    taps: Int = Default("1025"),
    frequency: String = Default("0 1"),
    magnitude: String = Default("1 1"),
    phase: String = Default("0 0"),
    sample_rate: Int = Default("44100"),
    nb_samples: Int = Default("1024"),
    win_func: (
        Int
        | Literal[
            "rect",
            "bartlett",
            "hann",
            "hanning",
            "hamming",
            "blackman",
            "welch",
            "flattop",
            "bharris",
            "bnuttall",
            "bhann",
            "sine",
            "nuttall",
            "lanczos",
            "gauss",
            "tukey",
            "dolph",
            "cauchy",
            "parzen",
            "poisson",
            "bohman",
            "kaiser",
        ]
        | Default
    ) = Default("blackman"),
    extra_options: dict[str, Any] | None = None
) -> AudioStream

Generate a FIR coefficients using frequency sampling method.

The resulting stream can be used with afir filter for filtering the audio signal.

The filter accepts the following options:

Parameters:

Name Type Description Default
taps Int

Set number of filter coefficients in output audio stream. Default value is 1025.

Default('1025')
frequency String

Set frequency points from where magnitude and phase are set. This must be in non decreasing order, and first element must be 0, while last element must be 1. Elements are separated by white spaces.

Default('0 1')
magnitude String

Set magnitude value for every frequency point set by frequency. Number of values must be same as number of frequency points. Values are separated by white spaces.

Default('1 1')
phase String

Set phase value for every frequency point set by frequency. Number of values must be same as number of frequency points. Values are separated by white spaces.

Default('0 0')
sample_rate Int

Set sample rate, default is 44100.

Default('44100')
nb_samples Int

Set number of samples per each frame. Default is 1024.

Default('1024')
win_func Int | Literal['rect', 'bartlett', 'hann', 'hanning', 'hamming', 'blackman', 'welch', 'flattop', 'bharris', 'bnuttall', 'bhann', 'sine', 'nuttall', 'lanczos', 'gauss', 'tukey', 'dolph', 'cauchy', 'parzen', 'poisson', 'bohman', 'kaiser'] | Default

Set window function. Default is blackman.

Default('blackman')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default AudioStream

the audio stream

References

FFmpeg Documentation

ainterleave

ainterleave(
    *streams: AudioStream,
    nb_inputs: Int = Auto("len(streams)"),
    duration: (
        Int
        | Literal["longest", "shortest", "first"]
        | Default
    ) = Default("longest"),
    extra_options: dict[str, Any] | None = None
) -> AudioStream

Temporally interleave frames from several inputs.

interleave works with video inputs, ainterleave with audio.

These filters read frames from several inputs and send the oldest queued frame to the output.

Input streams must have well defined, monotonically increasing frame timestamp values.

In order to submit one frame to output, these filters need to enqueue at least one frame for each input, so they cannot work in case one input is not yet terminated and will not receive incoming frames.

For example consider the case when one input is a select filter which always drops input frames. The interleave filter will keep reading from that input, but it will never be able to send new frames to output until the input sends an end-of-stream signal.

Also, depending on inputs synchronization, the filters will drop frames in case one input receives more frames than the other ones, and the queue is already filled.

These filters accept the following options:

Parameters:

Name Type Description Default
nb_inputs Int

Set the number of different inputs, it is 2 by default.

Auto('len(streams)')
duration Int | Literal['longest', 'shortest', 'first'] | Default

How to determine the end-of-stream. @end table

Default('longest')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default AudioStream

the audio stream

References

FFmpeg Documentation

allrgb

allrgb(
    *,
    rate: Video_rate = Default("25"),
    duration: Duration = Default("-0.000001"),
    sar: Rational = Default("1/1"),
    extra_options: dict[str, Any] | None = None
) -> VideoStream

The allrgb source returns frames of size 4096x4096 of all rgb colors.

The allyuv source returns frames of size 4096x4096 of all yuv colors.

The color source provides an uniformly colored input.

The colorchart source provides a colors checker chart.

The colorspectrum source provides a color spectrum input.

The haldclutsrc source provides an identity Hald CLUT. See also haldclut filter.

The nullsrc source returns unprocessed video frames. It is mainly useful to be employed in analysis / debugging tools, or as the source for filters which ignore the input data.

The pal75bars source generates a color bars pattern, based on EBU PAL recommendations with 75% color levels.

The pal100bars source generates a color bars pattern, based on EBU PAL recommendations with 100% color levels.

The rgbtestsrc source generates an RGB test pattern useful for detecting RGB vs BGR issues. You should see a red, green and blue stripe from top to bottom.

The smptebars source generates a color bars pattern, based on the SMPTE Engineering Guideline EG 1-1990.

The smptehdbars source generates a color bars pattern, based on the SMPTE RP 219-2002.

The testsrc source generates a test video pattern, showing a color pattern, a scrolling gradient and a timestamp. This is mainly intended for testing purposes.

The testsrc2 source is similar to testsrc, but supports more pixel formats instead of just rgb24. This allows using it as an input for other tests without requiring a format conversion.

The yuvtestsrc source generates an YUV test pattern. You should see a y, cb and cr stripe from top to bottom.

The sources accept the following parameters:

Parameters:

Name Type Description Default
rate Video_rate

Specify the frame rate of the sourced video, as the number of frames generated per second. It has to be a string in the format frame_rate_num/frame_rate_den, an integer number, a floating point number or a valid video frame rate abbreviation. The default value is "25".

Default('25')
duration Duration

Set the duration of the sourced video. See the Time duration section in the ffmpeg-utils(1) manual for the accepted syntax. If not specified, or the expressed duration is negative, the video is supposed to be generated forever. Since the frame rate is used as time base, all frames including the last one will have their full duration. If the specified duration is not a multiple of the frame duration, it will be rounded up.

Default('-0.000001')
sar Rational

Set the sample aspect ratio of the sourced video.

Default('1/1')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

allyuv

allyuv(
    *,
    rate: Video_rate = Default("25"),
    duration: Duration = Default("-0.000001"),
    sar: Rational = Default("1/1"),
    extra_options: dict[str, Any] | None = None
) -> VideoStream

The allrgb source returns frames of size 4096x4096 of all rgb colors.

The allyuv source returns frames of size 4096x4096 of all yuv colors.

The color source provides an uniformly colored input.

The colorchart source provides a colors checker chart.

The colorspectrum source provides a color spectrum input.

The haldclutsrc source provides an identity Hald CLUT. See also haldclut filter.

The nullsrc source returns unprocessed video frames. It is mainly useful to be employed in analysis / debugging tools, or as the source for filters which ignore the input data.

The pal75bars source generates a color bars pattern, based on EBU PAL recommendations with 75% color levels.

The pal100bars source generates a color bars pattern, based on EBU PAL recommendations with 100% color levels.

The rgbtestsrc source generates an RGB test pattern useful for detecting RGB vs BGR issues. You should see a red, green and blue stripe from top to bottom.

The smptebars source generates a color bars pattern, based on the SMPTE Engineering Guideline EG 1-1990.

The smptehdbars source generates a color bars pattern, based on the SMPTE RP 219-2002.

The testsrc source generates a test video pattern, showing a color pattern, a scrolling gradient and a timestamp. This is mainly intended for testing purposes.

The testsrc2 source is similar to testsrc, but supports more pixel formats instead of just rgb24. This allows using it as an input for other tests without requiring a format conversion.

The yuvtestsrc source generates an YUV test pattern. You should see a y, cb and cr stripe from top to bottom.

The sources accept the following parameters:

Parameters:

Name Type Description Default
rate Video_rate

Specify the frame rate of the sourced video, as the number of frames generated per second. It has to be a string in the format frame_rate_num/frame_rate_den, an integer number, a floating point number or a valid video frame rate abbreviation. The default value is "25".

Default('25')
duration Duration

Set the duration of the sourced video. See the Time duration section in the ffmpeg-utils(1) manual for the accepted syntax. If not specified, or the expressed duration is negative, the video is supposed to be generated forever. Since the frame rate is used as time base, all frames including the last one will have their full duration. If the specified duration is not a multiple of the frame duration, it will be rounded up.

Default('-0.000001')
sar Rational

Set the sample aspect ratio of the sourced video.

Default('1/1')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

amerge

amerge(
    *streams: AudioStream,
    inputs: Int = Auto("len(streams)"),
    layout_mode: (
        Int | Literal["legacy", "reset", "normal"] | Default
    ) = Default("legacy"),
    extra_options: dict[str, Any] | None = None
) -> AudioStream

Merge two or more audio streams into a single multi-channel stream.

All inputs must have the same sample rate, and format.

If inputs do not have the same duration, the output will stop with the shortest.

The filter accepts the following options:

Parameters:

Name Type Description Default
inputs Int

Set the number of inputs. Default is 2.

Auto('len(streams)')
layout_mode Int | Literal['legacy', 'reset', 'normal'] | Default

This option controls how the output channel layout is determined and if the audio channels are reordered during merge. @end table

Default('legacy')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default AudioStream

the audio stream

References

FFmpeg Documentation

amix

amix(
    *streams: AudioStream,
    inputs: Int = Auto("len(streams)"),
    duration: (
        Int
        | Literal["longest", "shortest", "first"]
        | Default
    ) = Default("longest"),
    dropout_transition: Float = Default("2"),
    weights: String = Default("1 1"),
    normalize: Boolean = Default("true"),
    extra_options: dict[str, Any] | None = None
) -> AudioStream

Mixes multiple audio inputs into a single output.

Note that this filter only supports float samples (the amerge and pan audio filters support many formats). If the amix input has integer samples then aresample will be automatically inserted to perform the conversion to float samples.

It accepts the following parameters:

Parameters:

Name Type Description Default
inputs Int

The number of inputs. If unspecified, it defaults to 2.

Auto('len(streams)')
duration Int | Literal['longest', 'shortest', 'first'] | Default

How to determine the end-of-stream. @end table

Default('longest')
dropout_transition Float

The transition time, in seconds, for volume renormalization when an input stream ends. The default value is 2 seconds.

Default('2')
weights String

Set weight for each input. (default "1 1")

Default('1 1')
normalize Boolean

Syntax is same as option with same name.

Default('true')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default AudioStream

the audio stream

References

FFmpeg Documentation

amovie

amovie(
    *,
    filename: String = Default(None),
    format_name: String = Default(None),
    stream_index: Int = Default("-1"),
    seek_point: Double = Default("0"),
    streams: String = Default(None),
    loop: Int = Default("1"),
    discontinuity: Duration = Default("0"),
    dec_threads: Int = Default("0"),
    format_opts: Dictionary = Default(None),
    extra_options: dict[str, Any] | None = None
) -> FilterNode

This is the same as movie source, except it selects an audio stream by default.

Parameters:

Name Type Description Default
filename String
Default(None)
format_name String

set format name

Default(None)
stream_index Int

set stream index (from -1 to INT_MAX) (default -1)

Default('-1')
seek_point Double

set seekpoint (seconds) (from 0 to 9.22337e+12) (default 0)

Default('0')
streams String

set streams

Default(None)
loop Int

set loop count (from 0 to INT_MAX) (default 1)

Default('1')
discontinuity Duration

set discontinuity threshold (default 0)

Default('0')
dec_threads Int

set the number of threads for decoding (from 0 to INT_MAX) (default 0)

Default('0')
format_opts Dictionary

set format options for the opened file

Default(None)
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
filter_node FilterNode

the filter node

References

FFmpeg Documentation

anoisesrc

anoisesrc(
    *,
    sample_rate: Int = Default("48000"),
    amplitude: Double = Default("1"),
    duration: Duration = Default("0"),
    color: (
        Int
        | Literal[
            "white",
            "pink",
            "brown",
            "blue",
            "violet",
            "velvet",
        ]
        | Default
    ) = Default("white"),
    seed: Int64 = Default("-1"),
    nb_samples: Int = Default("1024"),
    density: Double = Default("0.05"),
    extra_options: dict[str, Any] | None = None
) -> AudioStream

Generate a noise audio signal.

The filter accepts the following options:

Parameters:

Name Type Description Default
sample_rate Int

Specify the sample rate. Default value is 48000 Hz.

Default('48000')
amplitude Double

Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value is 1.0.

Default('1')
duration Duration

Specify the duration of the generated audio stream. Not specifying this option results in noise with an infinite length.

Default('0')
color Int | Literal['white', 'pink', 'brown', 'blue', 'violet', 'velvet'] | Default

Specify the color of noise. Available noise colors are white, pink, brown, blue, violet and velvet. Default color is white.

Default('white')
seed Int64

Specify a value used to seed the PRNG.

Default('-1')
nb_samples Int

Set the number of samples per each output frame, default is 1024.

Default('1024')
density Double

Set the density (0.0 - 1.0) for the velvet noise generator, default is 0.05.

Default('0.05')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default AudioStream

the audio stream

References

FFmpeg Documentation

anullsrc

anullsrc(
    *,
    channel_layout: String = Default("stereo"),
    sample_rate: Int = Default("44100"),
    nb_samples: Int = Default("1024"),
    duration: Duration = Default("-0.000001"),
    extra_options: dict[str, Any] | None = None
) -> AudioStream

The null audio source, return unprocessed audio frames. It is mainly useful as a template and to be employed in analysis / debugging tools, or as the source for filters which ignore the input data (for example the sox synth filter).

This source accepts the following options:

Parameters:

Name Type Description Default
channel_layout String

Specifies the channel layout, and can be either an integer or a string representing a channel layout. The default value of channel_layout is "stereo". Check the channel_layout_map definition in libavutil/channel_layout.c for the mapping between strings and channel layout values.

Default('stereo')
sample_rate Int

Specifies the sample rate, and defaults to 44100.

Default('44100')
nb_samples Int

Set the number of samples per requested frames.

Default('1024')
duration Duration

Set the duration of the sourced audio. See the Time duration section in the ffmpeg-utils(1) manual for the accepted syntax. If not specified, or the expressed duration is negative, the audio is supposed to be generated forever.

Default('-0.000001')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default AudioStream

the audio stream

References

FFmpeg Documentation

astreamselect

astreamselect(
    *streams: AudioStream,
    inputs: Int = Auto("len(streams)"),
    map: String = Default(None),
    extra_options: dict[str, Any] | None = None
) -> FilterNode

Select video or audio streams.

The filter accepts the following options:

Parameters:

Name Type Description Default
inputs Int

Set number of inputs. Default is 2.

Auto('len(streams)')
map String

Set input indexes to remap to outputs.

Default(None)
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
filter_node FilterNode

the filter node

References

FFmpeg Documentation

avsynctest

avsynctest(
    *,
    size: Image_size = Default("hd720"),
    framerate: Video_rate = Default("30"),
    samplerate: Int = Default("44100"),
    amplitude: Float = Default("0.7"),
    period: Int = Default("3"),
    delay: Int = Default("0"),
    cycle: Boolean = Default("false"),
    duration: Duration = Default("0"),
    fg: Color = Default("white"),
    bg: Color = Default("black"),
    ag: Color = Default("gray"),
    extra_options: dict[str, Any] | None = None
) -> tuple[AudioStream, VideoStream]

Generate an Audio/Video Sync Test.

Generated stream periodically shows flash video frame and emits beep in audio. Useful to inspect A/V sync issues.

It accepts the following options:

Parameters:

Name Type Description Default
size Image_size

Set output video size. Default value is hd720.

Default('hd720')
framerate Video_rate

Set output video frame rate. Default value is 30.

Default('30')
samplerate Int

Set output audio sample rate. Default value is 44100.

Default('44100')
amplitude Float

Set output audio beep amplitude. Default value is 0.7.

Default('0.7')
period Int

Set output audio beep period in seconds. Default value is 3.

Default('3')
delay Int

Set output video flash delay in number of frames. Default value is 0.

Default('0')
cycle Boolean

Enable cycling of video delays, by default is disabled.

Default('false')
duration Duration

Set stream output duration. By default duration is unlimited.

Default('0')
fg Color

Set foreground/background/additional color.

Default('white')
bg Color

Set foreground/background/additional color.

Default('black')
ag Color

Set foreground/background/additional color.

Default('gray')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
audio AudioStream

the audio stream

video VideoStream

the video stream

References

FFmpeg Documentation

bm3d

bm3d(
    *streams: VideoStream,
    sigma: Float = Default("1"),
    block: Int = Default("16"),
    bstep: Int = Default("4"),
    group: Int = Default("1"),
    range: Int = Default("9"),
    mstep: Int = Default("1"),
    thmse: Float = Default("0"),
    hdthr: Float = Default("2.7"),
    estim: (
        Int | Literal["basic", "final"] | Default
    ) = Default("basic"),
    ref: Boolean = Default("false"),
    planes: Int = Default("7"),
    timeline_options: FFMpegTimelineOption | None = None,
    enable: str | None = None,
    extra_options: dict[str, Any] | None = None
) -> VideoStream

Denoise frames using Block-Matching 3D algorithm.

The filter accepts the following options.

Parameters:

Name Type Description Default
sigma Float

Set denoising strength. Default value is 1. Allowed range is from 0 to 999.9. The denoising algorithm is very sensitive to sigma, so adjust it according to the source.

Default('1')
block Int

Set local patch size. This sets dimensions in 2D.

Default('16')
bstep Int

Set sliding step for processing blocks. Default value is 4. Allowed range is from 1 to 64. Smaller values allows processing more reference blocks and is slower.

Default('4')
group Int

Set maximal number of similar blocks for 3rd dimension. Default value is 1. When set to 1, no block matching is done. Larger values allows more blocks in single group. Allowed range is from 1 to 256.

Default('1')
range Int

Set radius for search block matching. Default is 9. Allowed range is from 1 to INT32_MAX.

Default('9')
mstep Int

Set step between two search locations for block matching. Default is 1. Allowed range is from 1 to 64. Smaller is slower.

Default('1')
thmse Float

Set threshold of mean square error for block matching. Valid range is 0 to INT32_MAX.

Default('0')
hdthr Float

Set thresholding parameter for hard thresholding in 3D transformed domain. Larger values results in stronger hard-thresholding filtering in frequency domain.

Default('2.7')
estim Int | Literal['basic', 'final'] | Default

Set filtering estimation mode. Can be basic or final. Default is basic.

Default('basic')
ref Boolean

If enabled, filter will use 2nd stream for block matching. Default is disabled for basic value of estim option, and always enabled if value of estim is final.

Default('false')
planes Int

Set planes to filter. Default is all available except alpha.

Default('7')
timeline_options FFMpegTimelineOption | None

Timeline options

None
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

buffer

buffer(
    *,
    width: Int = Default("0"),
    video_size: Image_size = Default(None),
    height: Int = Default("0"),
    pix_fmt: Pix_fmt = Default("none"),
    sar: Rational = Default("0/1"),
    time_base: Rational = Default("0/1"),
    colorspace: (
        Int
        | Literal[
            "gbr",
            "bt709",
            "unknown",
            "fcc",
            "bt470bg",
            "smpte170m",
            "smpte240m",
            "ycgco",
            "ycgco-re",
            "ycgco-ro",
            "bt2020nc",
            "bt2020c",
            "smpte2085",
            "chroma-derived-nc",
            "chroma-derived-c",
            "ictcp",
            "ipt-c2",
        ]
        | Default
    ) = Default("unknown"),
    range: (
        Int
        | Literal[
            "unspecified",
            "unknown",
            "limited",
            "tv",
            "mpeg",
            "full",
            "pc",
            "jpeg",
        ]
        | Default
    ) = Default("unspecified"),
    alpha_mode: (
        Int
        | Literal[
            "unspecified",
            "unknown",
            "straight",
            "premultiplied",
        ]
        | Default
    ) = Default("unspecified"),
    extra_options: dict[str, Any] | None = None
) -> VideoStream

Buffer video frames, and make them available to the filter chain.

This source is mainly intended for a programmatic use, in particular through the interface defined in libavfilter/buffersrc.h.

It accepts the following parameters:

Parameters:

Name Type Description Default
width Int

The input video width.

Default('0')
video_size Image_size

Specify the size (width and height) of the buffered video frames. For the syntax of this option, check the "Video size" section in the ffmpeg-utils manual.

Default(None)
height Int

The input video height.

Default('0')
pix_fmt Pix_fmt

A string representing the pixel format of the buffered video frames. It may be a number corresponding to a pixel format, or a pixel format name.

Default('none')
sar Rational

The sample (pixel) aspect ratio of the input video.

Default('0/1')
time_base Rational

Specify the timebase assumed by the timestamps of the buffered frames.

Default('0/1')
colorspace Int | Literal['gbr', 'bt709', 'unknown', 'fcc', 'bt470bg', 'smpte170m', 'smpte240m', 'ycgco', 'ycgco-re', 'ycgco-ro', 'bt2020nc', 'bt2020c', 'smpte2085', 'chroma-derived-nc', 'chroma-derived-c', 'ictcp', 'ipt-c2'] | Default

A string representing the color space of the buffered video frames. It may be a number corresponding to a color space, or a color space name.

Default('unknown')
range Int | Literal['unspecified', 'unknown', 'limited', 'tv', 'mpeg', 'full', 'pc', 'jpeg'] | Default

A string representing the color range of the buffered video frames. It may be a number corresponding to a color range, or a color range name.

Default('unspecified')
alpha_mode Int | Literal['unspecified', 'unknown', 'straight', 'premultiplied'] | Default

A string representing the alpha mode of the buffered video frames. It may be a number corresponding to an alpha mode, or an alpha mode name.

Default('unspecified')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

cellauto

cellauto(
    *,
    filename: String = Default(None),
    pattern: String = Default(None),
    rate: Video_rate = Default("25"),
    size: Image_size = Default(None),
    rule: Int = Default("110"),
    random_fill_ratio: Double = Default("0.618034"),
    random_seed: Int64 = Default("-1"),
    scroll: Boolean = Default("true"),
    start_full: Boolean = Default("false"),
    full: Boolean = Default("true"),
    stitch: Boolean = Default("true"),
    extra_options: dict[str, Any] | None = None
) -> VideoStream

Create a pattern generated by an elementary cellular automaton.

The initial state of the cellular automaton can be defined through the filename and pattern options. If such options are not specified an initial state is created randomly.

At each new frame a new row in the video is filled with the result of the cellular automaton next generation. The behavior when the whole frame is filled is defined by the scroll option.

This source accepts the following options:

Parameters:

Name Type Description Default
filename String

Read the initial cellular automaton state, i.e. the starting row, from the specified file. In the file, each non-whitespace character is considered an alive cell, a newline will terminate the row, and further characters in the file will be ignored.

Default(None)
pattern String

Read the initial cellular automaton state, i.e. the starting row, from the specified string. Each non-whitespace character in the string is considered an alive cell, a newline will terminate the row, and further characters in the string will be ignored.

Default(None)
rate Video_rate

Set the video rate, that is the number of frames generated per second. Default is 25.

Default('25')
size Image_size

Set the size of the output video. For the syntax of this option, check the "Video size" section in the ffmpeg-utils manual. If filename or pattern is specified, the size is set by default to the width of the specified initial state row, and the height is set to width * PHI. If size is set, it must contain the width of the specified pattern string, and the specified pattern will be centered in the larger row. If a filename or a pattern string is not specified, the size value defaults to "320x518" (used for a randomly generated initial state).

Default(None)
rule Int

Set the cellular automaton rule, it is a number ranging from 0 to 255. Default value is 110.

Default('110')
random_fill_ratio Double

Set the random fill ratio for the initial cellular automaton row. It is a floating point number value ranging from 0 to 1, defaults to 1/PHI. This option is ignored when a file or a pattern is specified.

Default('0.618034')
random_seed Int64

Set the seed for filling randomly the initial row, must be an integer included between 0 and UINT32_MAX. If not specified, or if explicitly set to -1, the filter will try to use a good random seed on a best effort basis.

Default('-1')
scroll Boolean

If set to 1, scroll the output upward when all the rows in the output have been already filled. If set to 0, the new generated row will be written over the top row just after the bottom row is filled. Defaults to 1.

Default('true')
start_full Boolean

If set to 1, completely fill the output with generated rows before outputting the first frame. This is the default behavior, for disabling set the value to 0.

Default('false')
full Boolean

If set to 1, completely fill the output with generated rows before outputting the first frame. This is the default behavior, for disabling set the value to 0.

Default('true')
stitch Boolean

If set to 1, stitch the left and right row edges together. This is the default behavior, for disabling set the value to 0.

Default('true')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

color

color(
    *,
    color: Color = Default("black"),
    size: Image_size = Default("320x240"),
    rate: Video_rate = Default("25"),
    duration: Duration = Default("-0.000001"),
    sar: Rational = Default("1/1"),
    extra_options: dict[str, Any] | None = None
) -> VideoStream

The allrgb source returns frames of size 4096x4096 of all rgb colors.

The allyuv source returns frames of size 4096x4096 of all yuv colors.

The color source provides an uniformly colored input.

The colorchart source provides a colors checker chart.

The colorspectrum source provides a color spectrum input.

The haldclutsrc source provides an identity Hald CLUT. See also haldclut filter.

The nullsrc source returns unprocessed video frames. It is mainly useful to be employed in analysis / debugging tools, or as the source for filters which ignore the input data.

The pal75bars source generates a color bars pattern, based on EBU PAL recommendations with 75% color levels.

The pal100bars source generates a color bars pattern, based on EBU PAL recommendations with 100% color levels.

The rgbtestsrc source generates an RGB test pattern useful for detecting RGB vs BGR issues. You should see a red, green and blue stripe from top to bottom.

The smptebars source generates a color bars pattern, based on the SMPTE Engineering Guideline EG 1-1990.

The smptehdbars source generates a color bars pattern, based on the SMPTE RP 219-2002.

The testsrc source generates a test video pattern, showing a color pattern, a scrolling gradient and a timestamp. This is mainly intended for testing purposes.

The testsrc2 source is similar to testsrc, but supports more pixel formats instead of just rgb24. This allows using it as an input for other tests without requiring a format conversion.

The yuvtestsrc source generates an YUV test pattern. You should see a y, cb and cr stripe from top to bottom.

The sources accept the following parameters:

Parameters:

Name Type Description Default
color Color

Set the color of the created image. Accepts the same syntax of the corresponding color option.

Default('black')
size Image_size

Specify the size of the sourced video. For the syntax of this option, check the "Video size" section in the ffmpeg-utils manual. The default value is 320x240. This option is not available with the allrgb, allyuv, and haldclutsrc filters.

Default('320x240')
rate Video_rate

Specify the frame rate of the sourced video, as the number of frames generated per second. It has to be a string in the format frame_rate_num/frame_rate_den, an integer number, a floating point number or a valid video frame rate abbreviation. The default value is "25".

Default('25')
duration Duration

Set the duration of the sourced video. See the Time duration section in the ffmpeg-utils(1) manual for the accepted syntax. If not specified, or the expressed duration is negative, the video is supposed to be generated forever. Since the frame rate is used as time base, all frames including the last one will have their full duration. If the specified duration is not a multiple of the frame duration, it will be rounded up.

Default('-0.000001')
sar Rational

Set the sample aspect ratio of the sourced video.

Default('1/1')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

color_vulkan

color_vulkan(
    *,
    color: Color = Default("black"),
    size: Image_size = Default("1920x1080"),
    rate: Video_rate = Default("60"),
    duration: Duration = Default("-0.000001"),
    sar: Rational = Default("1/1"),
    format: String = Default(None),
    out_range: (
        Int
        | Literal[
            "full", "limited", "jpeg", "mpeg", "tv", "pc"
        ]
        | Default
    ) = Default("0) (from 0 to 2) (default 0"),
    extra_options: dict[str, Any] | None = None
) -> VideoStream

Video source that creates a Vulkan frame of a solid color. Useful for benchmarking, or overlaying.

It accepts the following parameters:

Parameters:

Name Type Description Default
color Color

The color to use. Either a name, or a hexadecimal value. The default value is black.

Default('black')
size Image_size

The size of the output frame. Default value is 1920x1080.

Default('1920x1080')
rate Video_rate

The framerate to output at. Default value is 60 frames per second.

Default('60')
duration Duration

The video duration. Default value is -0.000001.

Default('-0.000001')
sar Rational

The video signal aspect ratio. Default value is 1/1.

Default('1/1')
format String

The pixel format of the output Vulkan frames. Default value is yuv444p.

Default(None)
out_range Int | Literal['full', 'limited', 'jpeg', 'mpeg', 'tv', 'pc'] | Default

Set the output YCbCr sample range. This allows the autodetected value to be overridden as well as allows forcing a specific value used for the output and encoder. If not specified, the range depends on the pixel format. Possible values: @end table

Default('0) (from 0 to 2) (default 0')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

colorchart

colorchart(
    *,
    rate: Video_rate = Default("25"),
    duration: Duration = Default("-0.000001"),
    sar: Rational = Default("1/1"),
    patch_size: Image_size = Default("64x64"),
    preset: (
        Int | Literal["reference", "skintones"] | Default
    ) = Default("reference"),
    extra_options: dict[str, Any] | None = None
) -> VideoStream

The allrgb source returns frames of size 4096x4096 of all rgb colors.

The allyuv source returns frames of size 4096x4096 of all yuv colors.

The color source provides an uniformly colored input.

The colorchart source provides a colors checker chart.

The colorspectrum source provides a color spectrum input.

The haldclutsrc source provides an identity Hald CLUT. See also haldclut filter.

The nullsrc source returns unprocessed video frames. It is mainly useful to be employed in analysis / debugging tools, or as the source for filters which ignore the input data.

The pal75bars source generates a color bars pattern, based on EBU PAL recommendations with 75% color levels.

The pal100bars source generates a color bars pattern, based on EBU PAL recommendations with 100% color levels.

The rgbtestsrc source generates an RGB test pattern useful for detecting RGB vs BGR issues. You should see a red, green and blue stripe from top to bottom.

The smptebars source generates a color bars pattern, based on the SMPTE Engineering Guideline EG 1-1990.

The smptehdbars source generates a color bars pattern, based on the SMPTE RP 219-2002.

The testsrc source generates a test video pattern, showing a color pattern, a scrolling gradient and a timestamp. This is mainly intended for testing purposes.

The testsrc2 source is similar to testsrc, but supports more pixel formats instead of just rgb24. This allows using it as an input for other tests without requiring a format conversion.

The yuvtestsrc source generates an YUV test pattern. You should see a y, cb and cr stripe from top to bottom.

The sources accept the following parameters:

Parameters:

Name Type Description Default
rate Video_rate

Specify the frame rate of the sourced video, as the number of frames generated per second. It has to be a string in the format frame_rate_num/frame_rate_den, an integer number, a floating point number or a valid video frame rate abbreviation. The default value is "25".

Default('25')
duration Duration

Set the duration of the sourced video. See the Time duration section in the ffmpeg-utils(1) manual for the accepted syntax. If not specified, or the expressed duration is negative, the video is supposed to be generated forever. Since the frame rate is used as time base, all frames including the last one will have their full duration. If the specified duration is not a multiple of the frame duration, it will be rounded up.

Default('-0.000001')
sar Rational

Set the sample aspect ratio of the sourced video.

Default('1/1')
patch_size Image_size

Set patch size of single color patch, only available in the colorchart source. Default is 64x64.

Default('64x64')
preset Int | Literal['reference', 'skintones'] | Default

Set colorchecker colors preset, only available in the colorchart source. Available values are: @end table Default value is reference.

Default('reference')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

colorspectrum

colorspectrum(
    *,
    size: Image_size = Default("320x240"),
    rate: Video_rate = Default("25"),
    duration: Duration = Default("-0.000001"),
    sar: Rational = Default("1/1"),
    type: (
        Int | Literal["black", "white", "all"] | Default
    ) = Default("black"),
    extra_options: dict[str, Any] | None = None
) -> VideoStream

The allrgb source returns frames of size 4096x4096 of all rgb colors.

The allyuv source returns frames of size 4096x4096 of all yuv colors.

The color source provides an uniformly colored input.

The colorchart source provides a colors checker chart.

The colorspectrum source provides a color spectrum input.

The haldclutsrc source provides an identity Hald CLUT. See also haldclut filter.

The nullsrc source returns unprocessed video frames. It is mainly useful to be employed in analysis / debugging tools, or as the source for filters which ignore the input data.

The pal75bars source generates a color bars pattern, based on EBU PAL recommendations with 75% color levels.

The pal100bars source generates a color bars pattern, based on EBU PAL recommendations with 100% color levels.

The rgbtestsrc source generates an RGB test pattern useful for detecting RGB vs BGR issues. You should see a red, green and blue stripe from top to bottom.

The smptebars source generates a color bars pattern, based on the SMPTE Engineering Guideline EG 1-1990.

The smptehdbars source generates a color bars pattern, based on the SMPTE RP 219-2002.

The testsrc source generates a test video pattern, showing a color pattern, a scrolling gradient and a timestamp. This is mainly intended for testing purposes.

The testsrc2 source is similar to testsrc, but supports more pixel formats instead of just rgb24. This allows using it as an input for other tests without requiring a format conversion.

The yuvtestsrc source generates an YUV test pattern. You should see a y, cb and cr stripe from top to bottom.

The sources accept the following parameters:

Parameters:

Name Type Description Default
size Image_size

Specify the size of the sourced video. For the syntax of this option, check the "Video size" section in the ffmpeg-utils manual. The default value is 320x240. This option is not available with the allrgb, allyuv, and haldclutsrc filters.

Default('320x240')
rate Video_rate

Specify the frame rate of the sourced video, as the number of frames generated per second. It has to be a string in the format frame_rate_num/frame_rate_den, an integer number, a floating point number or a valid video frame rate abbreviation. The default value is "25".

Default('25')
duration Duration

Set the duration of the sourced video. See the Time duration section in the ffmpeg-utils(1) manual for the accepted syntax. If not specified, or the expressed duration is negative, the video is supposed to be generated forever. Since the frame rate is used as time base, all frames including the last one will have their full duration. If the specified duration is not a multiple of the frame duration, it will be rounded up.

Default('-0.000001')
sar Rational

Set the sample aspect ratio of the sourced video.

Default('1/1')
type Int | Literal['black', 'white', 'all'] | Default

Set the type of the color spectrum, only available in the colorspectrum source. Can be one of the following: @end table

Default('black')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

concat

concat(
    *streams: FilterableStream,
    n: Int = Auto("len(streams) // (int(v) + int(a))"),
    v: Int = Default("1"),
    a: Int = Default("0"),
    unsafe: Boolean = Default("false"),
    extra_options: dict[str, Any] | None = None
) -> FilterNode

Concatenate audio and video streams, joining them together one after the other.

The filter works on segments of synchronized video and audio streams. All segments must have the same number of streams of each type, and that will also be the number of streams at output.

The filter accepts the following options:

Parameters:

Name Type Description Default
n Int

Set the number of segments. Default is 2.

Auto('len(streams) // (int(v) + int(a))')
v Int

Set the number of output video streams, that is also the number of video streams in each segment. Default is 1.

Default('1')
a Int

Set the number of output audio streams, that is also the number of audio streams in each segment. Default is 0.

Default('0')
unsafe Boolean

Activate unsafe mode: do not fail if segments have a different format.

Default('false')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
filter_node FilterNode

the filter node

References

FFmpeg Documentation

decimate

decimate(
    *streams: VideoStream,
    cycle: Int = Default("5"),
    dupthresh: Double = Default("1.1"),
    scthresh: Double = Default("15"),
    blockx: Int = Default("32"),
    blocky: Int = Default("32"),
    ppsrc: Boolean = Default("false"),
    chroma: Boolean = Default("true"),
    mixed: Boolean = Default("false"),
    extra_options: dict[str, Any] | None = None
) -> VideoStream

Drop duplicated frames at regular intervals.

The filter accepts the following options:

Parameters:

Name Type Description Default
cycle Int

Set the number of frames from which one will be dropped. Setting this to N means one frame in every batch of N frames will be dropped. Default is 5.

Default('5')
dupthresh Double

Set the threshold for duplicate detection. If the difference metric for a frame is less than or equal to this value, then it is declared as duplicate. Default is 1.1

Default('1.1')
scthresh Double

Set scene change threshold. Default is 15.

Default('15')
blockx Int

set the size of the x-axis blocks used during metric calculations (from 4 to 512) (default 32)

Default('32')
blocky Int

Set the size of the x and y-axis blocks used during metric calculations. Larger blocks give better noise suppression, but also give worse detection of small movements. Must be a power of two. Default is 32.

Default('32')
ppsrc Boolean

Mark main input as a pre-processed input and activate clean source input stream. This allows the input to be pre-processed with various filters to help the metrics calculation while keeping the frame selection lossless. When set to 1, the first stream is for the pre-processed input, and the second stream is the clean source from where the kept frames are chosen. Default is 0.

Default('false')
chroma Boolean

Set whether or not chroma is considered in the metric calculations. Default is 1.

Default('true')
mixed Boolean

Set whether or not the input only partially contains content to be decimated. Default is false. If enabled video output stream will be in variable frame rate.

Default('false')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

fieldmatch

fieldmatch(
    *streams: VideoStream,
    order: (
        Int | Literal["auto", "bff", "tff"] | Default
    ) = Default("auto"),
    mode: (
        Int
        | Literal[
            "pc", "pc_n", "pc_u", "pc_n_ub", "pcn", "pcn_ub"
        ]
        | Default
    ) = Default("pc_n"),
    ppsrc: Boolean = Default("false"),
    field: (
        Int | Literal["auto", "bottom", "top"] | Default
    ) = Default("auto"),
    mchroma: Boolean = Default("true"),
    y0: Int = Default("0"),
    scthresh: Double = Default("12"),
    combmatch: (
        Int | Literal["none", "sc", "full"] | Default
    ) = Default("sc"),
    combdbg: (
        Int | Literal["none", "pcn", "pcnub"] | Default
    ) = Default("none"),
    cthresh: Int = Default("9"),
    chroma: Boolean = Default("false"),
    blockx: Int = Default("16"),
    blocky: Int = Default("16"),
    combpel: Int = Default("80"),
    extra_options: dict[str, Any] | None = None
) -> VideoStream

Field matching filter for inverse telecine. It is meant to reconstruct the progressive frames from a telecined stream. The filter does not drop duplicated frames, so to achieve a complete inverse telecine fieldmatch needs to be followed by a decimation filter such as decimate in the filtergraph.

The separation of the field matching and the decimation is notably motivated by the possibility of inserting a de-interlacing filter fallback between the two. If the source has mixed telecined and real interlaced content, fieldmatch will not be able to match fields for the interlaced parts. But these remaining combed frames will be marked as interlaced, and thus can be de-interlaced by a later filter such as yadif before decimation.

In addition to the various configuration options, fieldmatch can take an optional second stream, activated through the ppsrc option. If enabled, the frames reconstruction will be based on the fields and frames from this second stream. This allows the first input to be pre-processed in order to help the various algorithms of the filter, while keeping the output lossless (assuming the fields are matched properly). Typically, a field-aware denoiser, or brightness/contrast adjustments can help.

Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project) and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from which fieldmatch is based on. While the semantic and usage are very close, some behaviour and options names can differ.

The decimate filter currently only works for constant frame rate input. If your input has mixed telecined (30fps) and progressive content with a lower framerate like 24fps use the following filterchain to produce the necessary cfr stream: dejudder,fps=30000/1001,fieldmatch,decimate.

The filter accepts the following options:

Parameters:

Name Type Description Default
order Int | Literal['auto', 'bff', 'tff'] | Default

Specify the assumed field order of the input stream. Available values are: @end table Note that it is sometimes recommended not to trust the parity announced by the stream. Default value is auto.

Default('auto')
mode Int | Literal['pc', 'pc_n', 'pc_u', 'pc_n_ub', 'pcn', 'pcn_ub'] | Default

Set the matching mode or strategy to use. pc mode is the safest in the sense that it won't risk creating jerkiness due to duplicate frames when possible, but if there are bad edits or blended fields it will end up outputting combed frames when a good match might actually exist. On the other hand, pcn_ub mode is the most risky in terms of creating jerkiness, but will almost always find a good frame if there is one. The other values are all somewhere in between pc and pcn_ub in terms of risking jerkiness and creating duplicate frames versus finding good matches in sections with bad edits, orphaned fields, blended fields, etc. More details about p/c/n/u/b are available in p/c/n/u/b meaning section. Available values are: @end table The parenthesis at the end indicate the matches that would be used for that mode assuming order=tff (and field on auto or top). In terms of speed pc mode is by far the fastest and pcn_ub is the slowest. Default value is pc_n.

Default('pc_n')
ppsrc Boolean

Mark the main input stream as a pre-processed input, and enable the secondary input stream as the clean source to pick the fields from. See the filter introduction for more details. It is similar to the clip2 feature from VFM/TFM. Default value is 0 (disabled).

Default('false')
field Int | Literal['auto', 'bottom', 'top'] | Default

Set the field to match from. It is recommended to set this to the same value as order unless you experience matching failures with that setting. In certain circumstances changing the field that is used to match from can have a large impact on matching performance. Available values are: @end table Default value is auto.

Default('auto')
mchroma Boolean

Set whether or not chroma is included during the match comparisons. In most cases it is recommended to leave this enabled. You should set this to 0 only if your clip has bad chroma problems such as heavy rainbowing or other artifacts. Setting this to 0 could also be used to speed things up at the cost of some accuracy. Default value is 1.

Default('true')
y0 Int

define an exclusion band which excludes the lines between y0 and y1 from the field matching decision (from 0 to INT_MAX) (default 0)

Default('0')
scthresh Double

Set the scene change detection threshold as a percentage of maximum change on the luma plane. Good values are in the [8.0, 14.0] range. Scene change detection is only relevant in case combmatch=sc. The range for scthresh is [0.0, 100.0]. Default value is 12.0.

Default('12')
combmatch Int | Literal['none', 'sc', 'full'] | Default

When combatch is not none, fieldmatch will take into account the combed scores of matches when deciding what match to use as the final match. Available values are: @end table Default is sc.

Default('sc')
combdbg Int | Literal['none', 'pcn', 'pcnub'] | Default

Force fieldmatch to calculate the combed metrics for certain matches and print them. This setting is known as micout in TFM/VFM vocabulary. Available values are: @end table Default value is none.

Default('none')
cthresh Int

This is the area combing threshold used for combed frame detection. This essentially controls how "strong" or "visible" combing must be to be detected. Larger values mean combing must be more visible and smaller values mean combing can be less visible or strong and still be detected. Valid settings are from -1 (every pixel will be detected as combed) to 255 (no pixel will be detected as combed). This is basically a pixel difference value. A good range is [8, 12]. Default value is 9.

Default('9')
chroma Boolean

Sets whether or not chroma is considered in the combed frame decision. Only disable this if your source has chroma problems (rainbowing, etc.) that are causing problems for the combed frame detection with chroma enabled. Actually, using chroma=0 is usually more reliable, except for the case where there is chroma only combing in the source. Default value is 0.

Default('false')
blockx Int

set the x-axis size of the window used during combed frame detection (from 4 to 512) (default 16)

Default('16')
blocky Int

Respectively set the x-axis and y-axis size of the window used during combed frame detection. This has to do with the size of the area in which combpel pixels are required to be detected as combed for a frame to be declared combed. See the combpel parameter description for more info. Possible values are any number that is a power of 2 starting at 4 and going up to 512. Default value is 16.

Default('16')
combpel Int

The number of combed pixels inside any of the blocky by blockx size blocks on the frame for the frame to be detected as combed. While cthresh controls how "visible" the combing must be, this setting controls "how much" combing there must be in any localized area (a window defined by the blockx and blocky settings) on the frame. Minimum value is 0 and maximum is blocky x blockx (at which point no frames will ever be detected as combed). This setting is known as MI in TFM/VFM vocabulary. Default value is 80.

Default('80')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

flite

flite(
    *,
    list_voices: Boolean = Default("false"),
    nb_samples: Int = Default("512"),
    text: String = Default(None),
    textfile: String = Default(None),
    v: String = Default("kal"),
    extra_options: dict[str, Any] | None = None
) -> AudioStream

Synthesize a voice utterance using the libflite library.

To enable compilation of this filter you need to configure FFmpeg with --enable-libflite.

Note that versions of the flite library prior to 2.0 are not thread-safe.

The filter accepts the following options:

Parameters:

Name Type Description Default
list_voices Boolean

If set to 1, list the names of the available voices and exit immediately. Default value is 0.

Default('false')
nb_samples Int

Set the maximum number of samples per frame. Default value is 512.

Default('512')
text String

Set the text to speak.

Default(None)
textfile String

Set the filename containing the text to speak.

Default(None)
v String

Set the voice to use for the speech synthesis. Default value is kal. See also the list_voices option.

Default('kal')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default AudioStream

the audio stream

References

FFmpeg Documentation

frei0r_src

frei0r_src(
    *,
    size: Image_size = Default("320x240"),
    framerate: Video_rate = Default("25"),
    filter_name: String = Default(None),
    extra_options: dict[str, Any] | None = None
) -> VideoStream

Provide a frei0r source.

To enable compilation of this filter you need to install the frei0r header and configure FFmpeg with --enable-frei0r.

This source accepts the following parameters:

Parameters:

Name Type Description Default
size Image_size

The size of the video to generate. For the syntax of this option, check the "Video size" section in the ffmpeg-utils manual.

Default('320x240')
framerate Video_rate

The framerate of the generated video. It may be a string of the form num/den or a frame rate abbreviation.

Default('25')
filter_name String

The name to the frei0r source to load. For more information regarding frei0r and how to set the parameters, read the frei0r section in the video filters documentation.

Default(None)
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

gradients

gradients(
    *,
    size: Image_size = Default("640x480"),
    rate: Video_rate = Default("25"),
    c0: Color = Default("random"),
    c1: Color = Default("random"),
    c2: Color = Default("random"),
    c3: Color = Default("random"),
    c4: Color = Default("random"),
    c5: Color = Default("random"),
    c6: Color = Default("random"),
    c7: Color = Default("random"),
    x0: Int = Default("-1"),
    y0: Int = Default("-1"),
    x1: Int = Default("-1"),
    y1: Int = Default("-1"),
    nb_colors: Int = Default("2"),
    seed: Int64 = Default("-1"),
    duration: Duration = Default("-0.000001"),
    speed: Float = Default("0.01"),
    type: (
        Int
        | Literal[
            "linear",
            "radial",
            "circular",
            "spiral",
            "square",
        ]
        | Default
    ) = Default("linear"),
    extra_options: dict[str, Any] | None = None
) -> VideoStream

Generate several gradients.

Parameters:

Name Type Description Default
size Image_size

Set frame size. For the syntax of this option, check the "Video size" section in the ffmpeg-utils manual. Default value is "640x480".

Default('640x480')
rate Video_rate

Set frame rate, expressed as number of frames per second. Default value is "25".

Default('25')
c0 Color

Set 8 colors. Default values for colors is to pick random one.

Default('random')
c1 Color

Set 8 colors. Default values for colors is to pick random one.

Default('random')
c2 Color

Set 8 colors. Default values for colors is to pick random one.

Default('random')
c3 Color

Set 8 colors. Default values for colors is to pick random one.

Default('random')
c4 Color

Set 8 colors. Default values for colors is to pick random one.

Default('random')
c5 Color

Set 8 colors. Default values for colors is to pick random one.

Default('random')
c6 Color

Set 8 colors. Default values for colors is to pick random one.

Default('random')
c7 Color

Set 8 colors. Default values for colors is to pick random one.

Default('random')
x0 Int

Set gradient line source and destination points. If negative or out of range, random ones are picked.

Default('-1')
y0 Int

Set gradient line source and destination points. If negative or out of range, random ones are picked.

Default('-1')
x1 Int

set gradient line destination x1 (from -1 to INT_MAX) (default -1)

Default('-1')
y1 Int

Set gradient line source and destination points. If negative or out of range, random ones are picked.

Default('-1')
nb_colors Int

Set number of colors to use at once. Allowed range is from 2 to 8. Default value is 2.

Default('2')
seed Int64

Set seed for picking gradient line points.

Default('-1')
duration Duration

Set the duration of the sourced video. See the Time duration section in the ffmpeg-utils(1) manual for the accepted syntax. If not specified, or the expressed duration is negative, the video is supposed to be generated forever.

Default('-0.000001')
speed Float

Set speed of gradients rotation.

Default('0.01')
type Int | Literal['linear', 'radial', 'circular', 'spiral', 'square'] | Default

Set type of gradients. Available values are: @end table Default type is linear.

Default('linear')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

guided

guided(
    *streams: VideoStream,
    radius: Int = Default("3"),
    eps: Float = Default("0.01"),
    mode: (
        Int | Literal["basic", "fast"] | Default
    ) = Default("basic"),
    sub: Int = Default("4"),
    guidance: (
        Int | Literal["off", "on"] | Default
    ) = Default("off"),
    planes: Int = Default("1"),
    timeline_options: FFMpegTimelineOption | None = None,
    enable: str | None = None,
    extra_options: dict[str, Any] | None = None
) -> VideoStream

Apply guided filter for edge-preserving smoothing, dehazing and so on.

The filter accepts the following options:

Parameters:

Name Type Description Default
radius Int

Set the box radius in pixels. Allowed range is 1 to 20. Default is 3.

Default('3')
eps Float

Set regularization parameter (with square). Allowed range is 0 to 1. Default is 0.01.

Default('0.01')
mode Int | Literal['basic', 'fast'] | Default

Set filter mode. Can be basic or fast. Default is basic.

Default('basic')
sub Int

Set subsampling ratio for fast mode. Range is 2 to 64. Default is 4. No subsampling occurs in basic mode.

Default('4')
guidance Int | Literal['off', 'on'] | Default

Set guidance mode. Can be off or on. Default is off. If off, single input is required. If on, two inputs of the same resolution and pixel format are required. The second input serves as the guidance.

Default('off')
planes Int

Set planes to filter. Default is first only.

Default('1')
timeline_options FFMpegTimelineOption | None

Timeline options

None
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

haldclutsrc

haldclutsrc(
    *,
    level: Int = Default("6"),
    rate: Video_rate = Default("25"),
    duration: Duration = Default("-0.000001"),
    sar: Rational = Default("1/1"),
    extra_options: dict[str, Any] | None = None
) -> VideoStream

The allrgb source returns frames of size 4096x4096 of all rgb colors.

The allyuv source returns frames of size 4096x4096 of all yuv colors.

The color source provides an uniformly colored input.

The colorchart source provides a colors checker chart.

The colorspectrum source provides a color spectrum input.

The haldclutsrc source provides an identity Hald CLUT. See also haldclut filter.

The nullsrc source returns unprocessed video frames. It is mainly useful to be employed in analysis / debugging tools, or as the source for filters which ignore the input data.

The pal75bars source generates a color bars pattern, based on EBU PAL recommendations with 75% color levels.

The pal100bars source generates a color bars pattern, based on EBU PAL recommendations with 100% color levels.

The rgbtestsrc source generates an RGB test pattern useful for detecting RGB vs BGR issues. You should see a red, green and blue stripe from top to bottom.

The smptebars source generates a color bars pattern, based on the SMPTE Engineering Guideline EG 1-1990.

The smptehdbars source generates a color bars pattern, based on the SMPTE RP 219-2002.

The testsrc source generates a test video pattern, showing a color pattern, a scrolling gradient and a timestamp. This is mainly intended for testing purposes.

The testsrc2 source is similar to testsrc, but supports more pixel formats instead of just rgb24. This allows using it as an input for other tests without requiring a format conversion.

The yuvtestsrc source generates an YUV test pattern. You should see a y, cb and cr stripe from top to bottom.

The sources accept the following parameters:

Parameters:

Name Type Description Default
level Int

Specify the level of the Hald CLUT, only available in the haldclutsrc source. A level of N generates a picture of NNN by NNN pixels to be used as identity matrix for 3D lookup tables. Each component is coded on a 1/(N*N) scale.

Default('6')
rate Video_rate

Specify the frame rate of the sourced video, as the number of frames generated per second. It has to be a string in the format frame_rate_num/frame_rate_den, an integer number, a floating point number or a valid video frame rate abbreviation. The default value is "25".

Default('25')
duration Duration

Set the duration of the sourced video. See the Time duration section in the ffmpeg-utils(1) manual for the accepted syntax. If not specified, or the expressed duration is negative, the video is supposed to be generated forever. Since the frame rate is used as time base, all frames including the last one will have their full duration. If the specified duration is not a multiple of the frame duration, it will be rounded up.

Default('-0.000001')
sar Rational

Set the sample aspect ratio of the sourced video.

Default('1/1')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

headphone

headphone(
    *streams: AudioStream,
    map: String = Default(None),
    gain: Float = Default("0"),
    lfe: Float = Default("0"),
    type: Int | Literal["time", "freq"] | Default = Default(
        "freq"
    ),
    size: Int = Default("1024"),
    hrir: (
        Int | Literal["stereo", "multich"] | Default
    ) = Default("stereo"),
    extra_options: dict[str, Any] | None = None
) -> AudioStream

Apply head-related transfer functions (HRTFs) to create virtual loudspeakers around the user for binaural listening via headphones. The HRIRs are provided via additional streams, for each channel one stereo input stream is needed.

The filter accepts the following options:

Parameters:

Name Type Description Default
map String

Set mapping of input streams for convolution. The argument is a '|'-separated list of channel names in order as they are given as additional stream inputs for filter. This also specify number of input streams. Number of input streams must be not less than number of channels in first stream plus one.

Default(None)
gain Float

Set gain applied to audio. Value is in dB. Default is 0.

Default('0')
lfe Float

Set custom gain for LFE channels. Value is in dB. Default is 0.

Default('0')
type Int | Literal['time', 'freq'] | Default

Set processing type. Can be time or freq. time is processing audio in time domain which is slow. freq is processing audio in frequency domain which is fast. Default is freq.

Default('freq')
size Int

Set size of frame in number of samples which will be processed at once. Default value is 1024. Allowed range is from 1024 to 96000.

Default('1024')
hrir Int | Literal['stereo', 'multich'] | Default

Set format of hrir stream. Default value is stereo. Alternative value is multich. If value is set to stereo, number of additional streams should be greater or equal to number of input channels in first input stream. Also each additional stream should have stereo number of channels. If value is set to multich, number of additional streams should be exactly one. Also number of input channels of additional stream should be equal or greater than twice number of channels of first input stream.

Default('stereo')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default AudioStream

the audio stream

References

FFmpeg Documentation

hilbert

hilbert(
    *,
    sample_rate: Int = Default("44100"),
    taps: Int = Default("22051"),
    nb_samples: Int = Default("1024"),
    win_func: (
        Int
        | Literal[
            "rect",
            "bartlett",
            "hann",
            "hanning",
            "hamming",
            "blackman",
            "welch",
            "flattop",
            "bharris",
            "bnuttall",
            "bhann",
            "sine",
            "nuttall",
            "lanczos",
            "gauss",
            "tukey",
            "dolph",
            "cauchy",
            "parzen",
            "poisson",
            "bohman",
            "kaiser",
        ]
        | Default
    ) = Default("blackman"),
    extra_options: dict[str, Any] | None = None
) -> AudioStream

Generate odd-tap Hilbert transform FIR coefficients.

The resulting stream can be used with afir filter for phase-shifting the signal by 90 degrees.

This is used in many matrix coding schemes and for analytic signal generation. The process is often written as a multiplication by i (or j), the imaginary unit.

The filter accepts the following options:

Parameters:

Name Type Description Default
sample_rate Int

Set sample rate, default is 44100.

Default('44100')
taps Int

Set length of FIR filter, default is 22051.

Default('22051')
nb_samples Int

Set number of samples per each frame.

Default('1024')
win_func Int | Literal['rect', 'bartlett', 'hann', 'hanning', 'hamming', 'blackman', 'welch', 'flattop', 'bharris', 'bnuttall', 'bhann', 'sine', 'nuttall', 'lanczos', 'gauss', 'tukey', 'dolph', 'cauchy', 'parzen', 'poisson', 'bohman', 'kaiser'] | Default

Set window function to be used when generating FIR coefficients.

Default('blackman')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default AudioStream

the audio stream

References

FFmpeg Documentation

hstack

hstack(
    *streams: VideoStream,
    inputs: Int = Auto("len(streams)"),
    shortest: Boolean = Default("false"),
    extra_options: dict[str, Any] | None = None
) -> VideoStream

Stack input videos horizontally.

All streams must be of same pixel format and of same height.

Note that this filter is faster than using overlay and pad filter to create same output.

The filter accepts the following option:

Parameters:

Name Type Description Default
inputs Int

Set number of input streams. Default is 2.

Auto('len(streams)')
shortest Boolean

If set to 1, force the output to terminate when the shortest input terminates. Default value is 0.

Default('false')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

hstack_vaapi

hstack_vaapi(
    *streams: VideoStream,
    inputs: Int = Default("2"),
    shortest: Boolean = Default("false"),
    height: Int = Default("0"),
    extra_options: dict[str, Any] | None = None
) -> VideoStream

Stack input videos horizontally.

This is the VA-API variant of the hstack filter, each input stream may have different height, this filter will scale down/up each input stream while keeping the original aspect.

It accepts the following options:

Parameters:

Name Type Description Default
inputs Int

See hstack.

Default('2')
shortest Boolean

See hstack.

Default('false')
height Int

Set height of output. If set to 0, this filter will set height of output to height of the first input stream. Default value is 0.

Default('0')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

interleave

interleave(
    *streams: VideoStream,
    nb_inputs: Int = Auto("len(streams)"),
    duration: (
        Int
        | Literal["longest", "shortest", "first"]
        | Default
    ) = Default("longest"),
    extra_options: dict[str, Any] | None = None
) -> VideoStream

Temporally interleave frames from several inputs.

interleave works with video inputs, ainterleave with audio.

These filters read frames from several inputs and send the oldest queued frame to the output.

Input streams must have well defined, monotonically increasing frame timestamp values.

In order to submit one frame to output, these filters need to enqueue at least one frame for each input, so they cannot work in case one input is not yet terminated and will not receive incoming frames.

For example consider the case when one input is a select filter which always drops input frames. The interleave filter will keep reading from that input, but it will never be able to send new frames to output until the input sends an end-of-stream signal.

Also, depending on inputs synchronization, the filters will drop frames in case one input receives more frames than the other ones, and the queue is already filled.

These filters accept the following options:

Parameters:

Name Type Description Default
nb_inputs Int

Set the number of different inputs, it is 2 by default.

Auto('len(streams)')
duration Int | Literal['longest', 'shortest', 'first'] | Default

How to determine the end-of-stream. @end table

Default('longest')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

join

join(
    *streams: AudioStream,
    inputs: Int = Auto("len(streams)"),
    channel_layout: String = Default("stereo"),
    map: String = Default(None),
    extra_options: dict[str, Any] | None = None
) -> AudioStream

Join multiple input streams into one multi-channel stream.

It accepts the following parameters:

Parameters:

Name Type Description Default
inputs Int

The number of input streams. It defaults to 2.

Auto('len(streams)')
channel_layout String

The desired output channel layout. It defaults to stereo.

Default('stereo')
map String

Map channels from inputs to output. The argument is a '|'-separated list of mappings, each in the input_idx.in_channel-out_channel form. input_idx is the 0-based index of the input stream. in_channel can be either the name of the input channel (e.g. FL for front left) or its index in the specified input stream. out_channel is the name of the output channel.

Default(None)
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default AudioStream

the audio stream

References

FFmpeg Documentation

ladspa

ladspa(
    *streams: AudioStream,
    file: String = Default(None),
    plugin: String = Default(None),
    controls: String = Default(None),
    sample_rate: Int = Default("44100"),
    nb_samples: Int = Default("1024"),
    duration: Duration = Default("-0.000001"),
    latency: Boolean = Default("false"),
    extra_options: dict[str, Any] | None = None
) -> AudioStream

Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.

To enable compilation of this filter you need to configure FFmpeg with --enable-ladspa.

Parameters:

Name Type Description Default
file String

Specifies the name of LADSPA plugin library to load. If the environment variable LADSPA_PATH is defined, the LADSPA plugin is searched in each one of the directories specified by the colon separated list in LADSPA_PATH, otherwise in the standard LADSPA paths, which are in this order: HOME/.ladspa/lib/, /usr/local/lib/ladspa/, /usr/lib/ladspa/.

Default(None)
plugin String

Specifies the plugin within the library. Some libraries contain only one plugin, but others contain many of them. If this is not set filter will list all available plugins within the specified library.

Default(None)
controls String

Set the '|' separated list of controls which are zero or more floating point values that determine the behavior of the loaded plugin (for example delay, threshold or gain). Controls need to be defined using the following syntax: c0=value0|c1=value1|c2=value2|..., where valuei is the value set on the i-th control. Alternatively they can be also defined using the following syntax: value0|value1|value2|..., where valuei is the value set on the i-th control. If controls is set to help, all available controls and their valid ranges are printed.

Default(None)
sample_rate Int

Specify the sample rate, default to 44100. Only used if plugin have zero inputs.

Default('44100')
nb_samples Int

Set the number of samples per channel per each output frame, default is 1024. Only used if plugin have zero inputs.

Default('1024')
duration Duration

Set the minimum duration of the sourced audio. See the Time duration section in the ffmpeg-utils(1) manual for the accepted syntax. Note that the resulting duration may be greater than the specified duration, as the generated audio is always cut at the end of a complete frame. If not specified, or the expressed duration is negative, the audio is supposed to be generated forever. Only used if plugin have zero inputs.

Default('-0.000001')
latency Boolean

Enable latency compensation, by default is disabled. Only used if plugin have inputs.

Default('false')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default AudioStream

the audio stream

References

FFmpeg Documentation

life

life(
    *,
    filename: String = Default(None),
    size: Image_size = Default(None),
    rate: Video_rate = Default("25"),
    rule: String = Default("B3/S23"),
    random_fill_ratio: Double = Default("0.618034"),
    random_seed: Int64 = Default("-1"),
    stitch: Boolean = Default("true"),
    mold: Int = Default("0"),
    life_color: Color = Default("white"),
    death_color: Color = Default("black"),
    mold_color: Color = Default("black"),
    extra_options: dict[str, Any] | None = None
) -> VideoStream

Generate a life pattern.

This source is based on a generalization of John Conway's life game.

The sourced input represents a life grid, each pixel represents a cell which can be in one of two possible states, alive or dead. Every cell interacts with its eight neighbours, which are the cells that are horizontally, vertically, or diagonally adjacent.

At each interaction the grid evolves according to the adopted rule, which specifies the number of neighbor alive cells which will make a cell stay alive or born. The rule option allows one to specify the rule to adopt.

This source accepts the following options:

Parameters:

Name Type Description Default
filename String

Set the file from which to read the initial grid state. In the file, each non-whitespace character is considered an alive cell, and newline is used to delimit the end of each row. If this option is not specified, the initial grid is generated randomly.

Default(None)
size Image_size

Set the size of the output video. For the syntax of this option, check the "Video size" section in the ffmpeg-utils manual. If filename is specified, the size is set by default to the same size of the input file. If size is set, it must contain the size specified in the input file, and the initial grid defined in that file is centered in the larger resulting area. If a filename is not specified, the size value defaults to "320x240" (used for a randomly generated initial grid).

Default(None)
rate Video_rate

Set the video rate, that is the number of frames generated per second. Default is 25.

Default('25')
rule String

Set the life rule. A rule can be specified with a code of the kind "SNS/BNB", where NS and NB are sequences of numbers in the range 0-8, NS specifies the number of alive neighbor cells which make a live cell stay alive, and NB the number of alive neighbor cells which make a dead cell to become alive (i.e. to "born"). "s" and "b" can be used in place of "S" and "B", respectively. Alternatively a rule can be specified by an 18-bits integer. The 9 high order bits are used to encode the next cell state if it is alive for each number of neighbor alive cells, the low order bits specify the rule for "borning" new cells. Higher order bits encode for an higher number of neighbor cells. For example the number 6153 = (12<<9)+9 specifies a stay alive rule of 12 and a born rule of 9, which corresponds to "S23/B03". Default value is "S23/B3", which is the original Conway's game of life rule, and will keep a cell alive if it has 2 or 3 neighbor alive cells, and will born a new cell if there are three alive cells around a dead cell.

Default('B3/S23')
random_fill_ratio Double

Set the random fill ratio for the initial random grid. It is a floating point number value ranging from 0 to 1, defaults to 1/PHI. It is ignored when a file is specified.

Default('0.618034')
random_seed Int64

Set the seed for filling the initial random grid, must be an integer included between 0 and UINT32_MAX. If not specified, or if explicitly set to -1, the filter will try to use a good random seed on a best effort basis.

Default('-1')
stitch Boolean

If set to 1, stitch the left and right grid edges together, and the top and bottom edges also. Defaults to 1.

Default('true')
mold Int

Set cell mold speed. If set, a dead cell will go from death_color to mold_color with a step of mold. mold can have a value from 0 to 255.

Default('0')
life_color Color

Set the color of living (or new born) cells.

Default('white')
death_color Color

Set the color of dead cells. If mold is set, this is the first color used to represent a dead cell.

Default('black')
mold_color Color

Set mold color, for definitely dead and moldy cells. For the syntax of these 3 color options, check the "Color" section in the ffmpeg-utils manual.

Default('black')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

limitdiff

limitdiff(
    *streams: VideoStream,
    threshold: Float = Default("0.00392157"),
    elasticity: Float = Default("2"),
    reference: Boolean = Default("false"),
    planes: Int = Default("15"),
    timeline_options: FFMpegTimelineOption | None = None,
    enable: str | None = None,
    extra_options: dict[str, Any] | None = None
) -> VideoStream

Apply limited difference filter using second and optionally third video stream.

The filter accepts the following options:

Parameters:

Name Type Description Default
threshold Float

Set the threshold to use when allowing certain differences between video streams. Any absolute difference value lower or exact than this threshold will pick pixel components from first video stream.

Default('0.00392157')
elasticity Float

Set the elasticity of soft thresholding when processing video streams. This value multiplied with first one sets second threshold. Any absolute difference value greater or exact than second threshold will pick pixel components from second video stream. For values between those two threshold linear interpolation between first and second video stream will be used.

Default('2')
reference Boolean

Enable the reference (third) video stream processing. By default is disabled. If set, this video stream will be used for calculating absolute difference with first video stream.

Default('false')
planes Int

Specify which planes will be processed. Defaults to all available.

Default('15')
timeline_options FFMpegTimelineOption | None

Timeline options

None
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

lv2

lv2(
    *streams: AudioStream,
    plugin: String = Default(None),
    controls: String = Default(None),
    sample_rate: Int = Default("44100"),
    nb_samples: Int = Default("1024"),
    duration: Duration = Default("-0.000001"),
    extra_options: dict[str, Any] | None = None
) -> AudioStream

Load a LV2 (LADSPA Version 2) plugin.

To enable compilation of this filter you need to configure FFmpeg with --enable-lv2.

Parameters:

Name Type Description Default
plugin String

Specifies the plugin URI. You may need to escape ':'.

Default(None)
controls String

Set the '|' separated list of controls which are zero or more floating point values that determine the behavior of the loaded plugin (for example delay, threshold or gain). If controls is set to help, all available controls and their valid ranges are printed.

Default(None)
sample_rate Int

Specify the sample rate, default to 44100. Only used if plugin have zero inputs.

Default('44100')
nb_samples Int

Set the number of samples per channel per each output frame, default is 1024. Only used if plugin have zero inputs.

Default('1024')
duration Duration

Set the minimum duration of the sourced audio. See the Time duration section in the ffmpeg-utils(1) manual for the accepted syntax. Note that the resulting duration may be greater than the specified duration, as the generated audio is always cut at the end of a complete frame. If not specified, or the expressed duration is negative, the audio is supposed to be generated forever. Only used if plugin have zero inputs.

Default('-0.000001')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default AudioStream

the audio stream

References

FFmpeg Documentation

mandelbrot

mandelbrot(
    *,
    size: Image_size = Default("640x480"),
    rate: Video_rate = Default("25"),
    maxiter: Int = Default("7189"),
    start_x: Double = Default("-0.743644"),
    start_y: Double = Default("-0.131826"),
    start_scale: Double = Default("3"),
    end_scale: Double = Default("0.3"),
    end_pts: Double = Default("400"),
    bailout: Double = Default("10"),
    morphxf: Double = Default("0.01"),
    morphyf: Double = Default("0.0123"),
    morphamp: Double = Default("0"),
    outer: (
        Int
        | Literal[
            "iteration_count",
            "normalized_iteration_count",
            "white",
            "outz",
        ]
        | Default
    ) = Default("normalized_iteration_count"),
    inner: (
        Int
        | Literal[
            "black", "period", "convergence", "mincol"
        ]
        | Default
    ) = Default("mincol"),
    extra_options: dict[str, Any] | None = None
) -> VideoStream

Generate a Mandelbrot set fractal, and progressively zoom towards the point specified with start_x and start_y.

This source accepts the following options:

Parameters:

Name Type Description Default
size Image_size

Set frame size. For the syntax of this option, check the "Video size" section in the ffmpeg-utils manual. Default value is "640x480".

Default('640x480')
rate Video_rate

Set frame rate, expressed as number of frames per second. Default value is "25".

Default('25')
maxiter Int

Set the maximum of iterations performed by the rendering algorithm. Default value is 7189.

Default('7189')
start_x Double

Set the initial x position. Must be a floating point value between -100 and 100. Default value is -0.743643887037158704752191506114774.

Default('-0.743644')
start_y Double

Set the initial y position. Must be a floating point value between -100 and 100. Default value is -0.131825904205311970493132056385139.

Default('-0.131826')
start_scale Double

Set the initial scale value. Default value is 3.0.

Default('3')
end_scale Double

Set the terminal scale value. Must be a floating point value. Default value is 0.3.

Default('0.3')
end_pts Double

Set the terminal pts value. Default value is 400.

Default('400')
bailout Double

Set the bailout value. Default value is 10.0.

Default('10')
morphxf Double

set morph x frequency (from -FLT_MAX to FLT_MAX) (default 0.01)

Default('0.01')
morphyf Double

set morph y frequency (from -FLT_MAX to FLT_MAX) (default 0.0123)

Default('0.0123')
morphamp Double

set morph amplitude (from -FLT_MAX to FLT_MAX) (default 0)

Default('0')
outer Int | Literal['iteration_count', 'normalized_iteration_count', 'white', 'outz'] | Default

Set outer coloring mode. It shall assume one of following values: @end table Default value is normalized_iteration_count.

Default('normalized_iteration_count')
inner Int | Literal['black', 'period', 'convergence', 'mincol'] | Default

Set the inner coloring mode, that is the algorithm used to draw the Mandelbrot fractal internal region. It shall assume one of the following values: @end table Default value is mincol.

Default('mincol')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

mergeplanes

mergeplanes(
    *streams: VideoStream,
    mapping: Int = Default("-1"),
    format: Pix_fmt = Default("yuva444p"),
    map0s: Int = Default("0"),
    map0p: Int = Default("0"),
    map1s: Int = Default("0"),
    map1p: Int = Default("0"),
    map2s: Int = Default("0"),
    map2p: Int = Default("0"),
    map3s: Int = Default("0"),
    map3p: Int = Default("0"),
    extra_options: dict[str, Any] | None = None
) -> VideoStream

Merge color channel components from several video streams.

The filter accepts up to 4 input streams, and merge selected input planes to the output video.

This filter accepts the following options:

Parameters:

Name Type Description Default
mapping Int

Set input to output plane mapping. Default is 0. The mappings is specified as a bitmap. It should be specified as a hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the mapping for the first plane of the output stream. 'A' sets the number of the input stream to use (from 0 to 3), and 'a' the plane number of the corresponding input to use (from 0 to 3). The rest of the mappings is similar, 'Bb' describes the mapping for the output stream second plane, 'Cc' describes the mapping for the output stream third plane and 'Dd' describes the mapping for the output stream fourth plane.

Default('-1')
format Pix_fmt

Set output pixel format. Default is yuva444p.

Default('yuva444p')
map0s Int

set 1st input to output stream mapping (from 0 to 3) (default 0)

Default('0')
map0p Int

set 1st input to output plane mapping (from 0 to 3) (default 0)

Default('0')
map1s Int

set 2nd input to output stream mapping (from 0 to 3) (default 0)

Default('0')
map1p Int

set 2nd input to output plane mapping (from 0 to 3) (default 0)

Default('0')
map2s Int

set 3rd input to output stream mapping (from 0 to 3) (default 0)

Default('0')
map2p Int

set 3rd input to output plane mapping (from 0 to 3) (default 0)

Default('0')
map3s Int

Set input to output stream mapping for output Nth plane. Default is 0.

Default('0')
map3p Int

Set input to output plane mapping for output Nth plane. Default is 0.

Default('0')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

mix

mix(
    *streams: VideoStream,
    inputs: Int = Auto("len(streams)"),
    weights: String = Default("1 1"),
    scale: Float = Default("0"),
    planes: Flags = Default("F"),
    duration: (
        Int
        | Literal["longest", "shortest", "first"]
        | Default
    ) = Default("longest"),
    timeline_options: FFMpegTimelineOption | None = None,
    enable: str | None = None,
    extra_options: dict[str, Any] | None = None
) -> VideoStream

Mix several video input streams into one video stream.

A description of the accepted options follows.

Parameters:

Name Type Description Default
inputs Int

The number of inputs. If unspecified, it defaults to 2.

Auto('len(streams)')
weights String

set weight for each input (default "1 1")

Default('1 1')
scale Float

set scale (from 0 to 32767) (default 0)

Default('0')
planes Flags

Syntax is same as option with same name.

Default('F')
duration Int | Literal['longest', 'shortest', 'first'] | Default

Specify how end of stream is determined. @end table

Default('longest')
timeline_options FFMpegTimelineOption | None

Timeline options

None
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

movie

movie(
    *,
    filename: String = Default(None),
    format_name: String = Default(None),
    stream_index: Int = Default("-1"),
    seek_point: Double = Default("0"),
    streams: String = Default(None),
    loop: Int = Default("1"),
    discontinuity: Duration = Default("0"),
    dec_threads: Int = Default("0"),
    format_opts: Dictionary = Default(None),
    extra_options: dict[str, Any] | None = None
) -> FilterNode

Read audio and/or video stream(s) from a movie container.

It accepts the following parameters:

Parameters:

Name Type Description Default
filename String

The name of the resource to read (not necessarily a file; it can also be a device or a stream accessed through some protocol).

Default(None)
format_name String

Specifies the format assumed for the movie to read, and can be either the name of a container or an input device. If not specified, the format is guessed from movie_name or by probing.

Default(None)
stream_index Int

Specifies the index of the video stream to read. If the value is -1, the most suitable video stream will be automatically selected. The default value is "-1". Deprecated. If the filter is called "amovie", it will select audio instead of video.

Default('-1')
seek_point Double

Specifies the seek point in seconds. The frames will be output starting from this seek point. The parameter is evaluated with av_strtod, so the numerical value may be suffixed by an IS postfix. The default value is "0".

Default('0')
streams String

Specifies the streams to read. Several streams can be specified, separated by "+". The source will then have as many outputs, in the same order. The syntax is explained in the "Stream specifiers" section in the ffmpeg manual. Two special names, "dv" and "da" specify respectively the default (best suited) video and audio stream. Default is "dv", or "da" if the filter is called as "amovie".

Default(None)
loop Int

Specifies how many times to read the stream in sequence. If the value is 0, the stream will be looped infinitely. Default value is "1". Note that when the movie is looped the source timestamps are not changed, so it will generate non monotonically increasing timestamps.

Default('1')
discontinuity Duration

Specifies the time difference between frames above which the point is considered a timestamp discontinuity which is removed by adjusting the later timestamps.

Default('0')
dec_threads Int

Specifies the number of threads for decoding

Default('0')
format_opts Dictionary

Specify format options for the opened file. Format options can be specified as a list of key=value pairs separated by ':'. The following example shows how to add protocol_whitelist and protocol_blacklist options: @example ffplay -f lavfi "movie=filename='1.sdp':format_opts='protocol_whitelist=file,rtp,udp\:protocol_blacklist=http'" @end example

Default(None)
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
filter_node FilterNode

the filter node

References

FFmpeg Documentation

mptestsrc

mptestsrc(
    *,
    rate: Video_rate = Default("25"),
    duration: Duration = Default("-0.000001"),
    test: (
        Int
        | Literal[
            "dc_luma",
            "dc_chroma",
            "freq_luma",
            "freq_chroma",
            "amp_luma",
            "amp_chroma",
            "cbp",
            "mv",
            "ring1",
            "ring2",
            "all",
        ]
        | Default
    ) = Default("all"),
    max_frames: Int64 = Default("30"),
    extra_options: dict[str, Any] | None = None
) -> VideoStream

Generate various test patterns, as generated by the MPlayer test filter.

The size of the generated video is fixed, and is 512x512. This source is useful in particular for testing encoding features.

This source accepts the following options:

Parameters:

Name Type Description Default
rate Video_rate

Specify the frame rate of the sourced video, as the number of frames generated per second. It has to be a string in the format frame_rate_num/frame_rate_den, an integer number, a floating point number or a valid video frame rate abbreviation. The default value is "25".

Default('25')
duration Duration

Set the duration of the sourced video. See the Time duration section in the ffmpeg-utils(1) manual for the accepted syntax. If not specified, or the expressed duration is negative, the video is supposed to be generated forever.

Default('-0.000001')
test Int | Literal['dc_luma', 'dc_chroma', 'freq_luma', 'freq_chroma', 'amp_luma', 'amp_chroma', 'cbp', 'mv', 'ring1', 'ring2', 'all'] | Default

Set the number or the name of the test to perform. Supported tests are: @end table Default value is "all", which will cycle through the list of all tests.

Default('all')
max_frames Int64

Set the maximum number of frames generated for each test (from 1 to I64_MAX) (default 30)

Default('30')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

nullsrc

nullsrc(
    *,
    size: Image_size = Default("320x240"),
    rate: Video_rate = Default("25"),
    duration: Duration = Default("-0.000001"),
    sar: Rational = Default("1/1"),
    extra_options: dict[str, Any] | None = None
) -> VideoStream

The allrgb source returns frames of size 4096x4096 of all rgb colors.

The allyuv source returns frames of size 4096x4096 of all yuv colors.

The color source provides an uniformly colored input.

The colorchart source provides a colors checker chart.

The colorspectrum source provides a color spectrum input.

The haldclutsrc source provides an identity Hald CLUT. See also haldclut filter.

The nullsrc source returns unprocessed video frames. It is mainly useful to be employed in analysis / debugging tools, or as the source for filters which ignore the input data.

The pal75bars source generates a color bars pattern, based on EBU PAL recommendations with 75% color levels.

The pal100bars source generates a color bars pattern, based on EBU PAL recommendations with 100% color levels.

The rgbtestsrc source generates an RGB test pattern useful for detecting RGB vs BGR issues. You should see a red, green and blue stripe from top to bottom.

The smptebars source generates a color bars pattern, based on the SMPTE Engineering Guideline EG 1-1990.

The smptehdbars source generates a color bars pattern, based on the SMPTE RP 219-2002.

The testsrc source generates a test video pattern, showing a color pattern, a scrolling gradient and a timestamp. This is mainly intended for testing purposes.

The testsrc2 source is similar to testsrc, but supports more pixel formats instead of just rgb24. This allows using it as an input for other tests without requiring a format conversion.

The yuvtestsrc source generates an YUV test pattern. You should see a y, cb and cr stripe from top to bottom.

The sources accept the following parameters:

Parameters:

Name Type Description Default
size Image_size

Specify the size of the sourced video. For the syntax of this option, check the "Video size" section in the ffmpeg-utils manual. The default value is 320x240. This option is not available with the allrgb, allyuv, and haldclutsrc filters.

Default('320x240')
rate Video_rate

Specify the frame rate of the sourced video, as the number of frames generated per second. It has to be a string in the format frame_rate_num/frame_rate_den, an integer number, a floating point number or a valid video frame rate abbreviation. The default value is "25".

Default('25')
duration Duration

Set the duration of the sourced video. See the Time duration section in the ffmpeg-utils(1) manual for the accepted syntax. If not specified, or the expressed duration is negative, the video is supposed to be generated forever. Since the frame rate is used as time base, all frames including the last one will have their full duration. If the specified duration is not a multiple of the frame duration, it will be rounded up.

Default('-0.000001')
sar Rational

Set the sample aspect ratio of the sourced video.

Default('1/1')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

openclsrc

openclsrc(
    *,
    source: String = Default(None),
    kernel: String = Default(None),
    size: Image_size = Default(None),
    format: Pix_fmt = Default("none"),
    rate: Video_rate = Default("25"),
    extra_options: dict[str, Any] | None = None
) -> VideoStream

Generate video using an OpenCL program.

Parameters:

Name Type Description Default
source String

OpenCL program source file.

Default(None)
kernel String

Kernel name in program.

Default(None)
size Image_size

Size of frames to generate. This must be set.

Default(None)
format Pix_fmt

Pixel format to use for the generated frames. This must be set.

Default('none')
rate Video_rate

Number of frames generated every second. Default value is '25'.

Default('25')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

pal100bars

pal100bars(
    *,
    size: Image_size = Default("320x240"),
    rate: Video_rate = Default("25"),
    duration: Duration = Default("-0.000001"),
    sar: Rational = Default("1/1"),
    extra_options: dict[str, Any] | None = None
) -> VideoStream

The allrgb source returns frames of size 4096x4096 of all rgb colors.

The allyuv source returns frames of size 4096x4096 of all yuv colors.

The color source provides an uniformly colored input.

The colorchart source provides a colors checker chart.

The colorspectrum source provides a color spectrum input.

The haldclutsrc source provides an identity Hald CLUT. See also haldclut filter.

The nullsrc source returns unprocessed video frames. It is mainly useful to be employed in analysis / debugging tools, or as the source for filters which ignore the input data.

The pal75bars source generates a color bars pattern, based on EBU PAL recommendations with 75% color levels.

The pal100bars source generates a color bars pattern, based on EBU PAL recommendations with 100% color levels.

The rgbtestsrc source generates an RGB test pattern useful for detecting RGB vs BGR issues. You should see a red, green and blue stripe from top to bottom.

The smptebars source generates a color bars pattern, based on the SMPTE Engineering Guideline EG 1-1990.

The smptehdbars source generates a color bars pattern, based on the SMPTE RP 219-2002.

The testsrc source generates a test video pattern, showing a color pattern, a scrolling gradient and a timestamp. This is mainly intended for testing purposes.

The testsrc2 source is similar to testsrc, but supports more pixel formats instead of just rgb24. This allows using it as an input for other tests without requiring a format conversion.

The yuvtestsrc source generates an YUV test pattern. You should see a y, cb and cr stripe from top to bottom.

The sources accept the following parameters:

Parameters:

Name Type Description Default
size Image_size

Specify the size of the sourced video. For the syntax of this option, check the "Video size" section in the ffmpeg-utils manual. The default value is 320x240. This option is not available with the allrgb, allyuv, and haldclutsrc filters.

Default('320x240')
rate Video_rate

Specify the frame rate of the sourced video, as the number of frames generated per second. It has to be a string in the format frame_rate_num/frame_rate_den, an integer number, a floating point number or a valid video frame rate abbreviation. The default value is "25".

Default('25')
duration Duration

Set the duration of the sourced video. See the Time duration section in the ffmpeg-utils(1) manual for the accepted syntax. If not specified, or the expressed duration is negative, the video is supposed to be generated forever. Since the frame rate is used as time base, all frames including the last one will have their full duration. If the specified duration is not a multiple of the frame duration, it will be rounded up.

Default('-0.000001')
sar Rational

Set the sample aspect ratio of the sourced video.

Default('1/1')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

pal75bars

pal75bars(
    *,
    size: Image_size = Default("320x240"),
    rate: Video_rate = Default("25"),
    duration: Duration = Default("-0.000001"),
    sar: Rational = Default("1/1"),
    extra_options: dict[str, Any] | None = None
) -> VideoStream

The allrgb source returns frames of size 4096x4096 of all rgb colors.

The allyuv source returns frames of size 4096x4096 of all yuv colors.

The color source provides an uniformly colored input.

The colorchart source provides a colors checker chart.

The colorspectrum source provides a color spectrum input.

The haldclutsrc source provides an identity Hald CLUT. See also haldclut filter.

The nullsrc source returns unprocessed video frames. It is mainly useful to be employed in analysis / debugging tools, or as the source for filters which ignore the input data.

The pal75bars source generates a color bars pattern, based on EBU PAL recommendations with 75% color levels.

The pal100bars source generates a color bars pattern, based on EBU PAL recommendations with 100% color levels.

The rgbtestsrc source generates an RGB test pattern useful for detecting RGB vs BGR issues. You should see a red, green and blue stripe from top to bottom.

The smptebars source generates a color bars pattern, based on the SMPTE Engineering Guideline EG 1-1990.

The smptehdbars source generates a color bars pattern, based on the SMPTE RP 219-2002.

The testsrc source generates a test video pattern, showing a color pattern, a scrolling gradient and a timestamp. This is mainly intended for testing purposes.

The testsrc2 source is similar to testsrc, but supports more pixel formats instead of just rgb24. This allows using it as an input for other tests without requiring a format conversion.

The yuvtestsrc source generates an YUV test pattern. You should see a y, cb and cr stripe from top to bottom.

The sources accept the following parameters:

Parameters:

Name Type Description Default
size Image_size

Specify the size of the sourced video. For the syntax of this option, check the "Video size" section in the ffmpeg-utils manual. The default value is 320x240. This option is not available with the allrgb, allyuv, and haldclutsrc filters.

Default('320x240')
rate Video_rate

Specify the frame rate of the sourced video, as the number of frames generated per second. It has to be a string in the format frame_rate_num/frame_rate_den, an integer number, a floating point number or a valid video frame rate abbreviation. The default value is "25".

Default('25')
duration Duration

Set the duration of the sourced video. See the Time duration section in the ffmpeg-utils(1) manual for the accepted syntax. If not specified, or the expressed duration is negative, the video is supposed to be generated forever. Since the frame rate is used as time base, all frames including the last one will have their full duration. If the specified duration is not a multiple of the frame duration, it will be rounded up.

Default('-0.000001')
sar Rational

Set the sample aspect ratio of the sourced video.

Default('1/1')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

perlin

perlin(
    *,
    size: Image_size = Default("320x240"),
    rate: Video_rate = Default("25"),
    octaves: Int = Default("1"),
    persistence: Double = Default("1"),
    xscale: Double = Default("1"),
    yscale: Double = Default("1"),
    tscale: Double = Default("1"),
    random_mode: (
        Int | Literal["random", "ken", "seed"] | Default
    ) = Default("random"),
    random_seed: Int = Default("0"),
    extra_options: dict[str, Any] | None = None
) -> VideoStream

Generate Perlin noise.

Perlin noise is a kind of noise with local continuity in space. This can be used to generate patterns with continuity in space and time, e.g. to simulate smoke, fluids, or terrain.

In case more than one octave is specified through the octaves option, Perlin noise is generated as a sum of components, each one with doubled frequency. In this case the persistence option specify the ratio of the amplitude with respect to the previous component. More octave components enable to specify more high frequency details in the generated noise (e.g. small size variations due to boulders in a generated terrain).

Parameters:

Name Type Description Default
size Image_size

Specify the size (width and height) of the buffered video frames. For the syntax of this option, check the "Video size" section in the ffmpeg-utils manual. Default value is 320x240.

Default('320x240')
rate Video_rate

Specify the frame rate expected for the video stream, expressed as a number of frames per second. Default value is 25.

Default('25')
octaves Int

Specify the total number of components making up the noise, each one with doubled frequency. Default value is 1.

Default('1')
persistence Double

Set the ratio used to compute the amplitude of the next octave component with respect to the previous component amplitude. Default value is 1.

Default('1')
xscale Double

set x-scale factor (from 0 to DBL_MAX) (default 1)

Default('1')
yscale Double

Define a scale factor used to multiple the x, y coordinates. This can be useful to define an effect with a pattern stretched along the x or y axis. Default value is 1.

Default('1')
tscale Double

Define a scale factor used to multiple the time coordinate. This can be useful to change the time variation speed. Default value is 1.

Default('1')
random_mode Int | Literal['random', 'ken', 'seed'] | Default

Set random mode used to compute initial pattern. Supported values are: @end table Default value is random.

Default('random')
random_seed Int

When random_mode is set to random_seed, use this value to compute the initial pattern. Default value is 0.

Default('0')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

premultiply

premultiply(
    *streams: VideoStream,
    planes: Int = Default("15"),
    inplace: Boolean = Default("false"),
    timeline_options: FFMpegTimelineOption | None = None,
    enable: str | None = None,
    extra_options: dict[str, Any] | None = None
) -> VideoStream

Apply alpha premultiply effect to input video stream using first plane of second stream as alpha.

Both streams must have same dimensions and same pixel format.

The filter accepts the following option:

Parameters:

Name Type Description Default
planes Int

Set which planes will be processed, unprocessed planes will be copied. By default value 0xf, all planes will be processed.

Default('15')
inplace Boolean

Do not require 2nd input for processing, instead use alpha plane from input stream.

Default('false')
timeline_options FFMpegTimelineOption | None

Timeline options

None
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

program_opencl

program_opencl(
    *streams: VideoStream,
    source: String = Default(None),
    kernel: String = Default(None),
    inputs: Int = Default("1"),
    size: Image_size = Default(None),
    framesync_options: FFMpegFrameSyncOption | None = None,
    eof_action: str | None = None,
    shortest: bool | None = None,
    repeatlast: bool | None = None,
    extra_options: dict[str, Any] | None = None
) -> VideoStream

Filter video using an OpenCL program.

Parameters:

Name Type Description Default
source String

OpenCL program source file.

Default(None)
kernel String

Kernel name in program.

Default(None)
inputs Int

Number of inputs to the filter. Defaults to 1.

Default('1')
size Image_size

Size of output frames. Defaults to the same as the first input.

Default(None)
framesync_options FFMpegFrameSyncOption | None

Framesync options

None
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

rgbtestsrc

rgbtestsrc(
    *,
    size: Image_size = Default("320x240"),
    rate: Video_rate = Default("25"),
    duration: Duration = Default("-0.000001"),
    sar: Rational = Default("1/1"),
    complement: Boolean = Default("false"),
    extra_options: dict[str, Any] | None = None
) -> VideoStream

The allrgb source returns frames of size 4096x4096 of all rgb colors.

The allyuv source returns frames of size 4096x4096 of all yuv colors.

The color source provides an uniformly colored input.

The colorchart source provides a colors checker chart.

The colorspectrum source provides a color spectrum input.

The haldclutsrc source provides an identity Hald CLUT. See also haldclut filter.

The nullsrc source returns unprocessed video frames. It is mainly useful to be employed in analysis / debugging tools, or as the source for filters which ignore the input data.

The pal75bars source generates a color bars pattern, based on EBU PAL recommendations with 75% color levels.

The pal100bars source generates a color bars pattern, based on EBU PAL recommendations with 100% color levels.

The rgbtestsrc source generates an RGB test pattern useful for detecting RGB vs BGR issues. You should see a red, green and blue stripe from top to bottom.

The smptebars source generates a color bars pattern, based on the SMPTE Engineering Guideline EG 1-1990.

The smptehdbars source generates a color bars pattern, based on the SMPTE RP 219-2002.

The testsrc source generates a test video pattern, showing a color pattern, a scrolling gradient and a timestamp. This is mainly intended for testing purposes.

The testsrc2 source is similar to testsrc, but supports more pixel formats instead of just rgb24. This allows using it as an input for other tests without requiring a format conversion.

The yuvtestsrc source generates an YUV test pattern. You should see a y, cb and cr stripe from top to bottom.

The sources accept the following parameters:

Parameters:

Name Type Description Default
size Image_size

Specify the size of the sourced video. For the syntax of this option, check the "Video size" section in the ffmpeg-utils manual. The default value is 320x240. This option is not available with the allrgb, allyuv, and haldclutsrc filters.

Default('320x240')
rate Video_rate

Specify the frame rate of the sourced video, as the number of frames generated per second. It has to be a string in the format frame_rate_num/frame_rate_den, an integer number, a floating point number or a valid video frame rate abbreviation. The default value is "25".

Default('25')
duration Duration

Set the duration of the sourced video. See the Time duration section in the ffmpeg-utils(1) manual for the accepted syntax. If not specified, or the expressed duration is negative, the video is supposed to be generated forever. Since the frame rate is used as time base, all frames including the last one will have their full duration. If the specified duration is not a multiple of the frame duration, it will be rounded up.

Default('-0.000001')
sar Rational

Set the sample aspect ratio of the sourced video.

Default('1/1')
complement Boolean

set complement colors (default false)

Default('false')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

sierpinski

sierpinski(
    *,
    size: Image_size = Default("640x480"),
    rate: Video_rate = Default("25"),
    seed: Int64 = Default("-1"),
    jump: Int = Default("100"),
    type: (
        Int | Literal["carpet", "triangle"] | Default
    ) = Default("carpet"),
    extra_options: dict[str, Any] | None = None
) -> VideoStream

Generate a Sierpinski carpet/triangle fractal, and randomly pan around.

This source accepts the following options:

Parameters:

Name Type Description Default
size Image_size

Set frame size. For the syntax of this option, check the "Video size" section in the ffmpeg-utils manual. Default value is "640x480".

Default('640x480')
rate Video_rate

Set frame rate, expressed as number of frames per second. Default value is "25".

Default('25')
seed Int64

Set seed which is used for random panning.

Default('-1')
jump Int

Set max jump for single pan destination. Allowed range is from 1 to 10000.

Default('100')
type Int | Literal['carpet', 'triangle'] | Default

Set fractal type, can be default carpet or triangle.

Default('carpet')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

signature

signature(
    *streams: VideoStream,
    detectmode: (
        Int | Literal["off", "full", "fast"] | Default
    ) = Default("off"),
    nb_inputs: Int = Auto("len(streams)"),
    filename: String = Default(""),
    format: (
        Int | Literal["binary", "xml"] | Default
    ) = Default("binary"),
    th_d: Int = Default("9000"),
    th_dc: Int = Default("60000"),
    th_xh: Int = Default("116"),
    th_di: Int = Default("0"),
    th_it: Double = Default("0.5"),
    extra_options: dict[str, Any] | None = None
) -> VideoStream

Calculates the MPEG-7 Video Signature. The filter can handle more than one input. In this case the matching between the inputs can be calculated additionally. The filter always passes through the first input. The signature of each stream can be written into a file.

It accepts the following options:

Parameters:

Name Type Description Default
detectmode Int | Literal['off', 'full', 'fast'] | Default

Enable or disable the matching process. Available values are: @end table

Default('off')
nb_inputs Int

Set the number of inputs. The option value must be a non negative integer. Default value is 1.

Auto('len(streams)')
filename String

Set the path to which the output is written. If there is more than one input, the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive integer), that will be replaced with the input number. If no filename is specified, no output will be written. This is the default.

Default('')
format Int | Literal['binary', 'xml'] | Default

Choose the output format. Available values are: @end table

Default('binary')
th_d Int

Set threshold to detect one word as similar. The option value must be an integer greater than zero. The default value is 9000.

Default('9000')
th_dc Int

Set threshold to detect all words as similar. The option value must be an integer greater than zero. The default value is 60000.

Default('60000')
th_xh Int

Set threshold to detect frames as similar. The option value must be an integer greater than zero. The default value is 116.

Default('116')
th_di Int

Set the minimum length of a sequence in frames to recognize it as matching sequence. The option value must be a non negative integer value. The default value is 0.

Default('0')
th_it Double

Set the minimum relation, that matching frames to all frames must have. The option value must be a double value between 0 and 1. The default value is 0.5.

Default('0.5')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

sinc

sinc(
    *,
    sample_rate: Int = Default("44100"),
    nb_samples: Int = Default("1024"),
    hp: Float = Default("0"),
    lp: Float = Default("0"),
    phase: Float = Default("50"),
    beta: Float = Default("-1"),
    att: Float = Default("120"),
    round: Boolean = Default("false"),
    hptaps: Int = Default("0"),
    lptaps: Int = Default("0"),
    extra_options: dict[str, Any] | None = None
) -> AudioStream

Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.

The resulting stream can be used with afir filter for filtering the audio signal.

The filter accepts the following options:

Parameters:

Name Type Description Default
sample_rate Int

Set sample rate, default is 44100.

Default('44100')
nb_samples Int

Set number of samples per each frame. Default is 1024.

Default('1024')
hp Float

Set high-pass frequency. Default is 0.

Default('0')
lp Float

Set low-pass frequency. Default is 0. If high-pass frequency is lower than low-pass frequency and low-pass frequency is higher than 0 then filter will create band-pass filter coefficients, otherwise band-reject filter coefficients.

Default('0')
phase Float

Set filter phase response. Default is 50. Allowed range is from 0 to 100.

Default('50')
beta Float

Set Kaiser window beta.

Default('-1')
att Float

Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.

Default('120')
round Boolean

Enable rounding, by default is disabled.

Default('false')
hptaps Int

Set number of taps for high-pass filter.

Default('0')
lptaps Int

Set number of taps for low-pass filter.

Default('0')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default AudioStream

the audio stream

References

FFmpeg Documentation

sine

sine(
    *,
    frequency: Double = Default("440"),
    beep_factor: Double = Default("0"),
    sample_rate: Int = Default("44100"),
    duration: Duration = Default("0"),
    samples_per_frame: String = Default("1024"),
    extra_options: dict[str, Any] | None = None
) -> AudioStream

Generate an audio signal made of a sine wave with amplitude 1/8.

The audio signal is bit-exact.

The filter accepts the following options:

Parameters:

Name Type Description Default
frequency Double

Set the carrier frequency. Default is 440 Hz.

Default('440')
beep_factor Double

Enable a periodic beep every second with frequency beep_factor times the carrier frequency. Default is 0, meaning the beep is disabled.

Default('0')
sample_rate Int

Specify the sample rate, default is 44100.

Default('44100')
duration Duration

Specify the duration of the generated audio stream.

Default('0')
samples_per_frame String

Set the number of samples per output frame. The expression can contain the following constants: @end table Default is 1024.

Default('1024')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default AudioStream

the audio stream

References

FFmpeg Documentation

smptebars

smptebars(
    *,
    size: Image_size = Default("320x240"),
    rate: Video_rate = Default("25"),
    duration: Duration = Default("-0.000001"),
    sar: Rational = Default("1/1"),
    extra_options: dict[str, Any] | None = None
) -> VideoStream

The allrgb source returns frames of size 4096x4096 of all rgb colors.

The allyuv source returns frames of size 4096x4096 of all yuv colors.

The color source provides an uniformly colored input.

The colorchart source provides a colors checker chart.

The colorspectrum source provides a color spectrum input.

The haldclutsrc source provides an identity Hald CLUT. See also haldclut filter.

The nullsrc source returns unprocessed video frames. It is mainly useful to be employed in analysis / debugging tools, or as the source for filters which ignore the input data.

The pal75bars source generates a color bars pattern, based on EBU PAL recommendations with 75% color levels.

The pal100bars source generates a color bars pattern, based on EBU PAL recommendations with 100% color levels.

The rgbtestsrc source generates an RGB test pattern useful for detecting RGB vs BGR issues. You should see a red, green and blue stripe from top to bottom.

The smptebars source generates a color bars pattern, based on the SMPTE Engineering Guideline EG 1-1990.

The smptehdbars source generates a color bars pattern, based on the SMPTE RP 219-2002.

The testsrc source generates a test video pattern, showing a color pattern, a scrolling gradient and a timestamp. This is mainly intended for testing purposes.

The testsrc2 source is similar to testsrc, but supports more pixel formats instead of just rgb24. This allows using it as an input for other tests without requiring a format conversion.

The yuvtestsrc source generates an YUV test pattern. You should see a y, cb and cr stripe from top to bottom.

The sources accept the following parameters:

Parameters:

Name Type Description Default
size Image_size

Specify the size of the sourced video. For the syntax of this option, check the "Video size" section in the ffmpeg-utils manual. The default value is 320x240. This option is not available with the allrgb, allyuv, and haldclutsrc filters.

Default('320x240')
rate Video_rate

Specify the frame rate of the sourced video, as the number of frames generated per second. It has to be a string in the format frame_rate_num/frame_rate_den, an integer number, a floating point number or a valid video frame rate abbreviation. The default value is "25".

Default('25')
duration Duration

Set the duration of the sourced video. See the Time duration section in the ffmpeg-utils(1) manual for the accepted syntax. If not specified, or the expressed duration is negative, the video is supposed to be generated forever. Since the frame rate is used as time base, all frames including the last one will have their full duration. If the specified duration is not a multiple of the frame duration, it will be rounded up.

Default('-0.000001')
sar Rational

Set the sample aspect ratio of the sourced video.

Default('1/1')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

smptehdbars

smptehdbars(
    *,
    size: Image_size = Default("320x240"),
    rate: Video_rate = Default("25"),
    duration: Duration = Default("-0.000001"),
    sar: Rational = Default("1/1"),
    extra_options: dict[str, Any] | None = None
) -> VideoStream

The allrgb source returns frames of size 4096x4096 of all rgb colors.

The allyuv source returns frames of size 4096x4096 of all yuv colors.

The color source provides an uniformly colored input.

The colorchart source provides a colors checker chart.

The colorspectrum source provides a color spectrum input.

The haldclutsrc source provides an identity Hald CLUT. See also haldclut filter.

The nullsrc source returns unprocessed video frames. It is mainly useful to be employed in analysis / debugging tools, or as the source for filters which ignore the input data.

The pal75bars source generates a color bars pattern, based on EBU PAL recommendations with 75% color levels.

The pal100bars source generates a color bars pattern, based on EBU PAL recommendations with 100% color levels.

The rgbtestsrc source generates an RGB test pattern useful for detecting RGB vs BGR issues. You should see a red, green and blue stripe from top to bottom.

The smptebars source generates a color bars pattern, based on the SMPTE Engineering Guideline EG 1-1990.

The smptehdbars source generates a color bars pattern, based on the SMPTE RP 219-2002.

The testsrc source generates a test video pattern, showing a color pattern, a scrolling gradient and a timestamp. This is mainly intended for testing purposes.

The testsrc2 source is similar to testsrc, but supports more pixel formats instead of just rgb24. This allows using it as an input for other tests without requiring a format conversion.

The yuvtestsrc source generates an YUV test pattern. You should see a y, cb and cr stripe from top to bottom.

The sources accept the following parameters:

Parameters:

Name Type Description Default
size Image_size

Specify the size of the sourced video. For the syntax of this option, check the "Video size" section in the ffmpeg-utils manual. The default value is 320x240. This option is not available with the allrgb, allyuv, and haldclutsrc filters.

Default('320x240')
rate Video_rate

Specify the frame rate of the sourced video, as the number of frames generated per second. It has to be a string in the format frame_rate_num/frame_rate_den, an integer number, a floating point number or a valid video frame rate abbreviation. The default value is "25".

Default('25')
duration Duration

Set the duration of the sourced video. See the Time duration section in the ffmpeg-utils(1) manual for the accepted syntax. If not specified, or the expressed duration is negative, the video is supposed to be generated forever. Since the frame rate is used as time base, all frames including the last one will have their full duration. If the specified duration is not a multiple of the frame duration, it will be rounded up.

Default('-0.000001')
sar Rational

Set the sample aspect ratio of the sourced video.

Default('1/1')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

streamselect

streamselect(
    *streams: VideoStream,
    inputs: Int = Auto("len(streams)"),
    map: String = Default(None),
    extra_options: dict[str, Any] | None = None
) -> FilterNode

Select video or audio streams.

The filter accepts the following options:

Parameters:

Name Type Description Default
inputs Int

Set number of inputs. Default is 2.

Auto('len(streams)')
map String

Set input indexes to remap to outputs.

Default(None)
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
filter_node FilterNode

the filter node

References

FFmpeg Documentation

testsrc

testsrc(
    *,
    size: Image_size = Default("320x240"),
    rate: Video_rate = Default("25"),
    duration: Duration = Default("-0.000001"),
    sar: Rational = Default("1/1"),
    decimals: Int = Default("0"),
    extra_options: dict[str, Any] | None = None
) -> VideoStream

The allrgb source returns frames of size 4096x4096 of all rgb colors.

The allyuv source returns frames of size 4096x4096 of all yuv colors.

The color source provides an uniformly colored input.

The colorchart source provides a colors checker chart.

The colorspectrum source provides a color spectrum input.

The haldclutsrc source provides an identity Hald CLUT. See also haldclut filter.

The nullsrc source returns unprocessed video frames. It is mainly useful to be employed in analysis / debugging tools, or as the source for filters which ignore the input data.

The pal75bars source generates a color bars pattern, based on EBU PAL recommendations with 75% color levels.

The pal100bars source generates a color bars pattern, based on EBU PAL recommendations with 100% color levels.

The rgbtestsrc source generates an RGB test pattern useful for detecting RGB vs BGR issues. You should see a red, green and blue stripe from top to bottom.

The smptebars source generates a color bars pattern, based on the SMPTE Engineering Guideline EG 1-1990.

The smptehdbars source generates a color bars pattern, based on the SMPTE RP 219-2002.

The testsrc source generates a test video pattern, showing a color pattern, a scrolling gradient and a timestamp. This is mainly intended for testing purposes.

The testsrc2 source is similar to testsrc, but supports more pixel formats instead of just rgb24. This allows using it as an input for other tests without requiring a format conversion.

The yuvtestsrc source generates an YUV test pattern. You should see a y, cb and cr stripe from top to bottom.

The sources accept the following parameters:

Parameters:

Name Type Description Default
size Image_size

Specify the size of the sourced video. For the syntax of this option, check the "Video size" section in the ffmpeg-utils manual. The default value is 320x240. This option is not available with the allrgb, allyuv, and haldclutsrc filters.

Default('320x240')
rate Video_rate

Specify the frame rate of the sourced video, as the number of frames generated per second. It has to be a string in the format frame_rate_num/frame_rate_den, an integer number, a floating point number or a valid video frame rate abbreviation. The default value is "25".

Default('25')
duration Duration

Set the duration of the sourced video. See the Time duration section in the ffmpeg-utils(1) manual for the accepted syntax. If not specified, or the expressed duration is negative, the video is supposed to be generated forever. Since the frame rate is used as time base, all frames including the last one will have their full duration. If the specified duration is not a multiple of the frame duration, it will be rounded up.

Default('-0.000001')
sar Rational

Set the sample aspect ratio of the sourced video.

Default('1/1')
decimals Int

Set the number of decimals to show in the timestamp, only available in the testsrc source. The displayed timestamp value will correspond to the original timestamp value multiplied by the power of 10 of the specified value. Default value is 0.

Default('0')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

testsrc2

testsrc2(
    *,
    size: Image_size = Default("320x240"),
    rate: Video_rate = Default("25"),
    duration: Duration = Default("-0.000001"),
    sar: Rational = Default("1/1"),
    alpha: Int = Default("255"),
    extra_options: dict[str, Any] | None = None
) -> VideoStream

The allrgb source returns frames of size 4096x4096 of all rgb colors.

The allyuv source returns frames of size 4096x4096 of all yuv colors.

The color source provides an uniformly colored input.

The colorchart source provides a colors checker chart.

The colorspectrum source provides a color spectrum input.

The haldclutsrc source provides an identity Hald CLUT. See also haldclut filter.

The nullsrc source returns unprocessed video frames. It is mainly useful to be employed in analysis / debugging tools, or as the source for filters which ignore the input data.

The pal75bars source generates a color bars pattern, based on EBU PAL recommendations with 75% color levels.

The pal100bars source generates a color bars pattern, based on EBU PAL recommendations with 100% color levels.

The rgbtestsrc source generates an RGB test pattern useful for detecting RGB vs BGR issues. You should see a red, green and blue stripe from top to bottom.

The smptebars source generates a color bars pattern, based on the SMPTE Engineering Guideline EG 1-1990.

The smptehdbars source generates a color bars pattern, based on the SMPTE RP 219-2002.

The testsrc source generates a test video pattern, showing a color pattern, a scrolling gradient and a timestamp. This is mainly intended for testing purposes.

The testsrc2 source is similar to testsrc, but supports more pixel formats instead of just rgb24. This allows using it as an input for other tests without requiring a format conversion.

The yuvtestsrc source generates an YUV test pattern. You should see a y, cb and cr stripe from top to bottom.

The sources accept the following parameters:

Parameters:

Name Type Description Default
size Image_size

Specify the size of the sourced video. For the syntax of this option, check the "Video size" section in the ffmpeg-utils manual. The default value is 320x240. This option is not available with the allrgb, allyuv, and haldclutsrc filters.

Default('320x240')
rate Video_rate

Specify the frame rate of the sourced video, as the number of frames generated per second. It has to be a string in the format frame_rate_num/frame_rate_den, an integer number, a floating point number or a valid video frame rate abbreviation. The default value is "25".

Default('25')
duration Duration

Set the duration of the sourced video. See the Time duration section in the ffmpeg-utils(1) manual for the accepted syntax. If not specified, or the expressed duration is negative, the video is supposed to be generated forever. Since the frame rate is used as time base, all frames including the last one will have their full duration. If the specified duration is not a multiple of the frame duration, it will be rounded up.

Default('-0.000001')
sar Rational

Set the sample aspect ratio of the sourced video.

Default('1/1')
alpha Int

Specify the alpha (opacity) of the background, only available in the testsrc2 source. The value must be between 0 (fully transparent) and 255 (fully opaque, the default).

Default('255')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

unpremultiply

unpremultiply(
    *streams: VideoStream,
    planes: Int = Default("15"),
    inplace: Boolean = Default("false"),
    timeline_options: FFMpegTimelineOption | None = None,
    enable: str | None = None,
    extra_options: dict[str, Any] | None = None
) -> VideoStream

Apply alpha unpremultiply effect to input video stream using first plane of second stream as alpha.

Both streams must have same dimensions and same pixel format.

The filter accepts the following option:

Parameters:

Name Type Description Default
planes Int

Set which planes will be processed, unprocessed planes will be copied. By default value 0xf, all planes will be processed. If the format has 1 or 2 components, then luma is bit 0. If the format has 3 or 4 components: for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red; for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V. If present, the alpha channel is always the last bit.

Default('15')
inplace Boolean

Do not require 2nd input for processing, instead use alpha plane from input stream.

Default('false')
timeline_options FFMpegTimelineOption | None

Timeline options

None
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

vstack

vstack(
    *streams: VideoStream,
    inputs: Int = Auto("len(streams)"),
    shortest: Boolean = Default("false"),
    extra_options: dict[str, Any] | None = None
) -> VideoStream

Stack input videos vertically.

All streams must be of same pixel format and of same width.

Note that this filter is faster than using overlay and pad filter to create same output.

The filter accepts the following options:

Parameters:

Name Type Description Default
inputs Int

Set number of input streams. Default is 2.

Auto('len(streams)')
shortest Boolean

If set to 1, force the output to terminate when the shortest input terminates. Default value is 0.

Default('false')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

vstack_vaapi

vstack_vaapi(
    *streams: VideoStream,
    inputs: Int = Default("2"),
    shortest: Boolean = Default("false"),
    width: Int = Default("0"),
    extra_options: dict[str, Any] | None = None
) -> VideoStream

Stack input videos vertically.

This is the VA-API variant of the vstack filter, each input stream may have different width, this filter will scale down/up each input stream while keeping the original aspect.

It accepts the following options:

Parameters:

Name Type Description Default
inputs Int

See vstack.

Default('2')
shortest Boolean

See vstack.

Default('false')
width Int

Set width of output. If set to 0, this filter will set width of output to width of the first input stream. Default value is 0.

Default('0')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

xmedian

xmedian(
    *streams: VideoStream,
    inputs: Int = Auto("len(streams)"),
    planes: Int = Default("15"),
    percentile: Float = Default("0.5"),
    framesync_options: FFMpegFrameSyncOption | None = None,
    eof_action: str | None = None,
    shortest: bool | None = None,
    repeatlast: bool | None = None,
    timeline_options: FFMpegTimelineOption | None = None,
    enable: str | None = None,
    extra_options: dict[str, Any] | None = None
) -> VideoStream

Pick median pixels from several input videos.

The filter accepts the following options:

Parameters:

Name Type Description Default
inputs Int

Set number of inputs. Default is 3. Allowed range is from 3 to 255. If number of inputs is even number, than result will be mean value between two median values.

Auto('len(streams)')
planes Int

Set which planes to filter. Default value is 15, by which all planes are processed.

Default('15')
percentile Float

Set median percentile. Default value is 0.5. Default value of 0.5 will pick always median values, while 0 will pick minimum values, and 1 maximum values.

Default('0.5')
framesync_options FFMpegFrameSyncOption | None

Framesync options

None
timeline_options FFMpegTimelineOption | None

Timeline options

None
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

xstack

xstack(
    *streams: VideoStream,
    inputs: Int = Auto("len(streams)"),
    layout: String = Default(None),
    grid: Image_size = Default(None),
    shortest: Boolean = Default("false"),
    fill: String = Default("none"),
    extra_options: dict[str, Any] | None = None
) -> VideoStream

Stack video inputs into custom layout.

All streams must be of same pixel format.

The filter accepts the following options:

Parameters:

Name Type Description Default
inputs Int

Set number of input streams. Default is 2.

Auto('len(streams)')
layout String

Specify layout of inputs. This option requires the desired layout configuration to be explicitly set by the user. This sets position of each video input in output. Each input is separated by '|'. The first number represents the column, and the second number represents the row. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX, where X is video input from which to take width or height. Multiple values can be used when separated by '+'. In such case values are summed together. Note that if inputs are of different sizes gaps may appear, as not all of the output video frame will be filled. Similarly, videos can overlap each other if their position doesn't leave enough space for the full frame of adjoining videos. For 2 inputs, a default layout of 0_0|w0_0 (equivalent to grid=2x1) is set. In all other cases, a layout or a grid must be set by the user. Either grid or layout can be specified at a time. Specifying both will result in an error.

Default(None)
grid Image_size

Specify a fixed size grid of inputs. This option is used to create a fixed size grid of the input streams. Set the grid size in the form COLUMNSxROWS. There must be ROWS * COLUMNS input streams and they will be arranged as a grid with ROWS rows and COLUMNS columns. When using this option, each input stream within a row must have the same height and all the rows must have the same width. If grid is set, then inputs option is ignored and is implicitly set to ROWS * COLUMNS. For 2 inputs, a default grid of 2x1 (equivalent to layout=0_0|w0_0) is set. In all other cases, a layout or a grid must be set by the user. Either grid or layout can be specified at a time. Specifying both will result in an error.

Default(None)
shortest Boolean

If set to 1, force the output to terminate when the shortest input terminates. Default value is 0.

Default('false')
fill String

If set to valid color, all unused pixels will be filled with that color. By default fill is set to none, so it is disabled.

Default('none')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

xstack_vaapi

xstack_vaapi(
    *streams: VideoStream,
    inputs: Int = Default("2"),
    shortest: Boolean = Default("false"),
    layout: String = Default(None),
    grid: Image_size = Default(None),
    grid_tile_size: Image_size = Default(None),
    fill: String = Default("none"),
    extra_options: dict[str, Any] | None = None
) -> VideoStream

Stack video inputs into custom layout.

This is the VA-API variant of the xstack filter, each input stream may have different size, this filter will scale down/up each input stream to the given output size, or the size of the first input stream.

It accepts the following options:

Parameters:

Name Type Description Default
inputs Int

See xstack.

Default('2')
shortest Boolean

See xstack.

Default('false')
layout String

See xstack. Moreover, this permits the user to supply output size for each input stream. @example xstack_vaapi=inputs=4:layout=0_0_1920x1080|0_h0_1920x1080|w0_0_1920x1080|w0_h0_1920x1080 @end example

Default(None)
grid Image_size

See xstack.

Default(None)
grid_tile_size Image_size

Set output size for each input stream when grid is set. If this option is not set, this filter will set output size by default to the size of the first input stream. For the syntax of this option, check the "Video size" section in the ffmpeg-utils manual.

Default(None)
fill String

See xstack.

Default('none')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

yuvtestsrc

yuvtestsrc(
    *,
    size: Image_size = Default("320x240"),
    rate: Video_rate = Default("25"),
    duration: Duration = Default("-0.000001"),
    sar: Rational = Default("1/1"),
    extra_options: dict[str, Any] | None = None
) -> VideoStream

The allrgb source returns frames of size 4096x4096 of all rgb colors.

The allyuv source returns frames of size 4096x4096 of all yuv colors.

The color source provides an uniformly colored input.

The colorchart source provides a colors checker chart.

The colorspectrum source provides a color spectrum input.

The haldclutsrc source provides an identity Hald CLUT. See also haldclut filter.

The nullsrc source returns unprocessed video frames. It is mainly useful to be employed in analysis / debugging tools, or as the source for filters which ignore the input data.

The pal75bars source generates a color bars pattern, based on EBU PAL recommendations with 75% color levels.

The pal100bars source generates a color bars pattern, based on EBU PAL recommendations with 100% color levels.

The rgbtestsrc source generates an RGB test pattern useful for detecting RGB vs BGR issues. You should see a red, green and blue stripe from top to bottom.

The smptebars source generates a color bars pattern, based on the SMPTE Engineering Guideline EG 1-1990.

The smptehdbars source generates a color bars pattern, based on the SMPTE RP 219-2002.

The testsrc source generates a test video pattern, showing a color pattern, a scrolling gradient and a timestamp. This is mainly intended for testing purposes.

The testsrc2 source is similar to testsrc, but supports more pixel formats instead of just rgb24. This allows using it as an input for other tests without requiring a format conversion.

The yuvtestsrc source generates an YUV test pattern. You should see a y, cb and cr stripe from top to bottom.

The sources accept the following parameters:

Parameters:

Name Type Description Default
size Image_size

Specify the size of the sourced video. For the syntax of this option, check the "Video size" section in the ffmpeg-utils manual. The default value is 320x240. This option is not available with the allrgb, allyuv, and haldclutsrc filters.

Default('320x240')
rate Video_rate

Specify the frame rate of the sourced video, as the number of frames generated per second. It has to be a string in the format frame_rate_num/frame_rate_den, an integer number, a floating point number or a valid video frame rate abbreviation. The default value is "25".

Default('25')
duration Duration

Set the duration of the sourced video. See the Time duration section in the ffmpeg-utils(1) manual for the accepted syntax. If not specified, or the expressed duration is negative, the video is supposed to be generated forever. Since the frame rate is used as time base, all frames including the last one will have their full duration. If the specified duration is not a multiple of the frame duration, it will be rounded up.

Default('-0.000001')
sar Rational

Set the sample aspect ratio of the sourced video.

Default('1/1')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation

zoneplate

zoneplate(
    *,
    size: Image_size = Default("320x240"),
    rate: Video_rate = Default("25"),
    duration: Duration = Default("-0.000001"),
    sar: Rational = Default("1/1"),
    precision: Int = Default("10"),
    xo: Int = Default("0"),
    yo: Int = Default("0"),
    to: Int = Default("0"),
    k0: Int = Default("0"),
    kx: Int = Default("0"),
    ky: Int = Default("0"),
    kt: Int = Default("0"),
    kxt: Int = Default("0"),
    kyt: Int = Default("0"),
    kxy: Int = Default("0"),
    kx2: Int = Default("0"),
    ky2: Int = Default("0"),
    kt2: Int = Default("0"),
    ku: Int = Default("0"),
    kv: Int = Default("0"),
    extra_options: dict[str, Any] | None = None
) -> VideoStream

Generate a zoneplate test video pattern.

This source accepts the following options:

Parameters:

Name Type Description Default
size Image_size

Set frame size. For the syntax of this option, check the "Video size" section in the ffmpeg-utils manual. Default value is "320x240".

Default('320x240')
rate Video_rate

Set frame rate, expressed as number of frames per second. Default value is "25".

Default('25')
duration Duration

Set the duration of the sourced video. See the Time duration section in the ffmpeg-utils(1) manual for the accepted syntax. If not specified, or the expressed duration is negative, the video is supposed to be generated forever.

Default('-0.000001')
sar Rational

Set the sample aspect ratio of the sourced video.

Default('1/1')
precision Int

Set precision in bits for look-up table for sine calculations. Default value is 10. Allowed range is from 4 to 16.

Default('10')
xo Int

Set horizontal axis offset for output signal. Default value is 0.

Default('0')
yo Int

Set vertical axis offset for output signal. Default value is 0.

Default('0')
to Int

Set time axis offset for output signal. Default value is 0.

Default('0')
k0 Int

Set 0-order, constant added to signal phase. Default value is 0.

Default('0')
kx Int

Set 1-order, phase factor multiplier for horizontal axis. Default value is 0.

Default('0')
ky Int

Set 1-order, phase factor multiplier for vertical axis. Default value is 0.

Default('0')
kt Int

Set 1-order, phase factor multiplier for time axis. Default value is 0.

Default('0')
kxt Int

Set phase factor multipliers for combination of spatial and temporal axis. Default value is 0.

Default('0')
kyt Int

Set phase factor multipliers for combination of spatial and temporal axis. Default value is 0.

Default('0')
kxy Int

Set phase factor multipliers for combination of spatial and temporal axis. Default value is 0.

Default('0')
kx2 Int

Set 2-order, phase factor multiplier for horizontal axis. Default value is 0.

Default('0')
ky2 Int

Set 2-order, phase factor multiplier for vertical axis. Default value is 0.

Default('0')
kt2 Int

Set 2-order, phase factor multiplier for time axis. Default value is 0.

Default('0')
ku Int

Set the constant added to final phase to produce chroma-blue component of signal. Default value is 0.

Default('0')
kv Int

Set the constant added to final phase to produce chroma-red component of signal. Default value is 0.

Default('0')
extra_options dict[str, Any] | None

Extra options for the filter

None

Returns:

Name Type Description
default VideoStream

the video stream

References

FFmpeg Documentation