Polli video

From pollinations/pollinations · View interactive version

Polli video is an AI agent skill from the GitHub repository pollinations/pollinations. Record terminal demo videos of the polli CLI using VHS (charmbracelet) with polli-generated voiceover and background music. Ships a working `example/demo.tape` + `example/render.sh` pipeline. Use when the user asks to make, record, or iterate on a polli demo video, LinkedIn/social clip of the CLI, o

How to use this skill

Skill file

polli-video — record polli CLI demos

VHS records silent terminal video. Polli generates audio. ffmpeg merges. VHS cannot capture system audio — either capture it live via BlackHole, or overlay narration in post with adelay.

When to use

Quick start

mkdir -p temp/vhs-demo && cp .claude/skills/polli-video/example/* temp/vhs-demo/
cd temp/vhs-demo
# Set system default output → BlackHole 2ch (see Pipeline A)
./render.sh

Produces demo.mp4. Edit demo.tape to change content.

Pipeline A — BlackHole live capture (recommended)

Single command, no adelay math, perfect sync. Requires BlackHole 2ch and default system output set to it (Option+click menu-bar speaker, or SwitchAudioSource -s "BlackHole 2ch").

See example/render.sh — archives old renders, captures while VHS runs, muxes trimmed to video length with a 5s audio pre-roll shift (ffmpeg startup + API roundtrip offset) and a 3s audio fade-out at the end. Copy and adapt.

Capture tool: sox over ffmpeg avfoundation. ffmpeg dropped samples on long recordings (choppy audio) even with -thread_queue_size 4096, -async 1, nice -20. sox + coreaudio is stable end-to-end, addresses device by name ("BlackHole 2ch") instead of a flaky index, and needs no post-trim:

AUDIODRIVER=coreaudio sox -q -c 2 -r 48000 -t coreaudio "BlackHole 2ch" \
    -c 2 -r 48000 -b 16 captured.wav 2>/tmp/sox-capture.log &

Music gen must use --play so BlackHole captures it. Switch default output back to Speakers after.

Pipeline B — post-hoc ffmpeg overlay (fallback)

When BlackHole unavailable. Pre-generate narration + music, overlay with manual timestamps:

vhs demo.tape   # produces demo-silent.mp4
ffmpeg -y -i demo-silent.mp4 -i speech.mp3 -i music.mp3 \
  -filter_complex "[1:a]adelay=16000|16000[narr]; \
                   [2:a]volume=0.18,atrim=end=75[bg]; \
                   [narr][bg]amix=inputs=2:duration=longest[a]" \
  -map 0:v -map "[a]" -c:v copy -c:a aac demo.mp4

adelay=16000|16000 = ms, left|right (must be stereo pair). Tune to tape timestamp where narration should hit. Ducking: 0.12–0.20 under narration, 0.25–0.35 music-only. Never pass -shortest — truncates video to shortest audio.

VHS tape conventions

Canonical bash Hide block (copy verbatim — fixes job notices, heredoc prompts, prompt trailing-line):

Set Shell "bash"
Hide
Type "cd /absolute/path/to/working/dir"
Enter
Type "export FORCE_COLOR=1"
Enter
Type "export PS1='» '"
Enter
Type "export PS2='» '"
Enter
Type "PROMPT_COMMAND='echo'"
Enter
Type "set +m"
Enter
Type "clear"
Enter
Show

The `announce` function

One-liner per scene: prints a bold purple title AND fires backgrounded TTS. The sed strip removes ElevenLabs emotion cues ([whispers], [excited], …) from the printed title while keeping them in the spoken audio.

announce() {
  printf '\n\033[1;38;5;141m»» %s\033[0m\n\n' "$(sed -E 's/\[[^]]*\] *//g' <<< "$1")"
  ( polli gen audio --play --output /tmp/narr-$$-$RANDOM.mp3 "$1" >/dev/null 2>&1 & )
}

Usage:

Type `announce "[excited] first — we need some backing music"`
Enter

ElevenLabs emotion cues (must use ElevenLabs-backed voice, e.g. default sage): [whispers], [excited], [confident], [curious], [sighs], [laughs]. Place inline — the TTS engine interprets them; the sed strip keeps the on-screen text clean.

Why subshell ( cmd & ), not bare & or disown:

Gotchas

| Symptom | Cause | Fix |

|---|---|---|

| Two commands merge on one line, Enter eaten | zsh + long Type (ZLE race) | Set Shell "bash" |

| heredoc> or > prompts visible | Wrapped line, zsh/bash PROMPT2 | export PS2='» ' |

| [1] 12345 leaks on screen | Bash job-control notice | set +m + ( cmd & ) subshell |

