lektor_ai_comfy — Polish AI Dubbing Tool
=========================================
FULL DOCUMENTATION: see docs/
docs/README.md start here — overview and quick start
docs/requirements.md hardware, software, dependencies
docs/installation.md installing ComfyUI + the TTS engine
docs/usage.md every CLI flag, working modes, recipes
docs/architecture.md how the pipeline works internally
docs/troubleshooting.md diagnosed failure modes and their fixes
Installer: ./install_comfyui.sh (see docs/installation.md)
This file remains as a condensed quick reference.
Converts SRT subtitles to AI voiceover (lektor style) using ComfyUI + Higgs Audio V3 TTS,
then mixes the result with the original video audio into a two-track MKV.
All subtitle tracks in the source video are carried over to the output.
Requirements
------------
- ComfyUI running at http://127.0.0.1:8189 with TTS-Audio-Suite custom node
- Model: higgs-audio-v3-tts-4b (bosonai/higgs-audio-v3)
- ffmpeg and ffprobe available on PATH
- Voice reference: a WAV file + matching .txt transcript in the voice directory
(default: voices/gudowski_short.wav + voices/gudowski_short.txt)
Settings
--------
Defaults live in settings.ini next to the script:
voice, speed, temperature, max_tokens, strip_leading_ms, trailing_fade_ms,
orig_volume, tts_volume, output_dir, comfy_url
Precedence: command-line flag > settings.ini > built-in default.
Use --settings FILE to select a different profile.
See docs/usage.md for the full description.
Basic Usage
-----------
Full run with an external SRT file:
python3 lektor_ai_comfy.py input/film.srt input/film.mkv
Use subtitles embedded in the video (lists tracks, prompts for a choice):
python3 lektor_ai_comfy.py input/film.mkv --embedded-subs
Process only a time range (extracts a video fragment automatically):
python3 lektor_ai_comfy.py input/film.srt input/film.mkv --start 01:20 --end 05:40
Subtitle Handling
-----------------
Both external SRT files and embedded subtitle tracks go through the same cleaning:
- HTML tags stripped: , , , , etc.
- ASS override codes stripped: {\an8}, {\pos(x,y)}, {\c&H…&}, etc.
- ALL-CAPS blocks lowercased and converted to sentence case
- Sentence fragments starting with a lowercase letter are capitalised
- Missing terminal punctuation added (… or . depending on context)
- Dialogue lines (prefixed with -) are split into separate clips with proportional timing
With --embedded-subs the extracted subtitles are saved to the job folder as embedded_sub.srt
so you can inspect them before or after the run.
The final MKV preserves all subtitle tracks from the source video — text-based
(SRT, ASS, SSA, WebVTT) and image-based (PGS Blu-ray, VOBSUB) alike — using
stream copy with no conversion.
Output Files
------------
Everything belonging to one video is kept together in a job folder named after
the video file. Only the finished video is written to the top level.
output/
clips/