Skip to content

options

FFmpeg options.

Modules:

Name Description
codec

FFmpeg codec options.

format

FFmpeg format options.

framesync

Framesync options. Some filters with several inputs support a common set of options. These options can only be set by name, not with the short notation.

timeline

FFmpeg timeline options module.

Functions:

Name Description
decoder_codec_context

Decoder codec context options.

decoder_format_context

Decoder format context options.

encoder_codec_context

Encoder codec context options.

encoder_format_context

Encoder format context options.

decoder_codec_context

decoder_codec_context(
    *,
    flags: str | None = None,
    export_side_data: str | None = None,
    ar: int | None = None,
    ac: int | None = None,
    bug: str | None = None,
    strict: (
        int
        | None
        | Literal[
            "very",
            "strict",
            "normal",
            "unofficial",
            "experimental",
        ]
    ) = None,
    err_detect: str | None = None,
    idct: (
        int
        | None
        | Literal[
            "auto",
            "int",
            "simple",
            "simplemmx",
            "arm",
            "altivec",
            "simplearm",
            "simplearmv5te",
            "simplearmv6",
            "simpleneon",
            "xvid",
            "xvidmmx",
            "faani",
            "simpleauto",
        ]
    ) = None,
    ec: str | None = None,
    debug: str | None = None,
    threads: int | None | Literal["auto"] = None,
    skip_top: int | None = None,
    skip_bottom: int | None = None,
    lowres: int | None = None,
    skip_loop_filter: (
        int
        | None
        | Literal[
            "none",
            "default",
            "noref",
            "bidir",
            "nointra",
            "nokey",
            "all",
        ]
    ) = None,
    skip_idct: (
        int
        | None
        | Literal[
            "none",
            "default",
            "noref",
            "bidir",
            "nointra",
            "nokey",
            "all",
        ]
    ) = None,
    skip_frame: (
        int
        | None
        | Literal[
            "none",
            "default",
            "noref",
            "bidir",
            "nointra",
            "nokey",
            "all",
        ]
    ) = None,
    ch_layout: str | None = None,
    channel_layout: str | None = None,
    request_channel_layout: str | None = None,
    ticks_per_frame: int | None = None,
    color_primaries: (
        int
        | None
        | Literal[
            "bt709",
            "unknown",
            "bt470m",
            "bt470bg",
            "smpte170m",
            "smpte240m",
            "film",
            "bt2020",
            "smpte428",
            "smpte428_1",
            "smpte431",
            "smpte432",
            "jedec-p22",
            "ebu3213",
            "unspecified",
        ]
    ) = None,
    color_trc: (
        int
        | None
        | Literal[
            "bt709",
            "unknown",
            "gamma22",
            "gamma28",
            "smpte170m",
            "smpte240m",
            "linear",
            "log100",
            "log316",
            "iec61966-2-4",
            "bt1361e",
            "iec61966-2-1",
            "bt2020-10",
            "bt2020-12",
            "smpte2084",
            "smpte428",
            "arib-std-b67",
            "unspecified",
            "log",
            "log_sqrt",
            "iec61966_2_4",
            "bt1361",
            "iec61966_2_1",
            "bt2020_10bit",
            "bt2020_12bit",
            "smpte428_1",
        ]
    ) = None,
    colorspace: (
        int
        | None
        | Literal[
            "rgb",
            "bt709",
            "unknown",
            "fcc",
            "bt470bg",
            "smpte170m",
            "smpte240m",
            "ycgco",
            "bt2020nc",
            "bt2020c",
            "smpte2085",
            "chroma-derived-nc",
            "chroma-derived-c",
            "ictcp",
            "unspecified",
            "ycocg",
            "bt2020_ncl",
            "bt2020_cl",
        ]
    ) = None,
    color_range: (
        int
        | None
        | Literal[
            "unknown",
            "tv",
            "pc",
            "unspecified",
            "mpeg",
            "jpeg",
            "limited",
            "full",
        ]
    ) = None,
    chroma_sample_location: (
        int
        | None
        | Literal[
            "unknown",
            "left",
            "center",
            "topleft",
            "top",
            "bottomleft",
            "bottom",
            "unspecified",
        ]
    ) = None,
    thread_type: str | None = None,
    request_sample_fmt: str | None = None,
    sub_charenc: str | None = None,
    sub_charenc_mode: str | None = None,
    apply_cropping: bool | None = None,
    skip_alpha: bool | None = None,
    field_order: (
        int
        | None
        | Literal["progressive", "tt", "bb", "tb", "bt"]
    ) = None,
    dump_separator: str | None = None,
    codec_whitelist: str | None = None,
    max_pixels: int | None = None,
    max_samples: int | None = None,
    hwaccel_flags: str | None = None,
    extra_hw_frames: int | None = None,
    discard_damaged_percentage: int | None = None
) -> FFMpegAVCodecContextDecoderOption

