Skip to main content

Add TikTok-style captions to videos

Project description

TikTok Captions

Add TikTok-style captions to your videos automatically using OpenAI's Whisper for transcription.

Installation

pip install tiktokcaptions

Usage

from tiktokcaptions import add_captions_to_videofile

# whisper transcription (dict)
transcription = ...

# Basic usage
add_captions_to_videofile("input.mp4", transcription=transcription, output_file="with_captions.mp4")

# With custom options
add_captions_to_videofile(
    "input.mp4",
    transcription=transcription,
    output_file="with_captions.mp4",

    # Font settings
    font="Montserrat-ExtraBold.ttf",  # or path to custom font
    font_size=50,
    font_color="white",

    # Stroke settings
    stroke_width=2,
    stroke_color="black",

    # Word highlighting
    highlight_current_word=True,
    highlight_color="#FF4500",
    highlight_padding=(10, 8),  # Horizontal and vertical padding around highlighted words in pixels
    highlight_radius=10,      # Border radius of the highlight box in pixels

    # Layout
    line_count=2,        # Maximum number of lines to show at once
    padding=50,          # Horizontal padding from video edges in pixels
    position="bottom",   # "top", "bottom", or "center"
    margin=200,          # Vertical margin from video edges in pixels (when using top/bottom position)

    # Shadow effects
    shadow_strength=1.0,
    shadow_blur=0.3,

    # Other
    verbose=False
)

Features

  • Automatic speech recognition using Whisper
  • Customizable caption styling
  • Support for multiple video formats
  • Easy to use API

Requirements

  • Python 3.7+
  • FFmpeg installed on your system

License

MIT License - see LICENSE file for details.

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

tiktokcaptions-0.1.1.tar.gz (239.7 kB view details)

Uploaded Source

Built Distribution

tiktokcaptions-0.1.1-py3-none-any.whl (239.3 kB view details)

Uploaded Python 3

File details

Details for the file tiktokcaptions-0.1.1.tar.gz.

File metadata

  • Download URL: tiktokcaptions-0.1.1.tar.gz
  • Upload date:
  • Size: 239.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for tiktokcaptions-0.1.1.tar.gz
Algorithm Hash digest
SHA256 feb23f9424aabb9c2d22e6a630654c77602604e3c1ab3666a96047ed3bb56dec
MD5 a52c697dfa5ca451278ead5007c11a1a
BLAKE2b-256 8c7dcfdba420663be5a769001a9d8c28258aa7f5fc572ba4d9fac928874003f3

See more details on using hashes here.

File details

Details for the file tiktokcaptions-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for tiktokcaptions-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cdf1b5dd0c5877e8146dce4be237f699036756be01e40c8ef0cda177c76624ad
MD5 88b7d92b72db26d79d6637864c0359f6
BLAKE2b-256 9c51ddd61a9e0a4b1626f9e740ac16f440e1faba4fa993759da7ee891d2ac89a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page