Skip to main content

A fast and elegant Python library for adding beautiful captions to videos

Project description

Beautiful Captions 🎬

A fast and elegant Python library for adding beautiful captions to videos. Combines the speed of FFmpeg with the beauty of custom styling.

Features

  • ⚡ Lightning-fast caption rendering
  • 🎨 Beautiful default styling with customization options
  • 💃 Engaging bounce animation for captions
  • 🤖 Built-in support for AssemblyAI
  • 📝 Support for SRT files
  • 🛠️ Simple, intuitive API

Installation

pip install beautiful-captions

Quick Start

Beautiful Captions provides two API styles to suit your needs:

Functional API

from beautiful_captions import add_captions, transcribe, process_video

# Using an existing SRT file
subtitles_from_srt("input.mp4", "subtitles.srt", style="default")

# Transcribe and caption
transcribe("video.mp4", service="assemblyai", api_key="YOUR_KEY")
subtitles_from_srt("video.mp4", "generated.srt", style="default")

# All-in-one process
add_subtitles("input.mp4", 
    transcribe_with="assemblyai",
    api_key="YOUR_KEY",
    style="default"
)

Object-Oriented API

from beautiful_captions import Video

# Using an existing SRT file
video = Video("input.mp4")
video.subtitles_from_srt("subtitles.srt", style="default")
video.save("output.mp4")

# Transcribe and caption
video = Video("input.mp4")
video.transcribe(service="assemblyai", api_key="YOUR_KEY")
video.subtitles_from_srt(style="default", animation="bounce")
video.save("output.mp4")

Styling Options

Customize your captions with these options:

from beautiful_captions import Style

style = Style(
    font="Arial",          # Font family
    color="white",         # Text color
    outline_color="black", # Outline color
    outline_width=2,       # Outline thickness
    position="bottom",     # Vertical position
    animation="bounce"     # Animation type
)

add_captions("input.mp4", "subtitles.srt", style=style)

Transcription Services

Beautiful Captions supports multiple transcription services out of the box:

# Using AssemblyAI
video.transcribe(service="assemblyai", api_key="YOUR_ASSEMBLYAI_KEY")

Performance

Beautiful Captions is optimized for speed while maintaining high-quality output. Here's how it compares to MoviePy:

Operation Beautiful Captions MoviePy
Caption Rendering [Benchmark] [Benchmark]
Memory Usage [Benchmark] [Benchmark]

Benchmarks coming soon

Contributing

We welcome contributions of all sizes! Beautiful Captions is designed to be modular and easy to extend. Here are some ways you can contribute:

Areas for Contribution

  1. Transcription Services: Add support for new transcription services by implementing the transcription interface
  2. Caption Styles: Create new preset styles that others can use
  3. Animations: Develop new caption animation types
  4. Performance Improvements: Help optimize the caption rendering pipeline
  5. Documentation: Improve docs, add examples, or fix typos
  6. Bug Reports: Submit detailed bug reports and feature requests

Getting Started

  1. Check our Contributing Guide for detailed instructions
  2. Look for issues labeled good-first-issue or help-wanted
  3. Join discussions in GitHub Discussions to share ideas
  4. Read our Code of Conduct

See CONTRIBUTING.md for full details on our development process.

Development Setup

  1. Clone the repository:
git clone https://github.com/aayushgupta16/beautiful-captions.git
cd beautiful-captions
  1. Create a virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install development dependencies:
pip install -e ".[dev]"

Future Features

Vote on upcoming features in our GitHub Discussions:

  • Additional preset styles (TikTok-style, Hormozi-style, etc.)
  • Support for VTT format
  • More animation types
  • Additional transcription services

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

Project details


Download files

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

Source Distribution

beautiful_captions-0.1.33.tar.gz (569.7 kB view details)

Uploaded Source

Built Distribution

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

beautiful_captions-0.1.33-py3-none-any.whl (594.6 kB view details)

Uploaded Python 3

File details

Details for the file beautiful_captions-0.1.33.tar.gz.

File metadata

  • Download URL: beautiful_captions-0.1.33.tar.gz
  • Upload date:
  • Size: 569.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.5

File hashes

Hashes for beautiful_captions-0.1.33.tar.gz
Algorithm Hash digest
SHA256 a9b98d8cb80922a130426717b32e67e74f06b71112d8d47cd26b07a721861b70
MD5 a6047e03229d586c4a87a0b2e56d82c1
BLAKE2b-256 180cf6ef3c948350c73deaab3af316147b7750c6b7c5aab7717e1746ee345afa

See more details on using hashes here.

File details

Details for the file beautiful_captions-0.1.33-py3-none-any.whl.

File metadata

File hashes

Hashes for beautiful_captions-0.1.33-py3-none-any.whl
Algorithm Hash digest
SHA256 b0c3788d695b6376dde66addfc532c3e70d65afdc830de241bdbba8d449a6f05
MD5 63c88f45ed99d7481a19a4ba3190a6ba
BLAKE2b-256 bde33efd363d44abeda2fdbe9dcda05ccde69a98f2f49c82e8d9da6103a43588

See more details on using hashes here.

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