A cross-platform command-line tool for extracting subtitle tracks from MKV files using MKVToolNix.
- Features
- Quick Start
- Installation
- Usage
- Track Selection
- Output Configuration
- Configuration Files
- Command Reference
- Examples
- Supported Formats
- License
- Contributing
- Acknowledgements
- Multiple input methods: Interactive drag-and-drop, command-line interface, batch processing
- Flexible track selection: By language code, track number, or subtitle format
- Track exclusion: Filter out unwanted tracks from selection
- Batch processing: Process multiple files with glob patterns
- Custom output: Configurable output directories and filename templates
- Configuration profiles: Save common settings for repeated use
- Dry run mode: Preview operations before execution
- Cross-platform: Works on Windows, macOS, and Linux
# Extract all subtitle tracks from a single file
./subscalpelmkv -x movie.mkv
# Extract English subtitles only
./subscalpelmkv -x movie.mkv -s eng
# Extract from multiple files
./subscalpelmkv -b "*.mkv" -s eng,spa
# Show track information
./subscalpelmkv -i video.mkv
# Preview what would be extracted (filename and output path)
./subscalpelmkv -x movie.mkv -s eng --dry-run
- MKVToolNix (
mkvmerge
andmkvextract
)
Download the latest release for your platform from the releases page:
- Linux x86_64:
subscalpelmkv_Linux_x86_64.tar.gz
- Linux ARM64:
subscalpelmkv_Linux_arm64.tar.gz
- macOS Intel:
subscalpelmkv_Darwin_x86_64.tar.gz
- macOS Apple Silicon:
subscalpelmkv_Darwin_arm64.tar.gz
- Windows x86_64:
subscalpelmkv_Windows_x86_64.zip
After downloading:
- Extract the archive (tar.gz or zip)
- The binary is named
subscalpelmkv
(orsubscalpelmkv.exe
on Windows) - Make it executable (Linux/macOS):
chmod +x subscalpelmkv
- Move it to a directory in your PATH or run it from the current directory
- Install MKVToolNix and ensure it's in your PATH
If you prefer to build from source:
-
Install Go 1.16 or later
-
Clone and build:
git clone https://github.com/matthane/subscalpelmkv.git cd subscalpelmkv go build -o subscalpelmkv cmd/subscalpelmkv/main.go # For Windows go build -o subscalpelmkv.exe cmd/subscalpelmkv/main.go
Drag an MKV file, multiple files, or a directory onto the executable:
- Single file: Interactive track selection
- Multiple files: Batch processing with shared settings
- Directory: Recursive processing of all MKV files
The interactive mode guides you through:
- Viewing available subtitle tracks
- Selecting tracks by language, number, or format
- Specifying output preferences
- Applying exclusion filters
# Basic extraction
./subscalpelmkv -x video.mkv
# With track selection
./subscalpelmkv -x video.mkv -s eng,spa
# With output directory
./subscalpelmkv -x video.mkv -o ./subtitles
# Show track information
./subscalpelmkv -i video.mkv
Process multiple files using glob patterns:
# All MKV files in current directory
./subscalpelmkv -b "*.mkv" -s eng
# Files in subdirectory
./subscalpelmkv -b "Season1/*.mkv" -s eng,spa
# With custom output template
./subscalpelmkv -b "*.mkv" -s eng -f "{basename}-{language}.{extension}"
Preview extraction without creating files:
./subscalpelmkv -x video.mkv -s eng --dry-run
Displays:
- Number of tracks to extract
- Track details (number, language, format)
- Output filenames
Select tracks using any combination of:
- Language codes:
eng
,spa
,fre
(2 or 3 letter ISO codes) - Track numbers:
1
,3
,5
- Subtitle formats:
srt
,ass
,sup
# Language selection
./subscalpelmkv -x video.mkv -s eng,spa
# Track number selection
./subscalpelmkv -x video.mkv -s 1,3,5
# Format selection
./subscalpelmkv -x video.mkv -s srt,ass
# Mixed selection
./subscalpelmkv -x video.mkv -s eng,3,srt
Exclude specific tracks using -e
:
# Exclude languages
./subscalpelmkv -x video.mkv -e chi,kor
# Exclude formats
./subscalpelmkv -x video.mkv -e sup,sub
# Select English but exclude image-based formats
./subscalpelmkv -x video.mkv -s eng -e sup,sub
Supports both ISO 639-1 (2-letter) and ISO 639-2/B (3-letter) codes:
- English:
en
oreng
- Spanish:
es
orspa
- French:
fr
orfre
- German:
de
orger
- Japanese:
ja
orjpn
- Chinese:
zh
orchi
- And more...
Control where subtitle files are saved:
# Same directory as input (default)
./subscalpelmkv -x video.mkv
# Auto-create {basename}-subtitles directory
./subscalpelmkv -x video.mkv -o
# Custom directory
./subscalpelmkv -x video.mkv -o ./subtitles
Customize output filenames with placeholders:
Placeholder | Description |
---|---|
{basename} |
Original filename without extension |
{language} |
Track language code |
{trackno} |
Track number (zero-padded) |
{trackname} |
Track name (if available) |
{forced} |
"forced" for forced tracks |
{default} |
"default" for default tracks |
{extension} |
File extension |
# Simple: movie-eng.srt
-f "{basename}-{language}.{extension}"
# With track number: movie.001.eng.srt
-f "{basename}.{trackno}.{language}.{extension}"
# Organized by language: eng/movie.srt
-f "{language}/{basename}.{extension}"
Configuration files are searched in order:
./subscalpelmkv.yaml
(current directory)- Linux/macOS:
~/.config/subscalpelmkv/config.yaml
- Windows:
%APPDATA%\subscalpelmkv\config.yaml
~/.subscalpelmkv.yaml
(home directory)
# Default settings
default_languages: [eng, spa]
default_exclusions: [chi, kor]
output_template: "{basename}.{language}.{trackno}.{extension}"
output_dir: "./subtitles"
# Named profiles
profiles:
anime:
languages: [jpn, eng]
exclusions: [chi, kor]
output_template: "{basename}/{language}.{extension}"
movies:
languages: [eng]
exclusions: [sup, sub]
output_template: "{basename}-{language}.{extension}"
# Use default configuration
./subscalpelmkv -x video.mkv --config
# Use named profile
./subscalpelmkv -x video.mkv --profile anime
# Override profile settings
./subscalpelmkv -x video.mkv --profile anime -s eng
Option | Short | Description |
---|---|---|
--extract |
-x |
Extract subtitles from MKV file |
--batch |
-b |
Process multiple files with glob pattern |
--select |
-s |
Select tracks (languages/numbers/formats) |
--exclude |
-e |
Exclude tracks (languages/numbers/formats) |
--info |
-i |
Display track information |
--output-dir |
-o |
Output directory (or auto-create with no args) |
--format |
-f |
Filename template |
--dry-run |
-d |
Preview without extraction |
--config |
-c |
Use default configuration |
--profile |
-p |
Use named profile |
--help |
-h |
Show help |
--version |
-v |
Show version information |
# Extract all subtitles
./subscalpelmkv -x movie.mkv
# Extract specific language
./subscalpelmkv -x movie.mkv -s eng
# Extract multiple languages
./subscalpelmkv -x movie.mkv -s eng,spa,fre
# Extract to custom directory
./subscalpelmkv -x movie.mkv -o ./subs
# Batch process with auto-created directories
./subscalpelmkv -b "*.mkv" -s eng -o
# Extract text subtitles only (exclude image-based)
./subscalpelmkv -x movie.mkv -s eng,spa -e sup,sub
# Complex selection with custom naming
./subscalpelmkv -x movie.mkv -s eng,spa,3,5 -e chi -f "{language}/{basename}.{extension}"
# Use configuration profile for anime
./subscalpelmkv -b "Anime/*.mkv" --profile anime
# Dry run to preview batch operation
./subscalpelmkv -b "Season1/*.mkv" -s eng,spa --dry-run
- SubRip (
.srt
) - Advanced SubStation Alpha (
.ass
) - SubStation Alpha (
.ssa
) - WebVTT (
.vtt
) - Universal Subtitle Format (
.usf
) - Plain text (
.txt
)
- PGS/SUP (
.sup
) - VOBSUB (
.idx
+.sub
) - DVB subtitles (
.sub
) - Bitmap (
.bmp
)
- Kate streams (
.kate
) - HDMV TextST (
.txt
)
This project is licensed under the MIT License. See the LICENSE.md
file for details.
Contributions are welcome! Please open an issue or submit a pull request on GitHub.