About this project
FFsubsync is a language-agnostic command-line tool, Python library, and browser-based utility for automatically synchronizing subtitles with video or reference subtitle files. It aligns text timings with the correct starting points in multimedia files.
### How It Works
The core synchronization algorithm operates in three main steps:
1. Discretizes both the video file's audio stream and the subtitles into 10ms windows.
2. Determines whether each window contains speech. Subtitles are parsed directly, while audio streams are analyzed using off-the-shelf voice activity detectors (VAD) such as the one built into WebRTC.
3. Aligns the resulting binary strings by maximizing matches through a Fast Fourier Transform (FFT) convolution approach, bringing time complexity down to O(n log n).
### Key Features
- **Multiple Reference Types:** Sync against video files, audio files, correctly synchronized reference subtitle files (.srt), or remote URLs.
- **Browser-Based Version:** Run entirely client-side without installation via WebAssembly (ffmpeg.wasm), ensuring files remain local.
- **Robust Encoding Detection:** Automatically infers legacy subtitle text encodings (such as Windows-1251, GBK, Shift-JIS, and UTF-16 with BOMs) using multiple fallback detectors.
- **Advanced Sync Options:** Supports framerate correction, golden-section search ratios, piecewise alignment (`--split-penalty`) for mid-file cuts, and alternative VAD backends (Auditok, Silero/PyTorch).
- **Docker Support:** Prebuilt container images available via GitHub Container Registry.
- **Python Library API:** Can be invoked programmatically with custom progress callbacks.
Comments
0 people shared their preference · Deer Point appears after 10 participants
Sign in to join the discussion.