Decoder codec context options.

Parameters:

Name Type Description Default
flags str | None

(default 0),

None
export_side_data str | None

Export metadata as side data (default 0),

None
ar int | None

set audio sampling rate (in Hz) (from 0 to INT_MAX) (default 0),

None
ac int | None

set number of audio channels (from 0 to INT_MAX) (default 0),

None
bug str | None

work around not autodetected encoder bugs (default autodetect),

None
strict int | None | Literal['very', 'strict', 'normal', 'unofficial', 'experimental']

how strictly to follow the standards (from INT_MIN to INT_MAX) (default normal),

None
err_detect str | None

set error detection flags (default 0),

None
idct int | None | Literal['auto', 'int', 'simple', 'simplemmx', 'arm', 'altivec', 'simplearm', 'simplearmv5te', 'simplearmv6', 'simpleneon', 'xvid', 'xvidmmx', 'faani', 'simpleauto']

select IDCT implementation (from 0 to INT_MAX) (default auto),

None
ec str | None

set error concealment strategy (default guess_mvs+deblock),

None
debug str | None

print specific debug info (default 0),

None
threads int | None | Literal['auto']

set the number of threads (from 0 to INT_MAX) (default 1),

None
skip_top int | None

number of macroblock rows at the top which are skipped (from INT_MIN to INT_MAX) (default 0),

None
skip_bottom int | None

number of macroblock rows at the bottom which are skipped (from INT_MIN to INT_MAX) (default 0),

None
lowres int | None

decode at 1= 1/2, 2=1/4, 3=1/8 resolutions (from 0 to INT_MAX) (default 0),

None
skip_loop_filter int | None | Literal['none', 'default', 'noref', 'bidir', 'nointra', 'nokey', 'all']

skip loop filtering process for the selected frames (from INT_MIN to INT_MAX) (default default),

None
skip_idct int | None | Literal['none', 'default', 'noref', 'bidir', 'nointra', 'nokey', 'all']

skip IDCT/dequantization for the selected frames (from INT_MIN to INT_MAX) (default default),

None
skip_frame int | None | Literal['none', 'default', 'noref', 'bidir', 'nointra', 'nokey', 'all']

skip decoding for the selected frames (from INT_MIN to INT_MAX) (default default),

None
ch_layout str | None

,

None
channel_layout str | None

(default 0x0),

None
request_channel_layout str | None

(default 0x0),

None
ticks_per_frame int | None

(from 1 to INT_MAX) (default 1),

None
color_primaries int | None | Literal['bt709', 'unknown', 'bt470m', 'bt470bg', 'smpte170m', 'smpte240m', 'film', 'bt2020', 'smpte428', 'smpte428_1', 'smpte431', 'smpte432', 'jedec-p22', 'ebu3213', 'unspecified']

color primaries (from 1 to INT_MAX) (default unknown),

None
color_trc int | None | Literal['bt709', 'unknown', 'gamma22', 'gamma28', 'smpte170m', 'smpte240m', 'linear', 'log100', 'log316', 'iec61966-2-4', 'bt1361e', 'iec61966-2-1', 'bt2020-10', 'bt2020-12', 'smpte2084', 'smpte428', 'arib-std-b67', 'unspecified', 'log', 'log_sqrt', 'iec61966_2_4', 'bt1361', 'iec61966_2_1', 'bt2020_10bit', 'bt2020_12bit', 'smpte428_1']

color transfer characteristics (from 1 to INT_MAX) (default unknown),

None
colorspace int | None | Literal['rgb', 'bt709', 'unknown', 'fcc', 'bt470bg', 'smpte170m', 'smpte240m', 'ycgco', 'bt2020nc', 'bt2020c', 'smpte2085', 'chroma-derived-nc', 'chroma-derived-c', 'ictcp', 'unspecified', 'ycocg', 'bt2020_ncl', 'bt2020_cl']

color space (from 0 to INT_MAX) (default unknown),

None
color_range int | None | Literal['unknown', 'tv', 'pc', 'unspecified', 'mpeg', 'jpeg', 'limited', 'full']

color range (from 0 to INT_MAX) (default unknown),

None
chroma_sample_location int | None | Literal['unknown', 'left', 'center', 'topleft', 'top', 'bottomleft', 'bottom', 'unspecified']

