Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

douki

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

douki

Subtitle synchronization using audio fingerprinting

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

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({
  // Path to audio or video file containing the section to be synchronized
  sourceFile: 'Test - Episode 2.mkv',
  // The start and end times of the section (seconds or a 00:00.00 timestamp)
  start: 0,
  end: 90,
  // Name of the section
  name: 'opening',
  // Directory where the synchronization data will be stored
  // (a single directory can store data from multiple sections from the same project)
  dataDir: 'projects/test',
  // Optionally a .ass file to be used as template
  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(
  // Path to the new video or audio file to sync subtitles against
  'episode 3.mkv',
  // Path to the directory synchronization data was stored
  'projects/test',
  // Path to the directory generated files will be stored
  'some/temporary/dir'
)

// The path to the generated subtitle
console.log(subtitle)

// An array of paths of the files that need to be
// attached along the generated 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.

Keywords

FAQs

Package last updated on 06 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc