← Back to archive
Project
subx — Video Subtitle Extraction & OCR Toolkit
subx is a Python CLI and GUI toolkit for extracting subtitles from video files, supporting both softsub (embedded subtitle streams) and hardsub (text burned into the video frame) workflows.
Key Features
- Softsub extraction — lists and extracts embedded subtitle streams (SRT, ASS, mov_text, WebVTT) via FFmpeg/FFprobe, converting text-based formats directly to
.srtand preserving bitmap formats (PGS/DVD) for downstream OCR. - Hardsub OCR pipeline — samples video frames with FFmpeg, crops the subtitle region, detects frame-to-frame changes to minimize redundant work, and runs OCR only on changed frames using RapidOCR, then merges results into timed SRT cues.
- Automatic GPU/CUDA acceleration — detects available hardware and switches between a shared ONNX Runtime GPU session and multi-core CPU parallelism (via multiprocessing) for OCR throughput, reporting live progress and realtime-multiplier speed.
- Distributed processing — supports splitting a single video across multiple machines/sessions using
--start/--durationflags, with automatic timestamp offsetting when merging results. - Built-in translation — translates extracted SRT files between languages using Google Translate.
- Desktop GUI — a graphical interface for selecting videos, listing streams, extracting subtitles, and translating output files without the command line.
Tech Stack
Python 3.10+, FFmpeg/FFprobe, RapidOCR, ONNX Runtime (CPU and CUDA execution providers), Python multiprocessing, deep-translator.
Role
Sole author and developer, responsible for the end-to-end design of both the softsub extraction path and the hardsub OCR pipeline, including the GPU/CPU acceleration logic and the distributed multi-machine processing workflow.