Skip to content

videopython

A minimal Python library for video generation and editing, built for short-form content and AI workflows.

Quick Example

import asyncio
from videopython.base import Video, Resize, FadeTransition
from videopython.ai import TextToImage, ImageToVideo, TextToSpeech

async def create_video():
    # Generate an image and animate it
    image = await TextToImage(backend="openai").generate_image(
        "A cozy coffee shop on a rainy evening, warm lighting"
    )
    video = await ImageToVideo().generate_video(image=image, fps=24)
    video = Resize(width=1080, height=1920).apply(video)  # Vertical format

    # Add narration
    audio = await TextToSpeech(backend="openai").generate_audio(
        "Sometimes the best ideas come with a cup of coffee and the sound of rain."
    )
    video.add_audio(audio)
    video.save("coffee_shop.mp4")

asyncio.run(create_video())

What You Can Do

  • Edit videos - Cut, resize, crop, resample FPS, combine clips
  • Add transitions - Fade, blur, or instant transitions between segments
  • Generate content - Create images, videos, speech, and music from text prompts
  • Transcribe and subtitle - Auto-generate word-level subtitles from speech
  • Analyze video - Detect objects, faces, text, scenes, and camera motion

Installation

pip install "videopython[ai]"

See the Installation Guide for FFmpeg setup and configuration.