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.3.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.3-py3-none-any.whl (151.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: captacity_clipify-0.3.3.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.3.tar.gz
Algorithm Hash digest
SHA256 1bb355cdec48d703a44544921999cdf23b67ff15e231cf46d5dbb9b471c429d1
MD5 c5f9035867d6695a179b6db50a9e44eb
BLAKE2b-256 e2563a162c6669cea46a87871571066e124275ac44518e48029f446302c1f04a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for captacity_clipify-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 aac0a22c8e51e99608ae97e336a91f7e53c35d45f955dbbcc27d931f159d32cb
MD5 aed1fcb4ab0de49022c455426e92308f
BLAKE2b-256 33fbda7af6d569d9531b2110b0e160a3d0907c20be0c33cde5d41fe331d37cea

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