chroma sample location (from 0 to INT_MAX) (default unknown),

None
thread_type str | None

select multithreading type (default slice+frame),

None
request_sample_fmt str | None

sample format audio decoders should prefer (default none),

None
sub_charenc str | None

set input text subtitles character encoding,

None
sub_charenc_mode str | None

set input text subtitles character encoding mode (default 0),

None
apply_cropping bool | None

(default true),

None
skip_alpha bool | None

Skip processing alpha (default false),

None
field_order int | None | Literal['progressive', 'tt', 'bb', 'tb', 'bt']

Field order (from 0 to 5) (default 0),

None
dump_separator str | None

set information dump field separator,

None
codec_whitelist str | None

List of decoders that are allowed to be used,

None
max_pixels int | None

Maximum number of pixels (from 0 to INT_MAX) (default INT_MAX),

None
max_samples int | None

Maximum number of samples (from 0 to INT_MAX) (default INT_MAX),

None
hwaccel_flags str | None

(default ignore_level),

None
extra_hw_frames int | None

Number of extra hardware frames to allocate for the user (from -1 to INT_MAX) (default -1),

None
discard_damaged_percentage int | None

Percentage of damaged samples to discard a frame (from 0 to 100) (default 95),

None

Returns:

Type Description
FFMpegAVCodecContextDecoderOption

FFMpegAVCodecContextDecoderOption

decoder_format_context

decoder_format_context(
    *,
    avioflags: str | None = None,
    probesize: int | None = None,
    formatprobesize: int | None = None,
    fflags: str | None = None,
    seek2any: bool | None = None,
    analyzeduration: int | None = None,
    cryptokey: str | None = None,
    indexmem: int | None = None,
    rtbufsize: int | None = None,
    fdebug: str | None = None,
    max_delay: int | None = None,
    fpsprobesize: int | None = None,
    f_err_detect: str | None = None,
    err_detect: str | None = None,
    use_wallclock_as_timestamps: bool | None = None,
    skip_initial_bytes: int | None = None,
    correct_ts_overflow: bool | None = None,
    f_strict: (
        int
        | None
        | Literal[
            "very",
            "strict",
            "normal",
            "unofficial",
            "experimental",
        ]
    ) = None,
    strict: (
        int
        | None
        | Literal[
            "very",
            "strict",
            "normal",
            "unofficial",
            "experimental",
        ]
    ) = None,
    max_ts_probe: int | None = None,
    dump_separator: str | None = None,
    codec_whitelist: str | None = None,
    format_whitelist: str | None = None,
    protocol_whitelist: str | None = None,
    protocol_blacklist: str | None = None,
    max_streams: int | None = None,
    skip_estimate_duration_from_pts: bool | None = None,
    max_probe_packets: int | None = None
) -> FFMpegAVFormatContextDecoderOption

Decoder format context options.

Parameters:

Name Type Description Default
avioflags str | None

(default 0),

None
probesize int | None

set probing size (from 32 to I64_MAX) (default 5000000),

None
formatprobesize int | None

number of bytes to probe file format (from 0 to 2.14748e+09) (default 1048576),

None
fflags str | None

(default autobsf),

None
seek2any bool | None

allow seeking to non-keyframes on demuxer level when supported (default false),

None
analyzeduration int | None

specify how many microseconds are analyzed to probe the input (from 0 to I64_MAX) (default 0),

None
cryptokey str | None

decryption key,

None
indexmem int | None

max memory used for timestamp index (per stream) (from 0 to INT_MAX) (default 1048576),

None
rtbufsize int | None

max memory used for buffering real-time frames (from 0 to INT_MAX) (default 3041280),

None
fdebug str | None

print specific debug info (default 0),

None
max_delay int | None

maximum muxing or demuxing delay in microseconds (from -1 to INT_MAX) (default -1),

None
fpsprobesize int | None

number of frames used to probe fps (from -1 to 2.14748e+09) (default -1),

None
f_err_detect str | None

set error detection flags (deprecated; use err_detect, save via avconv) (default crccheck),

None
err_detect str | None

set error detection flags (default crccheck),

None
use_wallclock_as_timestamps bool | None

use wallclock as timestamps (default false),

None
skip_initial_bytes int | None

set number of bytes to skip before reading header and frames (from 0 to I64_MAX) (default 0),

None
correct_ts_overflow bool | None

correct single timestamp overflows (default true),

None
f_strict int | None | Literal['very', 'strict', 'normal', 'unofficial', 'experimental']

how strictly to follow the standards (deprecated; use strict, save via avconv) (from INT_MIN to INT_MAX) (default normal),

