encoder

class janim.render.encoder.PyavVideoEncoder

Bases: object

Encode videos using PyAV

Hardware acceleration detection is not considered

CODEC_CONFIGS = {'.gif': {'codec': 'gif', 'options': {}, 'pix_fmt': 'rgb8'}, '.mov': {'codec': 'qtrle', 'options': {}, 'pix_fmt': 'argb'}, '.mp4': {'codec': 'libx264', 'options': {}, 'pix_fmt': 'yuv420p'}, '.webm': {'codec': 'libvpx-vp9', 'options': {'-auto-alt-ref': '1'}, 'pix_fmt': 'yuva420p'}}
open(file_path: str, pw: int, ph: int, fps: int) None
write(data: bytes) None
frame_thread_fn() None
encode_thread_fn() None
finish() None
class janim.render.encoder.FFmpegH264VideoEncoder

Bases: object

Encode H.264 (.mp4) videos using the FFmpeg binary

Hardware acceleration detection is considered

open(file_path: str, pw: int, ph: int, fps: int) None
write(data: bytes) None
finish() None
static format_flags() list[str]
static find_encoder() str

Find an encoder, preferring hardware encoders

static test_encoder_usability(potential: str) bool
static encoder_flags(encoder: str) list[str]
static find_encoder_device() str | None

Return the first available VA-API render node, or None if unavailable

static handle_ffmpeg_not_found()
class janim.render.encoder.PyavAudioEncoder

Bases: object

Encode audio using PyAV

open(file_path: str, framerate: int, channels: int) None
write(array: ndarray) None
finish() None