video-caption-ai
video-caption-ai turns video audio into SRT subtitles with faster-whisper, optionally refines subtitles with an OpenAI-compatible AI service, and can mux or burn subtitles back into video.
Features
- FFmpeg audio extraction
- faster-whisper transcription
- AI semantic segmentation
- AI transcript correction with validation and retries
- Optional TXT/Markdown reference transcript matching
- SmartSub-inspired timing and readability guards
- Soft subtitle muxing or hard subtitle burning
- Hard subtitle style presets:
classic,yellow,cinema,top
Requirements
- Python 3.10 or newer
- FFmpeg available as
ffmpegon PATH - CPU or NVIDIA CUDA runtime as appropriate for faster-whisper
Install for development
python -m pip install -e ".[dev]"
The package provides the video-caption command. video-subtitle remains as a
compatibility alias. It can also be run with:
python -m video_caption_ai --help
Transcribe video
video-caption input.mp4 output.srt --model small --language zh --device cpu --no-vad
Use a reference transcript without changing Whisper cue timing:
video-caption input.mp4 output.srt `
--model small --language zh --device cpu --no-vad `
--reference-script reference.md
The reference file can be .txt or .md. Markdown headings, lists, links,
emphasis, and fenced code are cleaned before matching. If the text does not
match the ASR transcript reliably, the original ASR cue text is kept.
AI refinement
The AI endpoint must expose an OpenAI-compatible /chat/completions endpoint.
video-caption input.mp4 output.srt `
--model small --language zh --device auto --no-vad `
--ai-segmentation --ai-correction `
--ai-base-url "http://192.168.0.41:9292/v1" `
--ai-model "Qwen3.6-35b-A3B-UD-Q6_K_XL-MTP"
An API key is optional for local services.
Compose an existing SRT
Soft subtitles, selectable in a compatible player:
video-caption input.mp4 existing.srt --compose-only `
--video-output subtitled.mkv --subtitle-mode soft
Hard subtitles burned into the picture:
video-caption input.mp4 existing.srt --compose-only `
--video-output subtitled.mp4 --subtitle-mode hard `
--style-preset yellow
Override a preset when needed:
video-caption input.mp4 existing.srt --compose-only `
--video-output subtitled.mp4 --subtitle-mode hard `
--style-preset yellow --font-size 56 --outline-width 4
Python API
from video_caption_ai import compose_video, transcribe_video
# CLI-oriented transcription entry point is available through video-caption.
# Video composition is also available as a Python function.
Development checks
python -m pytest
python -m video_caption_ai --help
python -m build
License
MIT. See LICENSE.
Credits
video-caption-ai is an independent Python rewrite inspired by and based on the subtitle transcription and refinement workflow of SmartSub. It is not the official SmartSub distribution. The original SmartSub project is licensed separately; see its repository for its license and attribution details.
Metadata
Release files for video-caption-ai 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| video_caption_ai-0.1.0.tar.gz | 23.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| video_caption_ai-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 46.5 kB
Release files / video_caption_ai-0.1.0.tar.gz
| Download URL | video_caption_ai-0.1.0.tar.gz |
|---|---|
| Size | 23.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e0c579eecdce82c0b16e6942655524bf67868b9ab975b721dd007c9ee66930b7
|
|
BLAKE2b-256 checksum How to use checksums |
df2abf3036e44c2b3bd01634d0db6eb9d453f0e7f8848cae60a56f1aee5a7504
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Release files / video_caption_ai-0.1.0-py3-none-any.whl
| Download URL | video_caption_ai-0.1.0-py3-none-any.whl |
|---|---|
| Size | 23.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7b36fe72babeb9f1527e259e045b7bf784795dec7084b3b5be24aa1f0ea69247
|
|
BLAKE2b-256 checksum How to use checksums |
d4c04682d84e46e5a6aa94cf51f91a584479b2c2f1c3d30226c276090c535432
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|