Package Exports
- generate-video
- generate-video/bin/generate-video.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 (generate-video) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
generate-video
Generate TikTok-style videos with voice, captions, and code overlays from text — one command.
Free TTS, animated captions, code overlays, custom colors. No API key needed.
Quick Start
npx generate-video "JavaScript closures explained in 30 seconds"Outputs a vertical .mp4 video (720x1280) with voiceover and animated captions.
Prerequisites
- Node.js >= 14
- Python 3 with pip (edge-tts + Pillow auto-install on first run)
- FFmpeg installed (
brew install ffmpeg/apt install ffmpeg)
Usage
Basic video
npx generate-video "Your script text here"With title and code overlay
npx generate-video "Closures capture variables from outer scope" \
--title "Closures 101" \
--code "function outer() {\n let x = 10;\n return () => x;\n}"Custom voice
npx generate-video "Bonjour le monde" --voice fr-FR-HenriNeural
npx generate-video "Hello world" --voice en-GB-SoniaNeuralAdjust speed and pitch
npx generate-video "Fast narration" --rate "+30%"
npx generate-video "Deep voice" --pitch "-5Hz"Custom output file
npx generate-video "Your text" --output my-video.mp4With logo
npx generate-video "Your text" --logo ./my-logo.pngUse existing audio
npx generate-video "Caption text for sync" --audio ./voiceover.mp3Custom colors
npx generate-video "Your text" --bg-color 1a1a2e --accent-color e94560Custom dimensions
# Landscape (YouTube)
npx generate-video "Your text" --width 1920 --height 1080
# Square (Instagram)
npx generate-video "Your text" --width 1080 --height 1080Disable captions
npx generate-video "Your text" --no-captionsPreview without generating
npx generate-video "Your text" --dry-runBrowse voices
npx generate-video --voices
npx generate-video --voices --lang en
npx generate-video --voices --lang frOptions
| Flag | Description | Default |
|---|---|---|
-v, --voice <name> |
TTS voice | en-US-GuyNeural |
-o, --output <file> |
Output path | Auto-generated |
-t, --title <text> |
Title overlay | — |
-c, --code <text> |
Code box overlay | — |
--logo <path> |
Logo image (PNG) | — |
--audio <path> |
Existing audio file | — |
-r, --rate <rate> |
Speech rate (+20%, -10%) |
Normal |
-p, --pitch <pitch> |
Voice pitch (+5Hz) |
Normal |
--width <px> |
Video width | 720 |
--height <px> |
Video height | 1280 |
--fps <n> |
Frames per second | 30 |
--bg-color <hex> |
Background color | 0f172a |
--accent-color <hex> |
Accent bar color | 7c3aed |
--no-captions |
Disable captions | — |
--voices |
List TTS voices | — |
-l, --lang <code> |
Filter voices | — |
--dry-run |
Preview only | — |
How It Works
- edge-tts generates voice audio with word-level timestamps (free Microsoft TTS)
- Pillow renders the background frame with title, code box, and logo
- Pillow renders animated caption frames synced to word timings
- FFmpeg composites everything into a final video (piped raw frames)
License
MIT