Skip to content

About

Modular, object-oriented FFmpeg command builder for Python with plugin presets

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎬 Encode Kit 🖼️

A modern, modular, and extensible FFmpeg command builder written in Python.

Encode Kit is designed to make building complex FFmpeg commands simple through a clean object-oriented architecture.

Instead of writing long command strings manually, you describe an encoding job and Encode Kit generates the command for you.


Features

  • 🎬 Object-oriented FFmpeg command builder
  • 🧩 Plugin-based preset system
  • 📦 Modular architecture
  • 🚀 Easily extend with custom codecs
  • 🎵 Audio, Video and Subtitle support
  • 📺 HLS ready
  • ⚡ Clean Python API
  • 🛠 Built for automation and backend services

Architecture

EncodeJob
     │
     ▼
FFmpegEngine
     │
     ▼
CommandBuilder
     │
     ▼
Preset
     │
     ▼
FFmpeg Command

Installation

git clone https://github.com/muerfox/Encode-Kit.git
cd Encode-Kit

Quick Example

from Encode-Kit import FFmpegEngine
from Encode-Kit.models import EncodeJob

job = EncodeJob(
    video="movie.mp4",
    output="movie_out.mp4",
    preset="h264",
    crf=22,
    video_preset="slow",
)

command = FFmpegEngine.build(job)

print(command)

Output

ffmpeg \
-i movie.mp4 \
-c:v libx264 \
-crf 22 \
-preset slow \
movie_out.mp4

Presets

Encode Kit uses a plugin architecture.

Creating a new preset only requires inheriting from Preset.

from .base import Preset


class H264Preset(Preset):
    name = "h264"

    def apply(self, builder):
        builder.add(
            "ffmpeg",
            "-i",
            builder.job.video,
            "-c:v", "libx264",
            "-crf", str(builder.job.crf),
            "-preset", builder.job.video_preset,
            builder.job.output
        )

Done.


Project Structure

foxencode/

├── core/
│   ├── command_builder.py
│   └── ...
│
├── presets/
│   ├── base.py
│   ├── h264.py
│   ├── hevc.py
│   └── ...
│
├── models/
│   └── job.py
│
├── registry.py
│
└── engine.py

Design Goals

Encode Kit follows several software engineering principles:

  • Single Responsibility Principle
  • Open/Closed Principle
  • Dependency Inversion
  • Composition over Inheritance
  • Extensible Plugin Architecture

Roadmap

  • Stream Mapping API
  • Audio Pipeline
  • Subtitle Pipeline
  • HLS Builder
  • Hardware Encoder Support
  • Thumbnail Generator
  • Metadata Builder
  • Validation Layer
  • Progress Parser

Example

Instead of writing

ffmpeg -i input.mp4 \
-c:v libx264 \
-preset slow \
-crf 20 \
-c:a aac \
-b:a 192k \
output.mp4

You simply write

job = EncodeJob(...)

cmd = FFmpegEngine.build(job)

Why Encode Kit?

  • No giant string concatenation
  • No unreadable command generation
  • Highly testable
  • Easily extensible
  • Backend friendly
  • Production ready architecture

Made with ❤️ using Python & FFmpeg.

About

Modular, object-oriented FFmpeg command builder for Python with plugin presets

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages