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.0.tar.gz (119.9 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.0-py3-none-any.whl (141.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: videopython-0.20.0.tar.gz
  • Upload date:
  • Size: 119.9 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.0.tar.gz
Algorithm Hash digest
SHA256 617449ceac1c8896fe9e6a581d3f4c1ee0f9f82e8ed6a1e12b463e5b20468cef
MD5 afec46619e762832db582269f170e823
BLAKE2b-256 b61aad02d8c5d74f7dc0166d6d29ce1d0a877349da26638f2dbc89f65409a051

See more details on using hashes here.

Provenance

The following attestation bundles were made for videopython-0.20.0.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.0-py3-none-any.whl.

File metadata

  • Download URL: videopython-0.20.0-py3-none-any.whl
  • Upload date:
  • Size: 141.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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1ea256625620477f0b1591079d9755e42a24e37f28a445f89ab7c82a3bb3400d
MD5 35dfb0b3a23a9bf5b43f265aecaa14bd
BLAKE2b-256 c3848d8ee496978f7124b8c64229da57c69ca4ab6977f2fb4a79efb0b2229759

See more details on using hashes here.

Provenance

The following attestation bundles were made for videopython-0.20.0-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