npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

douki

v0.0.8

Published

Subtitle synchronization using audio fingerprinting

Readme

Douki logo

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 Ganbare, Douki-chan.

At the moment only a programmatic API for Node is available. This project is experimental and everything can (and probably will) change. Check the roadmap for more info.

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',
  // Directory where the synchronization data will be stored
  // (a single directory can store data from multiple sections from the same project)
  dataDir: 'projects/test',
  // The start and end times of the section (optional)
  // Can be a seconds number or a 00:00.00 timestamp string
  start: 0,
  end: 90,
  // Name of the section (optional)
  name: 'opening',
  // A .ass file to be used as template (optional)
  templatePath: 'template.ass'
})

By running the above code it will create a .json file containing synchronization data, a .mkv containing the synchronized section, a subdirectory containing attachments found in the source file, 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 above code multiple times for each section to be synchronized. The .mkv and keyframes.txt files are meant only to aid editing the .ass file and can be deleted afterwards.

Run the below code to synchronize the section to another files:

import { synchronizeSubtitles } from 'douki'

const result = await synchronizeSubtitles(
  // Path to the new video or audio file to sync subtitles against
  'Test - Episode 3.mkv',
  // Path to the directory where synchronization data was stored
  'projects/test',
  // Output path: can be a directory or an .ass file
  'some/temporary/dir' // or 'some/temporary/file.ass'
)

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

// An array of paths of the files that need to be
// attached along the generated subtitle
console.log(result.attachments)

// synchronizeSubtitles will return undefined when there are no matches

After that merge the generated subtitles with existent ones and mux with your video.