Add Automatic Captions to YouTube Shorts with AI
Project description
Captametropolis
INFO: This is forked from Captacity.
Just like Captacity but BIGGER!
Add automatic captions to YouTube Shorts (and other videos) using Whisper and MoviePy!
Requirements
-
Install FFmpeg (make sure it's in your
PATH
) -
Install ImageMagick. Make sure to tick both boxes during installation:
- Install legacy utilities (e.g. convert)
- Add application directory to your system path
Quick start
After installing the requirements, make sure to enter your terminal in administrator mode and run the following commands:
$ pip install captametropolis -U
$ captametropolis <video_file> <output_file>
INFO: You need to run
Captametropolis
in administrator mode because it has to inject your fonts into the ImageMagick font directory.
Programmatic use
import captametropolis
captametropolis.add_captions(
video_file="my_short.mp4",
output_file="my_short_with_captions.mp4",
)
Custom configuration
import captametropolis
captametropolis.add_captions(
video_file="my_short.mp4",
output_file="my_short_with_captions.mp4",
font_path = "/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,
highlight_color = "red",
line_count=1,
rel_width = 0.8,
)
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 captametropolis.add_captions
:
import captametropolis
captametropolis.add_captions(
video_file="my_short.mp4",
output_file="my_short_with_captions.mp4",
use_local_whisper=False,
)
You can install Captametropolis with pip install captametropolis[local]
to install Whisper locally as well.
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
Hashes for captametropolis-1.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e15b9eb8380b2bf1db760256f98fefbe270f3a58ed0a29c796bfc4426d8b03bd |
|
MD5 | bb832b1513d5f2921f46f3ba8bbcf3a3 |
|
BLAKE2b-256 | bcc293e9a667f47f3a28b78e23db860671b0240592dece8e2b8928378e3f5c23 |