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 🙏

© 2026 – Pkg Stats / Ryan Hefner

video-subtitle-cli

v1.0.3

Published

一键为视频/音频添加字幕的命令行工具 | CLI tool for adding subtitles to video/audio

Readme

Video Subtitle CLI Tool

一键为视频/音频添加字幕的命令行工具 | CLI tool for adding subtitles to video/audio

CLI Demo

功能特性 ✨

  • 支持多种视频格式(MP4/MKV/AVI/MOV)和音频格式(MP3/WAV/M4A/FLAC)
  • 使用OpenAI Whisper模型进行语音识别
  • 生成SRT字幕文件
  • 可选将字幕直接嵌入视频文件
  • 断点续做(使用--force强制重新生成)

安装依赖 📦

1. 安装FFmpeg

# MacOS
brew install ffmpeg

# Windows (使用 Chocolatey)
choco install ffmpeg

# Linux
sudo apt install ffmpeg

2. 安装Node.js

需要Node.js 16+ 官网下载

3. 安装工具

npm install -g video-subtitle-cli

4. 下载 whisper 模型

npx whisper-node
``

## 使用方法 🚀

### 基本命令

```bash
video-subtitle -i input.mp4

完整选项

video-subtitle \
  -i <输入文件路径> \
  --model <模型名称> \  # 默认large-v3
  --embed \            # 嵌入字幕到视频(仅视频有效)
  --force              # 跳过缓存,强制重新生成

常用示例

  1. 为视频生成字幕:
video-subtitle -i sample.mp4
  1. 使用base模型快速生成:
video-subtitle -i lecture.mp3 --model base
  1. 嵌入字幕到视频:
video-subtitle -i demo.mkv --embed
  1. 强制重新生成所有文件:
video-subtitle -i interview.mp4 --force

参数说明 ⚙️

| 参数 | 描述 | 默认值 | |-------------|----------------------|-----------| | -i, --input | 输入文件路径(必须) | 无 | | -m, --model | Whisper模型 | large-v3 | | -e, --embed | 嵌入字幕到视频 | false | | -f, --force | 强制重新生成 | false |

文件结构 📂

处理完成后会在output/目录生成:

output/
└── 输入文件名/
    ├── 文件名.srt         # 字幕文件
    ├── 文件名.json       # 完整识别结果
    └── 文件名_with_subs.mp4  # 带字幕视频(使用--embed时生成)

常见问题 ❓

Q: 支持哪些语言?
A: 支持中文、英语、日语等多语言识别,自动检测输入语言。

Q: 如何选择模型?
A: 可用模型:tiny, base, small, medium, large-v3。模型越大精度越高,但速度越慢。

Q: 处理时间多久?
A: 取决于硬件配置,1分钟视频大约需要:

  • base模型:~30秒
  • large-v3模型:~2分钟

技术支持 💻

遇到问题请提交issue: GitHub Issues


License: MIT
Version: 1.0.0
Author: Conan