Skip to content

schema

Schema definitions for FFmpeg options.

Classes:

Name Description
FFMpegOption

Represents a command-line option for FFmpeg.

FFMpegOptionFlag

FFmpeg option flags that define option behavior and characteristics.

FFMpegOptionType

Enumeration of FFmpeg option data types.

FFMpegOption dataclass

FFMpegOption(
    *,
    name: str,
    type: FFMpegOptionType,
    flags: int,
    help: str,
    argname: str | None = None,
    canon: str | None = None
)

Represents a command-line option for FFmpeg.

This class defines the metadata for a single option that can be passed to the FFmpeg command line, including its type, help text, and flags that determine its behavior.

Attributes:

Name Type Description
argname str | None

Optional name for the option's argument in help text

canon str | None

For alternative option forms, the name of the canonical option

flags int

Bitmap of FFMpegOptionFlag values that define the option's behavior

help str

Human-readable description of what the option does

is_global_option bool

Check if this option applies globally rather than to specific files.

is_input_option bool

Check if this option applies to input files.

is_output_option bool

Check if this option applies to output files.

is_support_stream_specifier bool

Check if this option supports stream specifiers.

name str

The name of the option as used in FFmpeg commands

type FFMpegOptionType

The data type of the option (boolean, int, string, etc.)

argname class-attribute instance-attribute

argname: str | None = None

Optional name for the option's argument in help text

canon class-attribute instance-attribute

canon: str | None = None

For alternative option forms, the name of the canonical option

flags instance-attribute

flags: int

Bitmap of FFMpegOptionFlag values that define the option's behavior

help instance-attribute

help: str

Human-readable description of what the option does

is_global_option property

is_global_option: bool

Check if this option applies globally rather than to specific files.

Returns:

Type Description
bool

True if this option is a global option that doesn't apply to

bool

specific input or output files

is_input_option property

is_input_option: bool

Check if this option applies to input files.

Returns:

Type Description
bool

True if this option is meant to be used with input files

is_output_option property

is_output_option: bool

Check if this option applies to output files.

Returns:

Type Description
bool

True if this option is meant to be used with output files

is_support_stream_specifier property

is_support_stream_specifier: bool

Check if this option supports stream specifiers.

Stream specifiers allow options to be applied to specific streams within a file, using syntax like "-c:v" for video codec.

Returns:

Type Description
bool

True if this option can be used with stream specifiers

name instance-attribute

name: str

The name of the option as used in FFmpeg commands

type instance-attribute

The data type of the option (boolean, int, string, etc.)

FFMpegOptionFlag

Bases: int, Enum

FFmpeg option flags that define option behavior and characteristics.

Attributes:

Name Type Description
OPT_EXIT

Program will immediately exit after processing this option

OPT_EXPERT

Option is intended for advanced users. Only affects help output.

OPT_FLAG_OFFSET

Option is specified as an offset in a passed optctx.

OPT_FLAG_PERSTREAM

Option applies per-stream (implies OPT_SPEC).

OPT_FLAG_SPEC

Option is to be stored in a SpecifierOptList.

OPT_FUNC_ARG

The OPT_TYPE_FUNC option takes an argument.

OPT_HAS_ALT

This option is a "canonical" form, to which one or more alternatives exist. These alternatives are listed in u1.names_alt.

OPT_HAS_CANON

This option is an alternative form of some other option, whose name is stored in u1.name_canon

OPT_INPUT

ffmpeg-only - specifies whether an OPT_PERFILE option applies to input, output, or both.

OPT_OFFSET

Option is to be stored in a SpecifierOptList.

OPT_OUTPUT

ffmpeg-only - specifies whether an OPT_PERFILE option applies to input, output, or both.

OPT_PERFILE

The option is per-file (currently ffmpeg-only). At least one of OPT_INPUT or OPT_OUTPUT must be set when this flag is in use.

OPT_SPEC

Option applies per-stream (implies OPT_SPEC).

OPT_EXIT class-attribute instance-attribute

OPT_EXIT = 1 << 1

Program will immediately exit after processing this option

OPT_EXPERT class-attribute instance-attribute

OPT_EXPERT = 1 << 2

Option is intended for advanced users. Only affects help output.

OPT_FLAG_OFFSET class-attribute instance-attribute

OPT_FLAG_OFFSET = 1 << 8

Option is specified as an offset in a passed optctx. Always use as OPT_OFFSET in option definitions.

OPT_FLAG_PERSTREAM class-attribute instance-attribute

OPT_FLAG_PERSTREAM = 1 << 10

Option applies per-stream (implies OPT_SPEC).

OPT_FLAG_SPEC class-attribute instance-attribute

OPT_FLAG_SPEC = 1 << 9

Option is to be stored in a SpecifierOptList. Always use as OPT_SPEC in option definitions.

OPT_FUNC_ARG class-attribute instance-attribute

OPT_FUNC_ARG = 1 << 0

The OPT_TYPE_FUNC option takes an argument. Must not be used with other option types, as for those it holds: - OPT_TYPE_BOOL do not take an argument - all other types do

OPT_HAS_ALT class-attribute instance-attribute

OPT_HAS_ALT = 1 << 13

This option is a "canonical" form, to which one or more alternatives exist. These alternatives are listed in u1.names_alt.

OPT_HAS_CANON class-attribute instance-attribute

OPT_HAS_CANON = 1 << 14

This option is an alternative form of some other option, whose name is stored in u1.name_canon

OPT_INPUT class-attribute instance-attribute

OPT_INPUT = 1 << 11

ffmpeg-only - specifies whether an OPT_PERFILE option applies to input, output, or both.

OPT_OFFSET class-attribute instance-attribute

Option is to be stored in a SpecifierOptList. Always use as OPT_SPEC in option definitions.

OPT_OUTPUT class-attribute instance-attribute

OPT_OUTPUT = 1 << 12

ffmpeg-only - specifies whether an OPT_PERFILE option applies to input, output, or both.

OPT_PERFILE class-attribute instance-attribute

OPT_PERFILE = 1 << 7

The option is per-file (currently ffmpeg-only). At least one of OPT_INPUT or OPT_OUTPUT must be set when this flag is in use.

OPT_SPEC class-attribute instance-attribute

Option applies per-stream (implies OPT_SPEC).

FFMpegOptionType

Bases: str, Enum

Enumeration of FFmpeg option data types.

This enum defines the various data types that can be used for FFmpeg command-line options. These types correspond to the internal option types defined in FFmpeg's libavutil/opt.h header.

Attributes:

Name Type Description
OPT_TYPE_BOOL

Boolean option type (true/false)

OPT_TYPE_DOUBLE

Double-precision floating-point option type

OPT_TYPE_FLOAT

Floating-point option type

OPT_TYPE_FUNC

Function option type, typically used for callback functions

OPT_TYPE_INT

Integer option type

OPT_TYPE_INT64

64-bit integer option type

OPT_TYPE_STRING

String option type

OPT_TYPE_TIME

Time value option type (e.g., duration in seconds)

OPT_TYPE_BOOL class-attribute instance-attribute

OPT_TYPE_BOOL = 'OPT_TYPE_BOOL'

Boolean option type (true/false)

OPT_TYPE_DOUBLE class-attribute instance-attribute

OPT_TYPE_DOUBLE = 'OPT_TYPE_DOUBLE'

Double-precision floating-point option type

OPT_TYPE_FLOAT class-attribute instance-attribute

OPT_TYPE_FLOAT = 'OPT_TYPE_FLOAT'

Floating-point option type

OPT_TYPE_FUNC class-attribute instance-attribute

OPT_TYPE_FUNC = 'OPT_TYPE_FUNC'

Function option type, typically used for callback functions

OPT_TYPE_INT class-attribute instance-attribute

OPT_TYPE_INT = 'OPT_TYPE_INT'

Integer option type

OPT_TYPE_INT64 class-attribute instance-attribute

OPT_TYPE_INT64 = 'OPT_TYPE_INT64'

64-bit integer option type

OPT_TYPE_STRING class-attribute instance-attribute

OPT_TYPE_STRING = 'OPT_TYPE_STRING'

String option type

OPT_TYPE_TIME class-attribute instance-attribute

OPT_TYPE_TIME = 'OPT_TYPE_TIME'

Time value option type (e.g., duration in seconds)