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
add_captions("input.mp4", "subtitles.srt", style="default")
# Transcribe and caption
transcribe("video.mp4", service="assemblyai", api_key="YOUR_KEY")
add_captions("video.mp4", "generated.srt", style="default")
# All-in-one process
process_video("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.add_captions("subtitles.srt", style="default")
video.save("output.mp4")
# Transcribe and caption
video = Video("input.mp4")
video.transcribe(service="assemblyai", api_key="YOUR_KEY")
video.add_captions(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
- Transcription Services: Add support for new transcription services by implementing the transcription interface
- Caption Styles: Create new preset styles that others can use
- Animations: Develop new caption animation types
- Performance Improvements: Help optimize the caption rendering pipeline
- Documentation: Improve docs, add examples, or fix typos
- Bug Reports: Submit detailed bug reports and feature requests
Getting Started
- Check our Contributing Guide for detailed instructions
- Look for issues labeled
good-first-issueorhelp-wanted - Join discussions in GitHub Discussions to share ideas
- Read our Code of Conduct
See CONTRIBUTING.md for full details on our development process.
Development Setup
- Clone the repository:
git clone https://github.com/aayushgupta16/beautiful-captions.git
cd beautiful-captions
- Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- 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
- 📫 For bug reports and feature requests, use GitHub Issues
- 💬 For questions and discussions, join our GitHub Discussions
- 🗳️ Vote on new features in our Ideas section
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file beautiful_captions-0.1.17.tar.gz.
File metadata
- Download URL: beautiful_captions-0.1.17.tar.gz
- Upload date:
- Size: 569.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
782e0f8ad8012f65b36590133243e4b1884a84447d1fdfdd68552b0fe7218d27
|
|
| MD5 |
93753bc5e009e2aedddcb3b115bfe2f3
|
|
| BLAKE2b-256 |
e1bec987526eababed6da89ffbb9940b06ad78b16e2d07c98e5a0e2edbdda248
|
File details
Details for the file beautiful_captions-0.1.17-py3-none-any.whl.
File metadata
- Download URL: beautiful_captions-0.1.17-py3-none-any.whl
- Upload date:
- Size: 594.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd9f79eb4ec09c7f67a56bc14c57c83ab08a5a92dc107a76cecb4b1ea7b8a2f5
|
|
| MD5 |
f47e703c5ae42f9d7841839b3bcb2003
|
|
| BLAKE2b-256 |
f5d0b09f1dc403ba96f85a52f03802430a9c72cdcc1c1e0289176ec30f370cab
|