Open-Source AI Video Generation Pipeline

Modular AI video pipeline β€” script generation β†’ scene planning β†’ rendering β†’ post-production

Features β€’ Quick Start β€’ Architecture β€’ Contributing β€’ Security


🧠 Overview

LeronX Engine is the open-source core of LeronX Pro β€” an AI-powered video creation platform. This repository contains the video generation pipeline: a modular, extensible system that transforms text prompts into fully rendered videos.

⚠️ Note: This is the engine core, not the full SaaS. Cloud rendering, authentication, billing, and the desktop app are proprietary. See What's Included.

✨ Features

  • Script Generation β€” AI-driven scriptwriting with tone, pacing, and format control
  • Scene Planning β€” Automatic scene breakdown with shot composition
  • Asset Management β€” Intelligent stock footage matching and generation
  • Voice Synthesis β€” Multi-language TTS with emotion control (11 audio languages)
  • Video Rendering β€” FFmpeg-based pipeline with transitions, effects, overlays
  • Subtitle Engine β€” Auto-aligned, styled subtitles (SRT/ASS/VTT)
  • Plugin System β€” Extend any stage of the pipeline
  • GPU Acceleration β€” CUDA + Metal support for rendering

πŸ“¦ What's Included

Module Status Description
leronx.script βœ… Open Source Script generation + storyboard planning
leronx.scenes βœ… Open Source Scene graph, transitions, composition
leronx.voice βœ… Open Source TTS abstraction layer (plugin-based)
leronx.render βœ… Open Source FFmpeg pipeline, hardware accel config
leronx.subtitles βœ… Open Source Generation, styling, timing
leronx.assets βœ… Open Source Stock footage API client (Pexels/Pixabay)
leronx.plugins βœ… Open Source Plugin loader + registry
leronx.cloud πŸ”’ Proprietary Distributed rendering cluster
leronx.auth πŸ”’ Proprietary Firebase auth + phone verification
leronx.billing πŸ”’ Proprietary Stripe + credits system
leronx.desktop πŸ”’ Proprietary Electron/Tauri desktop app

πŸš€ Quick Start

Prerequisites

python >= 3.10
ffmpeg >= 5.0

Installation

git clone https://github.com/leronx/leronx-engine.git
cd leronx-engine
pip install -e ".[dev]"

Basic Usage

from leronx import Pipeline
from leronx.script import ScriptConfig

# Configure the pipeline
config = ScriptConfig(
    topic="The Future of AI in Healthcare",
    duration=60,  # seconds
    tone="professional",
    language="en",
)

# Create and run pipeline
pipeline = Pipeline(config)
video = pipeline.render(output_path="./output/my_video.mp4")

print(f"βœ… Video rendered: {video.path}")
print(f"⏱ Duration: {video.duration}s")
print(f"πŸ“‚ Scenes: {len(video.scenes)}")

Advanced: Custom Pipeline

from leronx import Pipeline, Plugin
from leronx.scenes import SceneGraph
from leronx.render import RenderConfig

class BrandedOverlay(Plugin):
    """Add LeronX watermark to all videos."""

    name = "branded_overlay"
    stage = "post_render"

    def process(self, video, config):
        video.add_overlay(
            image="assets/leronx_logo.png",
            position="bottom-right",
            opacity=0.8,
        )
        return video

# Custom pipeline with plugins
pipeline = Pipeline(
    config=RenderConfig(gpu=True, codec="h265"),
    plugins=[BrandedOverlay()],
)

result = pipeline.render(prompt="Explain quantum computing simply")

πŸ— Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                  Pipeline Orchestrator            β”‚
β”‚                                                   β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚Script│──▢│Scenes  │──▢│Voice  │──▢│Render  β”‚ β”‚
β”‚  β”‚Gen   β”‚   β”‚Planner β”‚   β”‚Synth  β”‚   β”‚Engine  β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚      β”‚           β”‚           β”‚           β”‚       β”‚
β”‚      β–Ό           β–Ό           β–Ό           β–Ό       β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”   └────────┐ β”‚
β”‚  β”‚Topicsβ”‚   β”‚Assets  β”‚   β”‚Subtitleβ”‚  β”‚Post-FX β”‚ β”‚
β”‚  β”‚& Tonesβ”‚  β”‚Match   β”‚   β”‚Engine  β”‚  β”‚& Exportβ”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚                        β”‚
         β–Ό                        β–Ό
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”             β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚ Plugins β”‚             β”‚  Output  β”‚
    β”‚ Registryβ”‚             β”‚  Formats β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜             β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Project Structure

leronx-engine/
β”œβ”€β”€ src/leronx/
β”‚   β”œβ”€β”€ __init__.py          # Pipeline orchestrator
β”‚   β”œβ”€β”€ pipeline.py          # Core pipeline class
β”‚   β”œβ”€β”€ script/
β”‚   β”‚   β”œβ”€β”€ generator.py     # Script generation
β”‚   β”‚   β”œβ”€β”€ config.py        # Script configuration
β”‚   β”‚   └── storyboard.py    # Visual storyboard planning
β”‚   β”œβ”€β”€ scenes/
β”‚   β”‚   β”œβ”€β”€ graph.py         # Scene graph + transitions
β”‚   β”‚   └── composition.py   # Shot composition rules
β”‚   β”œβ”€β”€ voice/
β”‚   β”‚   β”œβ”€β”€ tts_base.py      # TTS abstraction
β”‚   β”‚   β”œβ”€β”€ tts_engines.py   # Provider implementations
β”‚   β”‚   └── emotions.py      # Emotion/prosody control
β”‚   β”œβ”€β”€ render/
β”‚   professionalβ”‚   β”œβ”€β”€ engine.py         # FFmpeg pipeline
οΏ½οΏ½   β”‚   β”œβ”€β”€ config.py        # Hardware accel config
β”‚   β”‚   └── effects.py       # Transitions, overlays
β”‚   β”œβ”€β”€ subtitles/
β”‚   β”‚   β”œβ”€β”€ generator.py     # SRT/ASS/VTT generation
β”‚   β”‚   └── styler.py        # Font, color, positioning
β”‚   β”œβ”€β”€ assets/
β”‚   β”‚   β”œβ”€β”€ matcher.py       # Stock footage matcher
β”‚   β”‚   └── providers.py     # Pexels/Pixabay clients
β”‚   └── plugins/
β”‚       β”œβ”€β”€ base.py          # Plugin interface
β”‚       └── registry.py      # Plugin registry
β”œβ”€β”€ tests/                   # 47 tests (pytest)
β”œβ”€β”€ examples/                # Usage examples
β”œβ”€β”€ docs/                    # Documentation
β”œβ”€β”€ docker/                  # Docker setup
β”œβ”€β”€ pyproject.toml           # Project metadata
β”œβ”€β”€ README.md
β”œβ”€β”€ LICENSE
└── CONTRIBUTING.md

πŸ§ͺ Tests

pytest tests/ -v --cov=leronx
========================= test session starts =========================
platform linux -- Python 3.11.5, pytest-7.4.0
collected 47 items

tests/test_script.py .........                                 [ 19%]
tests/test_pipeline.py ........                                [ 36%]
tests/test_scenes.py ..........                                [ 57%]
tests/test_voice.py .......                                    [ 72%]
tests/test_render.py ...........                               [ 96%]
tests/test_plugins.py ..                                       [100%]

---------- coverage: leronx ----------
Name                           Stmts   Miss  Cover
--------------------------------------------------
leronx/__init__.py                12      0   100%
leronx/pipeline.py                45      2    96%
leronx/script/generator.py        38      0   100%
...
TOTAL                            312      8    97%
========================= 47 passed in 2.13s ==========================

πŸ”Œ Plugin Development

from leronx.plugins import Plugin, PluginMeta

class MyPlugin(Plugin, metaclass=PluginMeta):
    name = "my_plugin"
    stage = "pre_render"  # script | scenes | voice | render | post
    priority = 10         # lower runs first

    def process(self, context):
        # Modify the pipeline context
        context.video.add_filter("vintage")
        return context

    def cleanup(self):
        pass

🐳 Docker

docker-compose up -d
# API available at http://localhost:8000

πŸ“Š Benchmarks

GPU 60s Video 120s Video 300s Video
RTX 4090 45s 90s 4min
RTX 3080 72s 145s 6min
M2 Max 58s 115s 5min
CPU only 8min 16min 40min

πŸ” Security

We take security seriously. See SECURITY.md for responsible disclosure.

🀝 Contributing

PRs welcome! See CONTRIBUTING.md.

πŸ“„ License

MIT β€” see LICENSE.


Built with ❀️ by the LeronX team

⬆ Back to top