TikTok Captions
Add TikTok-style captions to your videos automatically using OpenAI's Whisper for transcription.
Preview
Installation
pip install tiktokcaptions
Usage
from tiktokcaptions import add_captions_to_videofile
# whisper transcription (dict)
transcription = openai.audio.transcription.create(
model="whisper-1",
file=file,
timestamp_granularities=["segment", "word"],
response_format="verbose_json",
)
transcription = transcription.model_dump()
# 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.
Metadata
Release files for tiktokcaptions 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tiktokcaptions-0.1.2.tar.gz | 240.1 kB | Without provenance | Details for tiktokcaptions-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tiktokcaptions-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for tiktokcaptions-0.1.2-py3-none-any.whl |
Total release size: 479.5 kB
Release files / tiktokcaptions-0.1.2.tar.gz
| Download URL | tiktokcaptions-0.1.2.tar.gz |
|---|---|
| Size | 240.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
12007ac3bead6d458f60487ff653d29c4893489144935b836809ddb0b1e7d5be
|
|
BLAKE2b-256 checksum How to use checksums |
89b1306fae399b1bf499b164d8d637ff29a69def06023008b1ace96efa57daa3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.12
|
Release files / tiktokcaptions-0.1.2-py3-none-any.whl
| Download URL | tiktokcaptions-0.1.2-py3-none-any.whl |
|---|---|
| Size | 239.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
356d8fcb7077ea40083c04c96c242e6a417770fcde092c2ee815c3a1771d2d18
|
|
BLAKE2b-256 checksum How to use checksums |
0dfe0dbf41cdfcb6e66c08bd109364747a05cd1d110627e1ecbf62474f350973
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.12
|
Security for tiktokcaptions 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.