| Scene collides with previous output | No trailing newline | PROMPT_COMMAND='echo' |

| Nested temp/vhs-demo/temp/vhs-demo/ | Absolute path in Output | Use relative; cd in Hide |

| Typing takes forever | Default TypingSpeed 50ms | Set 12–20ms |

| Colors stripped | VHS pty, no FORCE_COLOR | export FORCE_COLOR=1 |

| Font renders wrong | JetBrains Mono not on macOS | Use Menlo |

| FontSize >18 wraps prompts | 960 width | Stick with 16 |

| BG output corrupts next command | & with stdout live | cmd >/dev/null 2>&1 & |

| ↑ / multibyte char eats adjacent chars | VHS Type + Unicode edge case | Drop the arrow; use plain ASCII |

| Choppy/dropped audio in long capture | ffmpeg avfoundation | Use sox -t coreaudio "BlackHole 2ch" |

| Video only 2s long | -shortest on ffmpeg | Drop -shortest |

| No sound in final mp4 | Missing audio map | -map 0:v -map "[a]" |

| BlackHole not found by ffmpeg | Wrong device index | Use sox + device name instead |

| Disk fills during capture | Uncompressed wav, forgot to trap | trap "kill $FFPID" EXIT |

| Final MP4 narration lands too late | ffmpeg startup + API pre-roll | In mux: ffmpeg -ss 5 -i captured.wav … (tune 3–6s) |

| Music cuts abruptly at end | No fade filter | Add -af "afade=t=out:st=$((VID_DUR-3)):d=3" |

| afade filter errors No option name near '3' on st=66,36 | Locale uses comma for decimals | Wrap the awk computing FADE_START with LC_ALL=C |

| Punctuation/wording cached across renders | Pollinations text cache keys on exact string | Change a character (swap · ↔ ; ↔ ,, add !) each re-render |

Voice selection

Default: sage. Others: fin, callum, onyx, rachel. Preview:

polli gen audio --voice <name> --output sample.mp3 "test line" && afplay sample.mp3

Full list: polli models --type audio --json | jq '.[].voices'.

Music (elevenmusic)

Deterministic cache — same prompt+duration = same bytes. Always --instrumental. Match duration to ffprobe demo-silent.mp4. Example prompt: "lofi instrumental hip hop, warm analog, jazzy bass".

Demo design principles

Brand voice for generated content

See operations/news/prompts/posts/linkedin/tone.md, operations/news/prompts/brand/about.md.

Generating the announcement post (lessons)

Model selection (ranked for this task):

Call flags:

Input context (what to pipe in):

Prompt shape (compressed, declarative, no imperative wordiness):

Final prompt used (LinkedIn launch post):

↑ polli --help for polli CLI.
task: announce polli on LinkedIn. reformat this into a post.
voice: hacker-genz .nfo irc-drop · dry · emojis 🐝💾⚡🔮🧪👁️🌀 scattered
100-130w · sharp sign-off · no md · no 🚀 · no corpo

Pipe in via: polli --help | polli gen text --model claude-fast --no-stream "<prompt>".

For live tape renders (where a Sleep Xms must cover the call): use claude-fast — ~4s predictable. For offline post generation without timing constraints, glm gives slightly better voice but polli --help | polli gen text --model glm --no-stream … may take 10–60s.

Parallel batching gotcha: 3+ concurrent calls to the same model hit Cloudflare 520. Run sequentially for reliable batches.

Streaming outros (ASCII demoscene)

polli gen text streams by default — no animate helper or frame splitter needed. Pipe straight to the terminal and the characters appear as generated:

Type "clear"
Enter
Sleep 400ms
Type `polli gen text --model claude "ascii frame 50×20; spell POLLI big block letters centered. organic evolving mycelium decor — demoscene."`
Enter
Sleep 17000ms   # hold long enough for full generation + read time

Prompt engineering notes for ASCII wordmarks:

Layered emotion cues in announce()

ElevenLabs handles multiple [cue] markers in one line, changing tone mid-sentence. Useful for punchy payoff lines:

announce "[playful] confused? just ask your agent to [whispers] install me... [curious] install me? [excited] install me!!"

The sed strip removes all cues from the printed text, so the screen just shows »» confused? just ask your agent to install me... install me? install me!! while the audio layers whisper → curious → excited across three repetitions. The ... and ? / !! punctuation gives ElevenLabs natural beats to change register.

Files

Render artifacts (regenerable, gitignored): demo.mp4, demo-silent.mp4, captured.wav, music.mp3, speech.mp3. Previous renders are auto-archived to <base>-vHHMM.<ext> by render.sh.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.