cadence/README.md
pedro-bento 4bee851d5d
All checks were successful
CI / lint-and-test (push) Successful in 11s
fix(whisper): don't force CTranslate2's cub_caching allocator (#9)
Forcing CT2_CUDA_ALLOCATOR=cub_caching pre-reserves a large working set
(~2 GB extra measured on an RTX 3060), which pushes large-v3 over a 6 GB
card's budget and causes the very OOM it was meant to avoid. Leave the
default cuda_malloc_async allocator in place.

Measured on an RTX 3060 Laptop (6 GB): large-v3 int8_float16 keeps ~1.9 GB
resident with the default allocator and transcribes a 2750 s file at a
~3.1 GB peak; with cub_caching the same model needs ~3.9 GB before decoding.

Reviewed-on: #9
Co-authored-by: pedro-bento <mail@pbento.pt>
Co-committed-by: pedro-bento <mail@pbento.pt>
2026-10-17 21:59:38 +01:00

92 lines
3.4 KiB
Markdown

# cadence
High-retention auto-editor for raw video recordings. It transcribes your audio, cuts silences and filler words, and writes a native `.kdenlive` project ready for final polish — plus `.srt` captions and an LLM-friendly transcript.
## Quick start
### Linux
```sh
# uv — installs to ~/.local/bin
curl -LsSf https://astral.sh/uv/install.sh | sh
# FFmpeg — pick your distro
sudo apt install ffmpeg # Debian / Ubuntu
sudo dnf swap ffmpeg-free ffmpeg --allowerasing # Fedora
sudo pacman -S ffmpeg # Arch
# Run
uv run cadence.py recording.mp4 --preset balanced --captions
```
> - **uv** installs to `~/.local/bin`; make sure that directory is on your `PATH` (the installer normally adds it — otherwise `export PATH="$HOME/.local/bin:$PATH"` in your shell profile).
> - **Fedora**: enable [RPM Fusion](https://rpmfusion.org/Configuration) first. Fedora ships `ffmpeg-free`, which conflicts with the full `ffmpeg` package, so swap rather than install — `sudo dnf swap ffmpeg-free ffmpeg --allowerasing`.
> - **Nobara**: codecs are managed by Nobara and manual changes are blocked. Run `nobara-sync install-codecs` (or the Codec Wizard) instead of `dnf swap`.
### macOS
```sh
brew install uv ffmpeg
uv run cadence.py recording.mp4 --preset balanced --captions
```
### Windows (PowerShell)
```powershell
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" # uv
winget install -e --id Gyan.FFmpeg # FFmpeg
uv run cadence.py recording.mp4 --preset balanced --captions
```
## Install as a command (Linux & macOS)
Make `cadence` available everywhere by symlinking the script into a directory on your `PATH`:
```sh
chmod +x cadence.py
mkdir -p ~/.local/bin
ln -sf "$PWD/cadence.py" ~/.local/bin/cadence
```
Now call it from any directory:
```sh
cadence recording.mp4 --preset balanced --captions
```
`~/.local/bin` is added to `PATH` by the uv installer; if it isn't, add `export PATH="$HOME/.local/bin:$PATH"` to your shell profile (`~/.bashrc`, `~/.zshrc`, etc.).
## Output
- `recording.kdenlive` — the edited project.
- `recording.srt` and `recording_llm_transcript.txt` — generated when `--captions` is used.
Pass `--render` to have cadence encode the final `recording.mp4` itself (same
cut decisions) instead of opening Kdenlive; with multiple inputs the kept
segments are concatenated in sequence order into one MP4. Add `--keep-project`
to also write the `.kdenlive` project.
Presets: `super-relaxed`, `relaxed`, `balanced`, `punchy`. See all options with `uv run cadence.py --help`.
## GPU notes (Linux / NVIDIA)
Transcription is memory-lean and degrades instead of crashing. On CUDA it uses
`int8_float16` by default (`large-v3` in `float16` keeps ~3.7 GB resident and
runs out of VRAM on 6 GB cards). If CTranslate2 still reports an out-of-VRAM
error partway through a long file, cadence drops and releases the model and
retries with `int8` + greedy decoding, then CPU, instead of aborting. The
CTranslate2 CUDA allocator is left at its default: forcing `cub_caching`
pre-reserves a large working set and makes things worse.
## Development
Run the linter and tests locally:
```sh
uvx ruff check .
uv run --with pytest pytest -q
```
The test suite needs only `pytest` — `cadence.py` imports nothing third-party at module level, so no torch/whisper/ffmpeg is required to run it. CI runs both via Forgejo Actions (`.forgejo/workflows/ci.yml`).