Package Exports
- subchunk
- subchunk/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (subchunk) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
subchunk
Convert ElevenLabs transcript JSON into clean, readable subtitles (.srt / .vtt).
π¨ Problem
ElevenLabs provides SRT exports, but they often look like this:
1
00:00:00,000 --> 00:00:05,000
This is a very long subtitle line that contains too many words and is hard to read quickly.β Issues:
- Subtitles are too long
- Poor readability
- Weak alignment with speech timing
- Not optimized for modern content (Reels, Shorts, YouTube)
β Solution
ElevenLabs JSON includes word-level timestamps β this tool uses that to generate high-quality subtitles:
β Short, readable chunks
β Pause-aware timing
β Smart sentence splitting
β Multi-line subtitles (2 lines max)
β Speaker labels (optional)
β .srt and .vtt support
β¨ Example Output
1
00:00:00,460 --> 00:00:01,160
Three minutes.
2
00:00:01,200 --> 00:00:02,400
Thatβs all it takes
to get started.βοΈ Features
π― Smart chunking (punctuation + pauses + word limits)
π§ Human-friendly subtitle splitting
πͺΆ Lightweight & fast (Bun-powered)
π¬ Presets for different content styles:
reels(short captions)youtubepodcast
π£ Speaker labels support
π Multiple formats (
.srt,.vtt)π‘ Robust error handling
π¦ Installation
Run instantly
bunx subchunk input.json -o output.srtInstall globally
bun install -g subchunkπ Usage
subchunk <input.json> [options]π§ Options
| Flag | Description | Default |
|---|---|---|
-o, --output |
Output file | output.srt |
--format |
srt or vtt |
srt |
--maxWords |
Max words per subtitle | 8 |
--gap |
Pause threshold (seconds) | 0.8 |
--speaker |
Include speaker labels | false |
--preset |
reels, youtube, podcast |
β |
π― Presets
| Preset | Use Case | Behavior |
|---|---|---|
reels |
Shorts / TikTok | Very short captions |
youtube |
General videos | Balanced |
podcast |
Long conversations | Longer subtitles |
Example:
subchunk input.json --preset reelsπ Input Format (ElevenLabs JSON)
{
"segments": [
{
"text": "Three minutes.",
"words": [
{
"text": "Three",
"start": 0.46,
"end": 0.66,
"type": "word"
}
]
}
]
}π§ How It Works
Extracts words from
segments[].words[]Detects:
- sentence endings (
. ? !) - pauses in speech
- word limits
- sentence endings (
Groups words into natural subtitle chunks
Formats into
.srtor.vtt
π§ͺ Examples
# basic
subchunk input.json
# reels (short captions)
subchunk input.json --preset reels
# include speaker labels
subchunk input.json --speaker
# VTT format
subchunk input.json --format vtt
# custom tuning
subchunk input.json --maxWords 6 --gap 0.5π― Why This Matters
Good subtitles are critical for:
- Viewer retention π
- Accessibility βΏ
- Mobile-first content π±
This tool helps you generate modern, readable captions instead of outdated long blocks.
π License
MIT