Skip to content

~.ffmpeg

FFmpeg

FFmpegProcess

FFmpegProcess()

FFmpeg encoder process.

Create a new FFmpeg process handler.

start async

start(
    args: list[str], *, stdin: bool
) -> asyncio.subprocess.Process

Start the internal process.

PARAMETER DESCRIPTION
args

The arguments to pass to the FFmpeg process.

TYPE: list[str]

stdin

If STDIN should be pipeable.

TYPE: bool

RETURNS DESCRIPTION
asyncio.subprocess.Process

The internal, active process.

terminate async

terminate() -> None

Kill the internal process.

FFmpegWorker

FFmpegWorker()

Manages a single FFmpeg process when requested.

Create a new worker.

encode async

encode(
    source: AudioSource, connection: VoiceConnection
) -> None

Encode an entire audio source and stream each Opus frame into the output.

PARAMETER DESCRIPTION
source

The audio source to read and encode.

TYPE: AudioSource

connection

The active connection requesting this encoding.

TYPE: VoiceConnection

stop async

stop() -> None

Stop the internal process.

FFmpegPool

FFmpegPool(max_per_core: int, max_global: int)

Manages all FFmpeg workers and deploys them when needed.

Create a FFmpeg process pool.

PARAMETER DESCRIPTION
max_per_core

The maximum amount of processes that can be spawned per logical CPU core.

TYPE: int

max_global

The maximum, hard-cap amount of processes that can be spawned.

TYPE: int

submit async

submit(
    source: AudioSource, connection: VoiceConnection
) -> None

Submit and schedule an audio source to be encoded into Opus and stream output into a buffer.

PARAMETER DESCRIPTION
source

The audio source to read and encode.

TYPE: AudioSource

connection

The active connection requesting this encoding.

TYPE: VoiceConnection

stop async

stop() -> None

Stop future scheduling and terminate every worker process.