DEV Community

Boehner
Boehner

Posted on

I Built a Fully Automated AI News Video Pipeline for $0 Per Video (Here's the Stack)

Every morning, a cron job wakes up on my machine, researches today's top AI news, writes a broadcast-quality script, generates a professional voiceover, downloads relevant b-roll footage, assembles a 1080p video, and uploads it to YouTube automatically.

Total cost per video: about $0.002.

The Stack

  • Research: Brave Search API (free tier)
  • Script: Claude Haiku (~$0.0004/script)
  • Voice: ElevenLabs ($5/month)
  • B-roll: Pexels Video API (free)
  • Assembly: FFmpeg (free)
  • Upload: YouTube Data API v3 (free)
  • Orchestration: Node.js + cron

Step 1: Research

javascript
const SEARCH_QUERIES = [
'AI news today 2026',
'artificial intelligence breakthrough this week',
'AI startup funding announcement today',
];

We hit the Brave News Search API, deduplicate, and save the top 10 stories.

Step 2: Script Generation with Claude Haiku

The first version used local Llama for scripts. The output was terrible - stage directions, unnatural pacing, headers like Hook (15 seconds) getting read aloud by the TTS engine.

Switching to Claude Haiku fixed everything instantly. Cost per script: $0.0004.

`javascript
const prompt = You are the scriptwriter for AIWireDaily.

RULES:

  • Write ONLY the words to be spoken aloud
  • NO stage directions, NO headers, NO asterisks
  • Natural broadcast anchor voice
  • 350-450 words total; `

Step 3: ElevenLabs Voiceover

$5/month for 30k characters - about 12 videos/month. Use eleven_turbo_v2 for speed and quality.

Step 4: Synced B-roll Timing

The key insight: sync footage to actual voiceover timing using word count:

javascript
const wordsPerSec = totalWords / totalDuration;
const storyDurations = storyParas.map(p =>
Math.max(5, p.split(/\s+/).length / wordsPerSec)
);

Then search Pexels with per-story keywords - drone footage for drone stories, office footage for business stories.

Step 5: FFmpeg Assembly

Key learning: use execFileSync with args as an array instead of execSync with a shell string. If your path has apostrophes or spaces, shell escaping breaks FFmpeg filter strings.

For the Short:

bash
ffmpeg -i input.mp4 -t 59 \
-vf scale=1920:1080,crop=1920:1080,scale=1080:1920,crop=1080:1920 \
short.mp4

What It Costs Per Video

Component Cost
Brave Search Free
Claude Haiku script $0.0004
ElevenLabs voice $0.17
Pexels + YouTube Free
Total ~$0.17/video

The Result

Channel: AIWireDaily on YouTube

The video that prompted this post: Anthropic Just Mapped the Jobs AI Is Replacing First

The core insight: don't skimp on script generation. The 0.4 cents on Claude Haiku vs running local Llama is the most important cost in the whole pipeline.

Top comments (0)