Douki
Douki is a audio fingerprinting based subtitle synchronization tool.
Douki (同期): synchronization
-- Jisho
This project started in October 2020 and was made to automatically synchronize song translations in anime. It was been already tested with dozens of anime, including Douki-chan.
At the moment only a programmatic API is available. Check the roadmap in the respective GitHub issue.
Usage
Make sure ffmpeg is installed and available in the path.
Generate synchronization data by running this:
import { generateSyncData } from 'douki'
await generateSyncData({
sourceFile: 'Test - Episode 2.mkv',
start: 0,
end: 90,
name: 'opening',
dataDir: 'projects/test',
templatePath: 'template.ass'
})
By running the above code it will create a .json
file containing synchronization data, a .mkv
containing the synchronized section (just to aid authoring the subtitle), a subdirectory containing attachments found in the source file (if there was), an .ass
file with the subtitle found in the source file or, if there was not any, based in the template, and a keyframes.txt
file.
Edit the .ass
as needed. It should be timed against the .mkv
file.
Run the below code to synchronize the section to another files:
import { synchronizeSubtitles } from 'douki'
const { subtitle, attachments } = await synchronizeSubtitles(
'episode 3.mkv',
'projects/test',
'some/temporary/dir'
)
console.log(subtitle)
console.log(attachments)
You can use a player that natively supports multiple subtitles at the same time (like MX Player, which is the player it was been mostly tested on) or use a MPV fork that enables support to multiple subtitles or find a way to merge the generated subtitles with existent ones.