Skip to content

helloint/dual-subtitle

Repository files navigation

dual-subtitle

Extract two embedded subtitle tracks from video files and merge them into a single dual-language subtitle file. Supports batch processing for .mp4 and .mkv.

简体中文

NPM

Requirements

  • Node.js (with npm): nodejs.org
  • The CLI prefers your system ffmpeg and ffprobe; if missing, it falls back to bundled installers.

Usage

# Process all .mp4 and .mkv in the current directory
npx dual-subtitle

# Or specify a directory (with or without trailing /)
npx dual-subtitle /path/to/videos

If npx is not available (e.g. some Synology setups), use npm exec instead:
npm exec dual-subtitle (optionally add a directory argument).

Output

  • Merged subtitle file: <basename>.<lang1>-<lang2>.srt
    Example: movie.chi-eng.srt when auto-detecting Simplified Chinese + English.

Flow

  1. For each video, the tool scans embedded subtitle streams.
  2. Before running, there is a 3-second countdown:
    • Do nothing: It auto-selects Simplified Chinese (chi) and English (eng) and merges them. If either is missing, it lists tracks and asks you to enter the two stream indices to merge.
    • Press any key: Skip auto-detect; it lists all subtitle tracks and asks you to enter the two indices to merge.
  3. Batch: If you manually choose indices for any file in the run, all following files in that run also use manual selection (no countdown, no chi/eng auto-detect).

UI language

  • Default: English. If the system or environment suggests Chinese (e.g. LANG, LC_ALL, or on macOS the primary system language), the UI switches to Chinese.
  • Override: Set DUAL_SUBTITLE_LANG=zh or DUAL_SUBTITLE_LANG=en to force the language.

About

Useful for players like Infuse that don’t support showing two subtitle tracks at once: merge two embedded tracks (e.g. Chinese + English) into one dual subtitle file.

More background (Chinese): Zhihu

About

Extract bilingual subtitles from batch streaming videos (default: Simplified Chinese/English) with one click, then seamlessly merge them into dual-language subtitle files for efficient multilingual subtitle management. 一键从批量流媒体视频中智能提取双语字幕(默认简中/英语),并自动合并为对照字幕文件,高效实现多语言字幕管理。

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors