Skip to content

runnable

Classes:

Name Description
GlobalRunable

GlobalRunable

Bases: GlobalArgs

Methods:

Name Description
global_args

Set global options.

merge_outputs

Merge multiple output streams into one.

overwrite_output

Overwrite output files without asking (ffmpeg -y option)

compile

Build command-line for invoking ffmpeg.

compile_line

Build command-line for invoking ffmpeg.

run_async

Run ffmpeg asynchronously.

run

Run ffmpeg synchronously.

global_args

global_args(
    *,
    loglevel: Func = None,
    v: Func = None,
    report: Func = None,
    max_alloc: Func = None,
    cpuflags: Func = None,
    cpucount: Func = None,
    hide_banner: Boolean = None,
    y: Boolean = None,
    n: Boolean = None,
    ignore_unknown: Boolean = None,
    copy_unknown: Boolean = None,
    recast_media: Boolean = None,
    benchmark: Boolean = None,
    benchmark_all: Boolean = None,
    progress: Func = None,
    stdin: Boolean = None,
    timelimit: Func = None,
    dump: Boolean = None,
    hex: Boolean = None,
    frame_drop_threshold: Float = None,
    copyts: Boolean = None,
    start_at_zero: Boolean = None,
    copytb: Int = None,
    dts_delta_threshold: Float = None,
    dts_error_threshold: Float = None,
    xerror: Boolean = None,
    abort_on: Func = None,
    filter_threads: Func = None,
    filter_complex: Func = None,
    filter_complex_threads: Int = None,
    lavfi: Func = None,
    filter_complex_script: Func = None,
    auto_conversion_filters: Boolean = None,
    stats: Boolean = None,
    stats_period: Func = None,
    debug_ts: Boolean = None,
    max_error_rate: Float = None,
    vstats: Func = None,
    vstats_file: Func = None,
    vstats_version: Int = None,
    init_hw_device: Func = None,
    filter_hw_device: Func = None,
    adrift_threshold: Func = None,
    qphist: Func = None,
    vsync: Func = None,
    **kwargs: Any
) -> GlobalStream

Set global options.

Parameters:

Name Type Description Default
loglevel Func

set logging level

None
v Func

set logging level

None
report Func

generate a report

None
max_alloc Func

set maximum size of a single allocated block

None
cpuflags Func

force specific cpu flags

None
cpucount Func

force specific cpu count

None
hide_banner Boolean

do not show program banner

None
y Boolean

overwrite output files

None
n Boolean

never overwrite output files

None
ignore_unknown Boolean

Ignore unknown stream types

None
copy_unknown Boolean

Copy unknown stream types

None
recast_media Boolean

allow recasting stream type in order to force a decoder of different media type

None
benchmark Boolean

add timings for benchmarking

None
benchmark_all Boolean

add timings for each task

None
progress Func

write program-readable progress information

None
stdin Boolean

enable or disable interaction on standard input

None
timelimit Func

set max runtime in seconds in CPU user time

None
dump Boolean

dump each input packet

None
hex Boolean

when dumping packets, also dump the payload

None
frame_drop_threshold Float

frame drop threshold

None
copyts Boolean

copy timestamps

None
start_at_zero Boolean

shift input timestamps to start at 0 when using copyts

None
copytb Int

copy input stream time base when stream copying

None
dts_delta_threshold Float

timestamp discontinuity delta threshold

None
dts_error_threshold Float

timestamp error delta threshold

None
xerror Boolean

exit on error

None
abort_on Func

abort on the specified condition flags

None
filter_threads Func

number of non-complex filter threads

None
filter_complex Func

create a complex filtergraph

None
filter_complex_threads Int

number of threads for -filter_complex

None
lavfi Func

create a complex filtergraph

None
filter_complex_script Func

deprecated, use -/filter_complex instead

None
auto_conversion_filters Boolean

enable automatic conversion filters globally

None
stats Boolean

print progress report during encoding

None
stats_period Func

set the period at which ffmpeg updates stats and -progress output

None
debug_ts Boolean

print timestamp debugging info

None
max_error_rate Float

ratio of decoding errors (0.0: no errors, 1.0: 100% errors) above which ffmpeg returns an error instead of success.

None
vstats Func

dump video coding statistics to file

None
vstats_file Func

dump video coding statistics to file

None
vstats_version Int

Version of the vstats format to use.

None
init_hw_device Func

initialise hardware device

None
filter_hw_device Func

set hardware device used when filtering

None
adrift_threshold Func

deprecated, does nothing

None
qphist Func

deprecated, does nothing

None
vsync Func

set video sync method globally; deprecated, use -fps_mode

None
**kwargs Any

Additional options

{}

Returns:

Name Type Description
GlobalStream GlobalStream

GlobalStream instance

merge_outputs

merge_outputs(*streams: OutputStream) -> GlobalStream

Merge multiple output streams into one.

Parameters:

Name Type Description Default
*streams OutputStream

The output streams to merge.

()

Returns:

Type Description
GlobalStream

The merged output stream.

overwrite_output

overwrite_output() -> GlobalStream

Overwrite output files without asking (ffmpeg -y option)

Returns:

Type Description
GlobalStream

the output stream

compile

compile(
    cmd: str | list[str] = "ffmpeg",
    overwrite_output: bool = None,
    auto_fix: bool = True,
) -> list[str]

Build command-line for invoking ffmpeg.

Parameters:

Name Type Description Default
cmd str | list[str]

the command to invoke ffmpeg

'ffmpeg'
overwrite_output bool

whether to overwrite output files without asking

None
auto_fix bool

whether to automatically fix the stream

True

Returns:

Type Description
list[str]

the command-line

compile_line

compile_line(
    cmd: str | list[str] = "ffmpeg",
    overwrite_output: bool = None,
    auto_fix: bool = True,
) -> str

Build command-line for invoking ffmpeg.

Parameters:

Name Type Description Default
cmd str | list[str]

the command to invoke ffmpeg

'ffmpeg'
overwrite_output bool

whether to overwrite output files without asking

None
auto_fix bool

whether to automatically fix the stream

True

Returns:

Type Description
str

the command-line

run_async

run_async(
    cmd: str | list[str] = "ffmpeg",
    pipe_stdin: bool = False,
    pipe_stdout: bool = False,
    pipe_stderr: bool = False,
    quiet: bool = False,
    overwrite_output: bool = None,
    auto_fix: bool = True,
) -> Popen[bytes]

Run ffmpeg asynchronously.

Parameters:

Name Type Description Default
cmd str | list[str]

the command to invoke ffmpeg

'ffmpeg'
pipe_stdin bool

whether to pipe stdin

False
pipe_stdout bool

whether to pipe stdout

False
pipe_stderr bool

whether to pipe stderr

False
quiet bool

whether to pipe stderr to stdout

False
overwrite_output bool

whether to overwrite output files without asking

None
auto_fix bool

whether to automatically fix the stream

True

Returns:

Type Description
Popen[bytes]

the process

run

run(
    cmd: str | list[str] = "ffmpeg",
    capture_stdout: bool = False,
    capture_stderr: bool = False,
    input: bytes | None = None,
    quiet: bool = False,
    overwrite_output: bool = None,
    auto_fix: bool = True,
) -> tuple[bytes, bytes]

Run ffmpeg synchronously.

Parameters:

Name Type Description Default
cmd str | list[str]

the command to invoke ffmpeg

'ffmpeg'
capture_stdout bool

whether to capture stdout

False
capture_stderr bool

whether to capture stderr

False
input bytes | None

the input

None
quiet bool

whether to pipe stderr to stdout

False
overwrite_output bool

whether to overwrite output files without asking

None
auto_fix bool

whether to automatically fix the stream

True

Returns:

Name Type Description
stdout bytes

he stdout

stderr bytes

the stderr