clawvard-short-video
v0.1.1
Published
Topic → 1080×1920 vertical short MP4 — AI-written script (cv.llm.chat), AI voiceover (cv.media.voiceover w/ Edge-TTS fallback), Pexels stock B-roll, burned subtitles, ducked BGM. One Node CLI command.
Downloads
319
Maintainers
Readme
clawvard-short-video
A Node CLI that turns one topic into one 1080×1920 vertical short MP4 — AI-written script, AI voiceover, Pexels stock B-roll, burned subtitles, ducked BGM — in one command.
Built on top of @clawvard/sdk so script generation and voiceover stay on Clawvard's typed service surface; no OpenAI-compatible base URL leaks into your wrapper.
Install
npm install -g clawvard-short-video
# or run ad-hoc:
npx clawvard-short-video --helpPrerequisites on your machine:
- Node ≥ 18 (
node -v) ffmpegon PATH (macOS:brew install ffmpeg; Ubuntu/Debian:sudo apt install ffmpeg)- (optional fallback) Python 3 +
pip install --user edge-ttsfor local voiceover
Environment:
CLAW_API_KEY— mint at https://clawvard.school/token-relay. Required forcv.llm.chat(script) andcv.media.voiceover(narration).PEXELS_API_KEY— sign up free at https://www.pexels.com/api/. Required for stock-footage search.
Usage
npx clawvard-short-video \
--topic "为什么坚持早起的人,更容易抓到生活里隐藏的小确幸" \
--duration 60 \
--lang zh \
--voice cv:zh-female-warm \
--out ./output/short-earlybird.mp4You get back a JSON summary on stdout with the file path, voice source, captions, and Pexels source URLs for every clip used (for attribution).
What it does
- Script —
cv.llm.chatwrites a ~60-second spoken script: 3-second hook + 2–3 concrete visual moments + one short CTA. Stage directions / BGM cues are auto-stripped. - Voiceover —
cv.media.voiceoverrenders the script asmp3. If the platform TTS upstream returnsservice_unavailable(or 404/503), the wrapper falls back to local Edge-TTS (installed on demand). - Stock — searches the Pexels Videos API for B-roll matching keywords drawn from each script segment, prefers
orientation=portrait, and downloads the closest-to-1080×1920 file. - Subtitles — splits the script into ≤22-CJK-char (≤60 Latin) captions, proportionally allocates each caption a slice of the voice duration, and writes a standard
.srt. - Assemble —
ffmpegcrops every clip to 1080×1920, concatenates to the voice length, burns subtitles into the bottom safe area, mixes in a soft synth pad BGM (or your--bgm path.mp3), and sidechain-ducks the BGM under the voice.
Library use
The pipeline is also importable, so agent frameworks can drive it without spawning a subprocess:
import { runPipeline } from "clawvard-short-video"; // npm name (the @clawvard scope is reserved for our SDK packages)
const result = await runPipeline({
topic: "为什么坚持早起的人,更容易抓到生活里隐藏的小确幸",
out: "./output/short-earlybird.mp4",
lang: "zh",
voice: "cv:zh-female-warm",
duration: 60,
});Source
This package is the engineered wrapper for the Clawvard course topic-to-short. See it at https://clawvard.school/courses/topic-to-short.
Course design draws on the open-source MoneyPrinterTurbo workflow (MIT). The implementation is original — there is no upstream Python dependency to install.
License
Apache-2.0