None
strict int | None | Literal['very', 'strict', 'normal', 'unofficial', 'experimental']

how strictly to follow the standards (from INT_MIN to INT_MAX) (default normal),

None
max_ts_probe int | None

maximum number of packets to read while waiting for the first timestamp (from 0 to INT_MAX) (default 50),

None
dump_separator str | None

set information dump field separator (default ", "),

None
codec_whitelist str | None

List of decoders that are allowed to be used,

None
format_whitelist str | None

List of demuxers that are allowed to be used,

None
protocol_whitelist str | None

List of protocols that are allowed to be used,

None
protocol_blacklist str | None

List of protocols that are not allowed to be used,

None
max_streams int | None

maximum number of streams (from 0 to INT_MAX) (default 1000),

None
skip_estimate_duration_from_pts bool | None

skip duration calculation in estimate_timings_from_pts (default false),

None
max_probe_packets int | None

Maximum number of packets to probe a codec (from 0 to INT_MAX) (default 2500),

None

Returns:

Type Description
FFMpegAVFormatContextDecoderOption

FFMpegAVFormatContextDecoderOption

encoder_codec_context

encoder_codec_context(
    *,
    b: int | None = None,
    ab: int | None = None,
    bt: int | None = None,
    flags: str | None = None,
    export_side_data: str | None = None,
    g: int | None = None,
    ar: int | None = None,
    ac: int | None = None,
    cutoff: int | None = None,
    frame_size: int | None = None,
    qcomp: float | None = None,
    qblur: float | None = None,
    qmin: int | None = None,
    qmax: int | None = None,
    qdiff: int | None = None,
    bf: int | None = None,
    b_qfactor: float | None = None,
    strict: (
        int
        | None
        | Literal[
            "very",
            "strict",
            "normal",
            "unofficial",
            "experimental",
        ]
    ) = None,
    b_qoffset: float | None = None,
    err_detect: str | None = None,
    maxrate: int | None = None,
    minrate: int | None = None,
    bufsize: int | None = None,
    i_qfactor: float | None = None,
    i_qoffset: float | None = None,
    dct: (
        int
        | None
        | Literal[
            "auto",
            "fastint",
            "int",
            "mmx",
            "altivec",
            "faan",
        ]
    ) = None,
    lumi_mask: float | None = None,
    tcplx_mask: float | None = None,
    scplx_mask: float | None = None,
    p_mask: float | None = None,
    dark_mask: float | None = None,
    idct: (
        int
        | None
        | Literal[
            "auto",
            "int",
            "simple",
            "simplemmx",
            "arm",
            "altivec",
            "simplearm",
            "simplearmv5te",
            "simplearmv6",
            "simpleneon",
            "xvid",
            "xvidmmx",
            "faani",
            "simpleauto",
        ]
    ) = None,
    aspect: str | None = None,
    debug: str | None = None,
    dia_size: int | None = None,
    last_pred: int | None = None,
    pre_dia_size: int | None = None,
    subq: int | None = None,
    me_range: int | None = None,
    global_quality: int | None = None,
    mbd: (
        int | None | Literal["simple", "bits", "rd"]
    ) = None,
    rc_init_occupancy: int | None = None,
    threads: int | None | Literal["auto"] = None,
    dc: int | None = None,
    nssew: int | None = None,
    profile: (
        int | None | Literal["unknown", "main10"]
    ) = None,
    level: int | None | Literal["unknown"] = None,
    cmp: (
        int
        | None
        | Literal[
            "sad",
            "sse",
            "satd",
            "dct",
            "psnr",
            "bit",
            "rd",
            "zero",
            "vsad",
            "vsse",
            "nsse",
            "w53",
            "w97",
            "dctmax",
            "chroma",
            "msad",
        ]
    ) = None,
    subcmp: (
        int
        | None
        | Literal[
            "sad",
            "sse",
            "satd",
            "dct",
            "psnr",
            "bit",
            "rd",
            "zero",
            "vsad",
            "vsse",
            "nsse",
            "w53",
            "w97",
            "dctmax",
            "chroma",
            "msad",
        ]
    ) = None,
    mbcmp: (
        int
        | None
        | Literal[
            "sad",
            "sse",
            "satd",
            "dct",
            "psnr",
            "bit",
            "rd",
            "zero",
            "vsad",
            "vsse",
            "nsse",
            "w53",
            "w97",
            "dctmax",
            "chroma",
            "msad",
        ]
    ) = None,
    ildctcmp: (
        int
        | None
        | Literal[
            "sad",
            "sse",
            "satd",
            "dct",
            "psnr",
            "bit",
            "rd",
            "zero",
            "vsad",
            "vsse",
            "nsse",
            "w53",
            "w97",
            "dctmax",
            "chroma",
            "msad",
        ]
    ) = None,
    precmp: (
        int
        | None
        | Literal[
            "sad",
            "sse",
            "satd",
            "dct",
            "psnr",
            "bit",
            "rd",
            "zero",
            "vsad",
            "vsse",
            "nsse",
            "w53",
            "w97",
            "dctmax",
            "chroma",
            "msad",
        ]
    ) = None,
    mblmin: int | None = None,
    mblmax: int | None = None,
    bidir_refine: int | None = None,
    keyint_min: int | None = None,
    refs: int | None = None,
    trellis: int | None = None,
    mv0_threshold: int | None = None,
    compression_level: int | None = None,
    ch_layout: str | None = None,
    channel_layout: str | None = None,
    rc_max_vbv_use: float | None = None,
    rc_min_vbv_use: float | None = None,
    ticks_per_frame: int | None = None,
    color_primaries: (
        int
        | None
        | Literal[
            "bt709",
            "unknown",
            "bt470m",
            "bt470bg",
            "smpte170m",
            "smpte240m",
            "film",
            "bt2020",
            "smpte428",
            "smpte428_1",
            "smpte431",
            "smpte432",
            "jedec-p22",
            "ebu3213",
            "unspecified",
        ]
    ) = None,
    color_trc: (
        int
        | None
        | Literal[
            "bt709",
            "unknown",
            "gamma22",
            "gamma28",
            "smpte170m",
            "smpte240m",
            "linear",
            "log100",
            "log316",
            "iec61966-2-4",
            "bt1361e",
            "iec61966-2-1",
            "bt2020-10",
            "bt2020-12",
            "smpte2084",
            "smpte428",
            "arib-std-b67",
            "unspecified",
            "log",
            "log_sqrt",
            "iec61966_2_4",
            "bt1361",
            "iec61966_2_1",
            "bt2020_10bit",
            "bt2020_12bit",
            "smpte428_1",
        ]
    ) = None,
    colorspace: (
        int
        | None
        | Literal[
            "rgb",
            "bt709",
            "unknown",
            "fcc",
            "bt470bg",
            "smpte170m",
            "smpte240m",
            "ycgco",
            "bt2020nc",
            "bt2020c",
            "smpte2085",
            "chroma-derived-nc",
            "chroma-derived-c",
            "ictcp",
            "unspecified",
            "ycocg",
            "bt2020_ncl",
            "bt2020_cl",
        ]
    ) = None,
    color_range: (
        int
        | None
        | Literal[
            "unknown",
            "tv",
            "pc",
            "unspecified",
            "mpeg",
            "jpeg",
            "limited",
            "full",
        ]
    ) = None,
    chroma_sample_location: (
        int
        | None
        | Literal[
            "unknown",
            "left",
            "center",
            "topleft",
            "top",
            "bottomleft",
            "bottom",
            "unspecified",
        ]
    ) = None,
    slices: int | None = None,
    thread_type: str | None = None,
    audio_service_type: (
        int
        | None
        | Literal[
            "ma",
            "ef",
            "vi",
            "hi",
            "di",
            "co",
            "em",
            "vo",
            "ka",
        ]
    ) = None,
    field_order: (
        int
        | None
        | Literal["progressive", "tt", "bb", "tb", "bt"]
    ) = None,
    dump_separator: str | None = None,
    max_pixels: int | None = None,
    max_samples: int | None = None
) -> FFMpegAVCodecContextEncoderOption

