Skip to content

Latest commit

 

History

History

python

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

README.md

rust-motion (Python SDK)

High-performance, browser-free, programmatic video rendering engine for Python.
Zero Chromium. Zero Puppeteer. Zero Node.js. 100% Pure Rust Native Speed.

Installation

pip install rust-motion

(Prerequisite: ffmpeg installed on your system PATH)

Quick Start

1. Render a Video in 3 Lines

import rust_motion

rust_motion.render(
    composition="HelloWorld",
    output="video.mp4",
    props={"title": "Hello from Python", "subtitle": "Rendered in 0.3s"},
    width=1920,
    height=1080,
    fps=30.0,
    duration=90,
)

2. Render a Still Frame (Thumbnail / Poster)

import rust_motion

rust_motion.render_still(
    composition="HelloWorld",
    frame=30,
    output="thumbnail.png"
)

3. Dynamic Video Templates with Rhai Scripts

import rust_motion

rust_motion.render_script(
    script_path="templates/shorts.rhai",
    output="shorts.mp4",
    props={
        "headline": "Breaking AI News",
        "caption": "Rendered natively without a browser.",
        "tag": "TECH",
    },
    width=1080,
    height=1920, # Vertical 9:16 Shorts / Reels
    duration=90,
)

4. Object-Oriented Composition API

import rust_motion

comp = rust_motion.Composition("HelloWorld", width=1920, height=1080, duration=180)
comp.render("output.mp4")
comp.render_still(frame=0, output="cover.png")

Performance Comparison (vs Remotion)

Metric Remotion (Node.js + Chromium) Rust Motion Python SDK Advantage
Runtime Dependencies Node.js, Chromium, X11, Mesa Pure Rust Binary + FFmpeg Zero Browser Overhead
Memory Footprint (RSS) 1,800 ~ 2,500 MB 400 ~ 900 MB 4x ~ 6x Less RAM
720p Render Time 11.04 s 0.35 s 31x Faster
1080p Shorts Render Time ~12.0 s 0.39 s (230 FPS) 30x Faster
AWS Lambda 10k Cost $4.60 $0.15 96.8% Cost Savings

License

MIT OR Apache-2.0