Add Automatic Captions to YouTube Shorts with AI
Project description
Captacity
Add automatic captions to YouTube Shorts (and other videos) using Whisper and MoviePy
Quick start
$ pip install captacity
$ captacity <video_file> <output_file>
Programmatic use
import captacity
captacity.add_captions(
video_file="my_short.mp4",
output_file="my_short_with_captions.mp4",
)
Custom configuration
import captacity
captacity.add_captions(
video_file="my_short.mp4",
output_file="my_short_with_captions.mp4",
font = "/path/to/your/font.ttf",
font_size = 130,
font_color = "yellow",
stroke_width = 3,
stroke_color = "black",
shadow_strength = 1.0,
shadow_blur = 0.1,
highlight_current_word = True,
word_highlight_color = "red",
line_count=1,
padding = 50,
)
Using Whisper locally
By default, OpenAI Whisper is used locally if the openai-whisper
package is installed. Otherwise, the OpenAI Whisper API is used. If you want to force the use of the API, you can specify use_local_whisper=False
in the arguments to captacity.add_captions
:
import captacity
captacity.add_captions(
video_file="my_short.mp4",
output_file="my_short_with_captions.mp4",
use_local_whisper=False,
)
You can install Captacity with pip install captacity[local_whisper]
to install Whisper locally as well.
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
captacity-0.3.1.tar.gz
(151.0 kB
view details)
Built Distribution
captacity-0.3.1-py3-none-any.whl
(150.4 kB
view details)
File details
Details for the file captacity-0.3.1.tar.gz
.
File metadata
- Download URL: captacity-0.3.1.tar.gz
- Upload date:
- Size: 151.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 622995a17245049312aad80e343c637d382216f068093623bc3b4858144159c5 |
|
MD5 | 573dc747e10ba9e474d379abe3257236 |
|
BLAKE2b-256 | 851fe5c7b2f5af5f61ab9a33943ef6e62243a9b148b8fed3700eec1306eb2064 |
File details
Details for the file captacity-0.3.1-py3-none-any.whl
.
File metadata
- Download URL: captacity-0.3.1-py3-none-any.whl
- Upload date:
- Size: 150.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f4c277cccd4c80efbb9387da9ecf57c152894a186831b665c8bace8bdb61fa2 |
|
MD5 | 0fbb3c8e25bc0220c5f4cb1c7a6e974a |
|
BLAKE2b-256 | 48fa3c641fc3175312245fa162f1fb35c5622a2b9fbd58daef1f2b8e9e1b7f9a |