✓ Uses Rust 2018 edition
|1.1.0||Sep 10, 2019|
|1.0.2||Aug 16, 2019|
|1.0.1||Aug 15, 2019|
|1.0.0||Aug 14, 2019|
#1 in #subtitle
34 downloads per month
alass is a command line tool to synchronize subtitles to movies. It will figure out offsets and where to
introduce or remove advertisement breaks to get the best alignment possible. It does not use
any language information so it even works for image based subtitles like VobSub.
alass stands for "Automatic Language-Agnostic Subtitle Synchronization".
Get the lastest executable from here! Just download and extract the archive. The file
alass.bat is the command line tool.
The most basic command is:
$ alass movie.mp4 incorrect_subtitle.srt output.srt
You can also use
alass to align the incorrect subtitle to a different subtitle:
$ alass reference_subtitle.ssa incorrect_subtitle.srt output.srt
You can additionally adjust how much the algorithm tries to avoid introducing or removing a break:
# split-penalty is a value between 0 and 100 (default 4) $ alass reference_subtitle.ssa incorrect_subtitle.srt output.srt --split-penalty 2.6
Values between 0.1 and 10 are the most useful. Anything above 10 probably does not split the subtitle and anything below 0.1 introduces many unnecessary splits.
If you only want to shift the subtitle, without introducing splits, you can use
# synchronizing the subtitles in this mode is very fast $ alass movie.mp4 incorrect_subtitle.srt output.srt --no-splits
Currently supported are
.idx files. Every common video format is supported for the reference file.
The extraction of the audio from a video takes about 10 to 20 seconds. Computing the alignment usually takes between 5 and 10 seconds.
The alignment is usually very good in my test (subtitles are within 0.1s of the target position). Adjusting the split penalty can help in a few cases if aligning does not work out-of-the box. More extensive testing and statistics will be performed in the future.
Install Rust and Cargo then run:
# this will create the lastest release in ~/.cargo/bin/alass-cli $ cargo install alass-cli
The voice-activity module this project uses is written in C. Therefore a C compiler (
clang) is needed to compile this project.
alass-cli with video files,
ffprobe have to be installed. It is used to extract the raw audio data. You can set the paths used by
alass using the environment variables
If you want to build and run the project from source code:
$ git clone https://github.com/kaegi/alass $ cd alass $ cargo build $ cargo run -- movie.mp4 input.srt output.srt
All parameters are shown for
cargo build can also be used for
cargo install and
You can activate the statistics module inside
# Important: you have to be inside `alass-cli`! Otherwise the parameter is ignored. $ cargo build --features statistics $ cargo run -- --statistics-path ./some/folder
This will create the statistics file in
./some/folder. You can use
--statistics-required-tag to only generate statistics.
The statistics module allows you to understand/debug the algorihm better.
Warning: Using this configuration slows down the algorithm by 50% or more even if no statistics files are generated.
You can also link
ffmpeg as a dynamic library during compile time. The library implementation can extract the audio about 2 to 3 seconds faster. Unfortunately it is harder to compile, the error handling is only very basic and might still have bugs.
You have to remove "
# FFMPEG-LIB" from every line that starts with it in
alass-cli/Cargo.toml. Then use:
# Important: you have to be inside `alass-cli`! Otherwise the parameters get ignored. $ cargo build --no-default-features --features ffmpeg-library
For Linux users: It is recommended to add the folder path to your system path as well as setup an alias for
alass-cli. Add this to your
~/.bashrc (or the setup file of your favorite shell):
export PATH="$PATH:$HOME/.cargo/bin" alias alass="alass-cli"
cargo workspace contains two projects:
alass-corewhich provides the algorithm
It is targeted at developers who want to use the same algorithm in their project.
alass-cliwhich is the official command line tool
It is target at end users who want to correct their subtitles.
Open README from
This program was called
aligner in the past. This made it nearly impossible to find on a search engine, so
alass was chosen instead.