Skip to main content

Minimal video generation and processing library.

Project description

videopython

Minimal Python library for video editing, processing, and AI video workflows. Built primarily for practical editing workflows, with optional AI capabilities layered on top. Open-source and local-first: all AI workflows run on your hardware.

Full documentation lives at videopython.com (guides, examples, and complete API reference).
Use this README for quick setup and a feature overview.

Installation

1. Install FFmpeg

# macOS
brew install ffmpeg

# Ubuntu / Debian
sudo apt-get install ffmpeg

# Windows (Chocolatey)
choco install ffmpeg

2. Install videopython

# Core video/audio features only
pip install videopython
# or
uv add videopython

# Include AI features
pip install "videopython[ai]"
# or
uv add videopython --extra ai

Python support: >=3.10, <3.13.

Quick Start

Video editing

from videopython import Video
from videopython.base import FadeTransition

intro = Video.from_path("intro.mp4").resize(1080, 1920)
clip = Video.from_path("raw.mp4").cut(10, 25).resize(1080, 1920).resample_fps(30)
final = intro.transition_to(clip, FadeTransition(effect_time_seconds=0.5))
final = final.add_audio_from_file("music.mp3")
final.save("output.mp4")

JSON editing plans (VideoEdit)

from videopython.base import VideoEdit

plan = {
    "segments": [
        {
            "source": "raw.mp4",
            "start": 10.0,
            "end": 20.0,
            "transforms": [{"op": "resize", "args": {"height": 1280}}, {"op": "speed_change", "args": {"speed": 1.25}}],
        }
    ],
    "post_effects": [
        {"op": "blur_effect", "args": {"mode": "constant", "iterations": 1}, "apply": {"start": 0.0, "stop": 1.0}}
    ],
}

edit = VideoEdit.from_dict(plan)
edit.validate()  # dry run via VideoMetadata (no frame loading)
final = edit.run()
final.save("output.mp4")

Use post_transforms for transforms and post_effects for effects. VideoEdit.json_schema() returns a parser-aligned JSON Schema for plan generation/validation.

AI generation

from videopython.ai import TextToImage, ImageToVideo, TextToSpeech

image = TextToImage().generate_image("A cinematic mountain sunrise")
video = ImageToVideo().generate_video(image=image, fps=24).resize(1080, 1920)
audio = TextToSpeech().generate_audio("Welcome to videopython.")
video.add_audio(audio).save("ai_video.mp4")

Functionality Overview

videopython.base (no AI dependencies)

  • Video I/O and metadata: Video, VideoMetadata, FrameIterator
  • Editing plans: VideoEdit, SegmentConfig (JSON/LLM-friendly multi-segment plans with schema generation)
  • Transformations: cut by time/frame, resize, crop, FPS resampling, speed change, picture-in-picture
  • Clip composition: concatenate, split, transitions (FadeTransition, BlurTransition, InstantTransition)
  • Visual effects: blur, zoom, color grading, vignette, Ken Burns, image overlays
  • Audio pipeline: load/save audio, overlay/concat, normalize, time-stretch, silence detection, segment classification
  • Text/subtitles: transcription data classes and TranscriptionOverlay
  • Scene detection: histogram-based scene boundaries (detect, detect_streaming, detect_parallel)

Docs:

videopython.ai (install with [ai])

  • Generation: TextToVideo, ImageToVideo, TextToImage, TextToSpeech, TextToMusic
  • Understanding:
    • Transcription and captioning: AudioToText, ImageToText
    • Detection/classification: ObjectDetector, FaceDetector, TextDetector
    • Motion/action/scene understanding: CameraMotionDetector, MotionAnalyzer, ActionRecognizer, SemanticSceneDetector
  • AI transforms: FaceTracker, FaceTrackingCrop, SplitScreenComposite
  • Dubbing/revoicing: videopython.ai.dubbing.VideoDubber
  • Object swapping/inpainting: ObjectSwapper

Docs:

Local AI Runtime Notes

  • videopython.ai is local-only and does not require cloud API keys.
  • Several AI features download model weights on first run and can require substantial GPU resources.
  • Device/model details by class are documented at videopython.com.

Examples

Development

See DEVELOPMENT.md for local setup, testing, and contribution workflow.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

videopython-0.20.3.tar.gz (123.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

videopython-0.20.3-py3-none-any.whl (145.2 kB view details)

Uploaded Python 3

File details

Details for the file videopython-0.20.3.tar.gz.

File metadata

  • Download URL: videopython-0.20.3.tar.gz
  • Upload date:
  • Size: 123.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for videopython-0.20.3.tar.gz
Algorithm Hash digest
SHA256 84d66d1addf2f1d8acae0711ef63e3303abfd766bd0efe6b4d251915243a5187
MD5 977a505b85ed11e12ea0b359b0263607
BLAKE2b-256 30125711ccb02f407abb586bf42be7ad408db16171d62289bab2000b64d44ddd

See more details on using hashes here.

Provenance

The following attestation bundles were made for videopython-0.20.3.tar.gz:

Publisher: publish.yml on BartWojtowicz/videopython

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file videopython-0.20.3-py3-none-any.whl.

File metadata

  • Download URL: videopython-0.20.3-py3-none-any.whl
  • Upload date:
  • Size: 145.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for videopython-0.20.3-py3-none-any.whl
Algorithm Hash digest
SHA256 23cbc2f87fd42155104793550a56d013d545735c376cb4dd8fa2c1e41fc04560
MD5 15aa181b8b2c64d83b1f77718ac8bdb8
BLAKE2b-256 e0e3cd8897264ab6a4629bd2a7f6367280174afacbebd294ff385fa1084c1b33

See more details on using hashes here.

Provenance

The following attestation bundles were made for videopython-0.20.3-py3-none-any.whl:

Publisher: publish.yml on BartWojtowicz/videopython

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page