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.1.tar.gz (151.3 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.1-py3-none-any.whl (151.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: captacity_clipify-0.3.1.tar.gz
  • Upload date:
  • Size: 151.3 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.1.tar.gz
Algorithm Hash digest
SHA256 1a77d0974cfb74783bf8c7a3240d606ca5dd874a4087482bedc65adbe7f0d120
MD5 ecf4a718a7ae9e0fec2c7e0a3e8e44a9
BLAKE2b-256 aa56eb9a0e910d12f8d72429e45692191b3bda850d8173cca8df6d91a0f70c8b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for captacity_clipify-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4a75fe529f22f9beedb3552823df95bfda49740d7f04c6dcc2c88fc9e86c36a0
MD5 cd8fff5f8420e43401a50054757246d2
BLAKE2b-256 d847386b6e0928dbdbe258c23b214e21012be68053e41e4ab845c2dcee193463

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