Skip to main content

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_clipify-0.3.4.tar.gz (151.4 kB view details)

Uploaded Source

Built Distribution

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

captacity_clipify-0.3.4-py3-none-any.whl (151.2 kB view details)

Uploaded Python 3

File details

Details for the file captacity_clipify-0.3.4.tar.gz.

File metadata

  • Download URL: captacity_clipify-0.3.4.tar.gz
  • Upload date:
  • Size: 151.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.0

File hashes

Hashes for captacity_clipify-0.3.4.tar.gz
Algorithm Hash digest
SHA256 ba66648046f32342674d4e59361b9b5ea7a6b7b45df67d97f757bb6e862f5cc8
MD5 4d613e53689b8cf370123b0cfd305950
BLAKE2b-256 d598074109be12cd5e41088d19bb64716ec94abdf1fae541473fe5ff00d3c319

See more details on using hashes here.

File details

Details for the file captacity_clipify-0.3.4-py3-none-any.whl.

File metadata

File hashes

Hashes for captacity_clipify-0.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 1e5fe64e45abca3d64ad9e2c2951d4bde3437d0eb1532671e3b4d3bbd6eebb0d
MD5 56f0f0a6a6283e8c3901825e33e5ab97
BLAKE2b-256 c3f97b91f12a121336cae7ef63620d9ba596deb419da67b8631128c9db2b3883

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