All Projects → kaegi → Alass

kaegi / Alass

Licence: gpl-3.0
"Automatic Language-Agnostic Subtitle Synchronization"

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Alass

Align
A general purpose application and library for aligning text.
Stars: ✭ 63 (-85.04%)
Mutual labels:  alignment, tool
Rundeck Cli
CLI tool for Rundeck
Stars: ✭ 98 (-76.72%)
Mutual labels:  api, tool
Glasscord
[BUGFIXES ONLY, SUPPORT WILL DROP MAR 1, 2021] Injecting composition effects into Electron applications!
Stars: ✭ 737 (+75.06%)
Mutual labels:  api, tool
Ffsubsync
Automagically synchronize subtitles with video.
Stars: ✭ 5,167 (+1127.32%)
Mutual labels:  alignment, subtitle
Awesome Documentation Tools
🔥 📚 All the tools, processes and resources you need to create an awesome API & Project documentation
Stars: ✭ 138 (-67.22%)
Mutual labels:  api, tool
Apidiff
A tool to identify breaking and non-breaking changes between two versions of a Java library
Stars: ✭ 28 (-93.35%)
Mutual labels:  api, tool
Opensubtitles Api
nodejs opensubtitles.org api wrapper for downloading and uploading subtitles in multiple langs
Stars: ✭ 96 (-77.2%)
Mutual labels:  api, subtitle
Xseries
Library for cross-version Minecraft Bukkit support and various efficient API methods.
Stars: ✭ 109 (-74.11%)
Mutual labels:  api, algorithm
Trino
Trino: Master your translations with command line!
Stars: ✭ 118 (-71.97%)
Mutual labels:  api, tool
Mockit
A tool to quickly mock out end points, setup delays and more...
Stars: ✭ 1,534 (+264.37%)
Mutual labels:  api, tool
Algorithms Js
Consumable Data Structures and Algorithms library in JavaScript
Stars: ✭ 155 (-63.18%)
Mutual labels:  api, algorithm
Customstage
A JavaFX UI framework to create fully customized undecorated windows
Stars: ✭ 148 (-64.85%)
Mutual labels:  api, tool
Haste
Haste: a fast, simple, and open RNN library
Stars: ✭ 214 (-49.17%)
Mutual labels:  api, algorithm
Phpinsights
🔰 Instant PHP quality checks from your console
Stars: ✭ 4,442 (+955.11%)
Mutual labels:  tool
Cljdoc
📚 A central documentation hub for the Clojure community
Stars: ✭ 416 (-1.19%)
Mutual labels:  api
Release It
🚀 Automate versioning and package publishing
Stars: ✭ 4,773 (+1033.73%)
Mutual labels:  tool
Cs231n 17 kor sub
CS231N 2017 video subtitles translation project for Korean Computer Science students
Stars: ✭ 409 (-2.85%)
Mutual labels:  subtitle
Database consistency
The tool to find inconsistency between models schema and database constraints.
Stars: ✭ 418 (-0.71%)
Mutual labels:  tool
Typegql
Create GraphQL schema with TypeScript classes.
Stars: ✭ 415 (-1.43%)
Mutual labels:  api
Wtdbg2
Redbean: A fuzzy Bruijn graph approach to long noisy reads assembly
Stars: ✭ 408 (-3.09%)
Mutual labels:  alignment

Introduction

alass is a command line tool to synchronize subtitles to movies.

It can automatically correct

  • constant offsets
  • splits due to advertisement breaks, directors cut, ...
  • different framerates

The alignment process is not only fast and accurate, but also language-agnostic. This means you can align subtitles to movies in different languages.

alass stands for "Automatic Language-Agnostic Subtitle Synchronization". The theory and algorithms are documented in my bachelor's thesis and summarized in my bachelor's presentation.

Executable for Windows (64-bit)

Get the latest executable from here! Just download and extract the archive. The file alass.bat is the command line tool.

Executable for Linux (64-bit)

Get the latest executable from here! To run the executable, ffmpeg and ffprobe have to be installed. You can change their paths with the environment variables ALASS_FFMPEG_PATH (default ffmpeg) and ALASS_FFPROBE_PATH (default ffprobe).

Usage

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 1000 (default 7)
$ alass reference_subtitle.ssa incorrect_subtitle.srt output.srt --split-penalty 10

Values between 5 and 20 are the most useful. Anything above 20 misses some important splits and anything below 5 introduces many unnecessary splits.

If you only want to shift the subtitle, without introducing splits, you can use --no-splits:

# synchronizing the subtitles in this mode is very fast
$ alass movie.mp4 incorrect_subtitle.srt output.srt --no-splits

Currently supported are .srt, .ssa/.ass and .idx files. Every common video format is supported for the reference file.

Performance and Results

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 perfect - the percentage of "good subtitles" is about 88% to 98%, depending on how strict you classify a "good subtitle". Downloading random subtitles from OpenSubtitles.org had an error rate of about 50% (sample size N=118). Of all subtitle lines (not subtitle files) in the tested database, after synchronization

  • 50% were within 50ms of target position
  • 80% were within 100ms of target position
  • 90% were within 400ms of target position
  • 95% were within 800ms of target position

compared to a (possibly not perfect) reference subtitle.

How to compile the binary

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 (gcc or clang) is needed to compile this project.

To use alass-cli with video files, ffmpeg and 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 ALASS_FFMPEG_PATH (default ffmpeg) and ALASS_FFPROBE_PATH (default ffprobe).

Building from Source

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

Configuration

All parameters are shown for cargo build can also be used for cargo install and cargo run.

FFmpeg as a library

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

Alias Setup

For Linux users: It is recommended to add the folder path to your system path as well as setup an alias for alass to 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"

Folder structure

This cargo workspace contains two projects:

  • alass-core which provides the algorithm

    It is targeted at developers who want to use the same algorithm in their project.

  • alass-cli which is the official command line tool

    It is target at end users who want to correct their subtitles.

Library Documentation

Open README from alass-core.

Notes

This program was called aligner in the past. This made it nearly impossible to find on a search engine, so alass was chosen instead.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].