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.0.tar.gz
(150.6 kB
view hashes)
Built Distribution
captacity-0.3.0-py3-none-any.whl
(150.0 kB
view hashes)
Close
Hashes for captacity-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a249c8f009980621098535edb03d36b33696d851e732d75948daeedec2d4fd5 |
|
MD5 | e77f0daae88f5da65a6030bc3d294ecc |
|
BLAKE2b-256 | 4f30199d449a2330a9f87c7be1ea474be6c0c5dd80b06695cb94faf10e28832c |