Encoder codec context options.

Parameters:

Name Type Description Default
b int | None

set bitrate (in bits/s) (from 0 to I64_MAX) (default 200000),

None
ab int | None

set bitrate (in bits/s) (from 0 to INT_MAX) (default 128000),

None
bt int | None

Set video bitrate tolerance (in bits/s). In 1-pass mode, bitrate tolerance specifies how far ratecontrol is willing to deviate from the target average bitrate value. This is not related to minimum/maximum bitrate. Lowering tolerance too much has an adverse effect on quality. (from 0 to INT_MAX) (default 4000000),

None
flags str | None

(default 0),

None
export_side_data str | None

Export metadata as side data (default 0),

None
g int | None

set the group of picture (GOP) size (from INT_MIN to INT_MAX) (default 12),

None
ar int | None

set audio sampling rate (in Hz) (from 0 to INT_MAX) (default 0),

None
ac int | None

set number of audio channels (from 0 to INT_MAX) (default 0),

None
cutoff int | None

set cutoff bandwidth (from INT_MIN to INT_MAX) (default 0),

None
frame_size int | None

(from 0 to INT_MAX) (default 0),

None
qcomp float | None

video quantizer scale compression (VBR). Constant of ratecontrol equation. Recommended range for default rc_eq: 0.0-1.0 (from -FLT_MAX to FLT_MAX) (default 0.5),

