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 🙏

© 2024 – Pkg Stats / Ryan Hefner

pupcaps

v1.0.0-alpha

Published

PupCaps! : A script to add stylish captions to your videos.

Downloads

72

Readme

PupCaps! is a Node.js script that makes it easy to add captions to your videos with fully customizable styles. Design your captions using CSS, allowing complete control over fonts, colors, positioning, and more.

Limitations

CSS3 animations are not currently supported.

Requirements

You need node and ffmpeg to be installed on your computer.

Install

From npm:

npm i -g pupcaps@latest

or from sources:

git clone [email protected]:hosuaby/PupCaps.git
cd PupCaps
npm install
npm i -g .

Usage

To use the script, you need a SubRip Subtitle (.srt) file. PupCaps enables you to create Karaoke-style captioning (also known as "word-by-word highlighting").

To achieve this effect, wrap the words you want to highlight in square brackets. For example:

1
00:00:00.000 --> 00:00:00.500
A script to caption videos with style.

2
00:00:00.500 --> 00:00:01.000
[A] script to caption videos with style.

3
00:00:01.000 --> 00:00:01.500
A [script] to caption videos with style.

4
00:00:01.500 --> 00:00:02.000
A script [to] caption videos with style.

Generate Overlay File

Run the PupCaps script to transform your .srt file into an Apple QuickTime (MOV) file. This MOV file will serve as a captions overlay for your video.

pupcaps path/to/subtitles.srt

This command will produce .mov in the same folder with subtitles (unless you provided --output option). Check section "Caption video" to learn how to use this file as overlay.

Output File

The resulting .mov file will be saved in the same folder as the input .srt file unless you specify a different output path using the --output option. Example:

pupcaps path/to/subtitles.srt --output path/to/output.mov

To learn how to overlay the generated .mov file on your video, see the section: "Caption Video."

Style Captions

The appearance of captions can be fully customized using CSS. To do this, copy the contents of the file assets/captions.css and modify it to suit your preferences.

CSS allows you to define styles at various levels:

  • The container (captions as a whole).
  • Each phrase.
  • Individual words.
  • Highlighted words for dynamic effects.

Once you've customized your .css file, provide it to the PupCaps script using the --style option:

pupcaps path/to/subtitles.srt --style path/to/custom/styles.css

Options

Usage: pupcaps [options] <file>

Arguments

| Argument | Description | |----------|------------------------------------------------| | file | Path to the input SubRip Subtitle (.srt) file. |

Options

| Option | Default | Description | |--------------|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | -o, --output | | Full or relative path where the created Films Apple QuickTime (MOV) file should be written. By default, it will be saved in the same directory as the input subtitle file. | | -w, --width | 1080 | Width of the video in pixels. | | -h, --height | 1920 | Height of the video in pixels. | | -s, --style | | Full or relative path to the styles .css file. If not provided, default styles for captions will be used. |

Caption Video

To add captions to your video, use FFmpeg with the filter_complex:overlay filter. Below is an example command. You can adjust the codecs and parameters to suit your needs:

ffmpeg \
  -i original-video.mp4 \
  -i captions.mov \
  -filter_complex "[0:v][1:v]overlay=0:0" \
  -c:v libx264 -b:v 4M -crf 10 \
  -c:a copy \
  output.mp4