None
qblur float | None

video quantizer scale blur (VBR) (from -1 to FLT_MAX) (default 0.5),

None
qmin int | None

minimum video quantizer scale (VBR) (from -1 to 69) (default 2),

None
qmax int | None

maximum video quantizer scale (VBR) (from -1 to 1024) (default 31),

None
qdiff int | None

maximum difference between the quantizer scales (VBR) (from INT_MIN to INT_MAX) (default 3),

None
bf int | None

set maximum number of B-frames between non-B-frames (from -1 to INT_MAX) (default 0),

None
b_qfactor float | None

QP factor between P- and B-frames (from -FLT_MAX to FLT_MAX) (default 1.25),

None
strict int | None | Literal['very', 'strict', 'normal', 'unofficial', 'experimental']

how strictly to follow the standards (from INT_MIN to INT_MAX) (default normal),

None
b_qoffset float | None

QP offset between P- and B-frames (from -FLT_MAX to FLT_MAX) (default 1.25),

None
err_detect str | None

set error detection flags (default 0),

None
maxrate int | None

maximum bitrate (in bits/s). Used for VBV together with bufsize. (from 0 to INT_MAX) (default 0),

None
minrate int | None

minimum bitrate (in bits/s). Most useful in setting up a CBR encode. It is of little use otherwise. (from INT_MIN to INT_MAX) (default 0),

None
bufsize int | None

set ratecontrol buffer size (in bits) (from INT_MIN to INT_MAX) (default 0),

None
i_qfactor float | None

QP factor between P- and I-frames (from -FLT_MAX to FLT_MAX) (default -0.8),

None
i_qoffset float | None

QP offset between P- and I-frames (from -FLT_MAX to FLT_MAX) (default 0),

None
dct int | None | Literal['auto', 'fastint', 'int', 'mmx', 'altivec', 'faan']

DCT algorithm (from 0 to INT_MAX) (default auto),

None
lumi_mask float | None

compresses bright areas stronger than medium ones (from -FLT_MAX to FLT_MAX) (default 0),

None
tcplx_mask float | None

temporal complexity masking (from -FLT_MAX to FLT_MAX) (default 0),

None
scplx_mask float | None

spatial complexity masking (from -FLT_MAX to FLT_MAX) (default 0),

None
p_mask float | None

inter masking (from -FLT_MAX to FLT_MAX) (default 0),

None
dark_mask float | None

compresses dark areas stronger than medium ones (from -FLT_MAX to FLT_MAX) (default 0),

None
idct int | None | Literal['auto', 'int', 'simple', 'simplemmx', 'arm', 'altivec', 'simplearm', 'simplearmv5te', 'simplearmv6', 'simpleneon', 'xvid', 'xvidmmx', 'faani', 'simpleauto']

select IDCT implementation (from 0 to INT_MAX) (default auto),

None
aspect str | None

sample aspect ratio (from 0 to 10) (default 0/1),

None
debug str | None

print specific debug info (default 0),

None
dia_size int | None

diamond type & size for motion estimation (from INT_MIN to INT_MAX) (default 0),

None
last_pred int | None

amount of motion predictors from the previous frame (from INT_MIN to INT_MAX) (default 0),

None
pre_dia_size int | None

diamond type & size for motion estimation pre-pass (from INT_MIN to INT_MAX) (default 0),

None
subq int | None

sub-pel motion estimation quality (from INT_MIN to INT_MAX) (default 8),

None
me_range int | None

limit motion vectors range (1023 for DivX player) (from INT_MIN to INT_MAX) (default 0),

None
global_quality int | None

(from INT_MIN to INT_MAX) (default 0),

None
mbd int | None | Literal['simple', 'bits', 'rd']

macroblock decision algorithm (high quality mode) (from 0 to 2) (default simple),

None
rc_init_occupancy int | None

number of bits which should be loaded into the rc buffer before decoding starts (from INT_MIN to INT_MAX) (default 0),

None
threads int | None | Literal['auto']

set the number of threads (from 0 to INT_MAX) (default 1),

None
dc int | None

intra_dc_precision (from -8 to 16) (default 0),

None
nssew int | None

nsse weight (from INT_MIN to INT_MAX) (default 8),

None
profile int | None | Literal['unknown', 'main10']

(from INT_MIN to INT_MAX) (default unknown),

None
level int | None | Literal['unknown']

encoding level, usually corresponding to the profile level, codec-specific (from INT_MIN to INT_MAX) (default unknown),

None
cmp int | None | Literal['sad', 'sse', 'satd', 'dct', 'psnr', 'bit', 'rd', 'zero', 'vsad', 'vsse', 'nsse', 'w53', 'w97', 'dctmax', 'chroma', 'msad']

full-pel ME compare function (from INT_MIN to INT_MAX) (default sad),

None
subcmp int | None | Literal['sad', 'sse', 'satd', 'dct', 'psnr', 'bit', 'rd', 'zero', 'vsad', 'vsse', 'nsse', 'w53', 'w97', 'dctmax', 'chroma', 'msad']

sub-pel ME compare function (from INT_MIN to INT_MAX) (default sad),

None
mbcmp int | None | Literal['sad', 'sse', 'satd', 'dct', 'psnr', 'bit', 'rd', 'zero', 'vsad', 'vsse', 'nsse', 'w53', 'w97', 'dctmax', 'chroma', 'msad']

macroblock compare function (from INT_MIN to INT_MAX) (default sad),

None
ildctcmp int | None | Literal['sad', 'sse', 'satd', 'dct', 'psnr', 'bit', 'rd', 'zero', 'vsad', 'vsse', 'nsse', 'w53', 'w97', 'dctmax', 'chroma', 'msad']

interlaced DCT compare function (from INT_MIN to INT_MAX) (default vsad),

None
precmp int | None | Literal['sad', 'sse', 'satd', 'dct', 'psnr', 'bit', 'rd', 'zero', 'vsad', 'vsse', 'nsse', 'w53', 'w97', 'dctmax', 'chroma', 'msad']

pre motion estimation compare function (from INT_MIN to INT_MAX) (default sad),

None
mblmin int | None

minimum macroblock Lagrange factor (VBR) (from 1 to 32767) (default 236),

None
mblmax int | None

maximum macroblock Lagrange factor (VBR) (from 1 to 32767) (default 3658),

None
bidir_refine int | None

refine the two motion vectors used in bidirectional macroblocks (from 0 to 4) (default 1),

None
keyint_min int | None

minimum interval between IDR-frames (from INT_MIN to INT_MAX) (default 25),

None
refs int | None

reference frames to consider for motion compensation (from INT_MIN to INT_MAX) (default 1),

None
trellis int | None

rate-distortion optimal quantization (from INT_MIN to INT_MAX) (default 0),

None
mv0_threshold int | None

(from 0 to INT_MAX) (default 256),

None
compression_level int | None

(from INT_MIN to INT_MAX) (default -1),

None
ch_layout str | None

,

None
channel_layout str | None

(default 0x0),

None
rc_max_vbv_use float | None

(from 0 to FLT_MAX) (default 0),

None
rc_min_vbv_use float | None

(from 0 to FLT_MAX) (default 3),

None
ticks_per_frame int | None

(from 1 to INT_MAX) (default 1),

None
color_primaries int | None | Literal['bt709', 'unknown', 'bt470m', 'bt470bg', 'smpte170m', 'smpte240m', 'film', 'bt2020', 'smpte428', 'smpte428_1', 'smpte431', 'smpte432', 'jedec-p22', 'ebu3213', 'unspecified']

color primaries (from 1 to INT_MAX) (default unknown),

None
color_trc int | None | Literal['bt709', 'unknown', 'gamma22', 'gamma28', 'smpte170m', 'smpte240m', 'linear', 'log100', 'log316', 'iec61966-2-4', 'bt1361e', 'iec61966-2-1', 'bt2020-10', 'bt2020-12', 'smpte2084', 'smpte428', 'arib-std-b67', 'unspecified', 'log', 'log_sqrt', 'iec61966_2_4', 'bt1361', 'iec61966_2_1', 'bt2020_10bit', 'bt2020_12bit', 'smpte428_1']

color transfer characteristics (from 1 to INT_MAX) (default unknown),

None
colorspace int | None | Literal['rgb', 'bt709', 'unknown', 'fcc', 'bt470bg', 'smpte170m', 'smpte240m', 'ycgco', 'bt2020nc', 'bt2020c', 'smpte2085', 'chroma-derived-nc', 'chroma-derived-c', 'ictcp', 'unspecified', 'ycocg', 'bt2020_ncl', 'bt2020_cl']

color space (from 0 to INT_MAX) (default unknown),

None
color_range int | None | Literal['unknown', 'tv', 'pc', 'unspecified', 'mpeg', 'jpeg', 'limited', 'full']

color range (from 0 to INT_MAX) (default unknown),

None
chroma_sample_location int | None | Literal['unknown', 'left', 'center', 'topleft', 'top', 'bottomleft', 'bottom', 'unspecified']

chroma sample location (from 0 to INT_MAX) (default unknown),

None
slices int | None

set the number of slices, used in parallelized encoding (from 0 to INT_MAX) (default 0),

None
thread_type str | None

select multithreading type (default slice+frame),

None
audio_service_type int | None | Literal['ma', 'ef', 'vi', 'hi', 'di', 'co', 'em', 'vo', 'ka']

audio service type (from 0 to 8) (default ma),

None
field_order int | None | Literal['progressive', 'tt', 'bb', 'tb', 'bt']

Field order (from 0 to 5) (default 0),

None
dump_separator str | None

set information dump field separator,

None
max_pixels int | None

Maximum number of pixels (from 0 to INT_MAX) (default INT_MAX),

None
max_samples int | None

Maximum number of samples (from 0 to INT_MAX) (default INT_MAX),

None

Returns:

Type Description
FFMpegAVCodecContextEncoderOption

FFMpegAVCodecContextEncoderOption

encoder_format_context

encoder_format_context(
    *,
    avioflags: str | None = None,
    packetsize: int | None = None,
    fflags: str | None = None,
    fdebug: str | None = None,
    max_delay: int | None = None,
    start_time_realtime: int | None = None,
    audio_preload: int | None = None,
    chunk_duration: int | None = None,
    chunk_size: int | None = None,
    flush_packets: int | None = None,
    metadata_header_padding: int | None = None,
    output_ts_offset: str | None = None,
    max_interleave_delta: int | None = None,
    f_strict: (
        int
        | None
        | Literal[
            "very",
            "strict",
            "normal",
            "unofficial",
            "experimental",
        ]
    ) = None,
    strict: (
        int
        | None
        | Literal[
            "very",
            "strict",
            "normal",
            "unofficial",
            "experimental",
        ]
    ) = None,
    avoid_negative_ts: (
        int
        | None
        | Literal[
            "auto",
            "disabled",
            "make_non_negative",
            "make_zero",
        ]
    ) = None,
    dump_separator: str | None = None
) -> FFMpegAVFormatContextEncoderOption

Encoder format context options.

Parameters:

Name Type Description Default
avioflags str | None

(default 0),

None
packetsize int | None

set packet size (from 0 to INT_MAX) (default 0),

None
fflags str | None

(default autobsf),

None
fdebug str | None

print specific debug info (default 0),

None
max_delay int | None

maximum muxing or demuxing delay in microseconds (from -1 to INT_MAX) (default -1),

None
start_time_realtime int | None

wall-clock time when stream begins (PTS==0) (from I64_MIN to I64_MAX) (default I64_MIN),

None
audio_preload int | None

microseconds by which audio packets should be interleaved earlier (from 0 to 2.14748e+09) (default 0),

None
chunk_duration int | None

microseconds for each chunk (from 0 to 2.14748e+09) (default 0),

None
chunk_size int | None

size in bytes for each chunk (from 0 to 2.14748e+09) (default 0),

None
flush_packets int | None

enable flushing of the I/O context after each packet (from -1 to 1) (default -1),

None
metadata_header_padding int | None

set number of bytes to be written as padding in a metadata header (from -1 to INT_MAX) (default -1),

None
output_ts_offset str | None

set output timestamp offset (default 0),

None
max_interleave_delta int | None

maximum buffering duration for interleaving (from 0 to I64_MAX) (default 10000000),

None
f_strict int | None | Literal['very', 'strict', 'normal', 'unofficial', 'experimental']

how strictly to follow the standards (deprecated; use strict, save via avconv) (from INT_MIN to INT_MAX) (default normal),

None
strict int | None | Literal['very', 'strict', 'normal', 'unofficial', 'experimental']

how strictly to follow the standards (from INT_MIN to INT_MAX) (default normal),

None
avoid_negative_ts int | None | Literal['auto', 'disabled', 'make_non_negative', 'make_zero']

shift timestamps so they start at 0 (from -1 to 2) (default auto),

None
dump_separator str | None

set information dump field separator (default ", "),

None

Returns:

Type Description
FFMpegAVFormatContextEncoderOption

FFMpegAVFormatContextEncoderOption