Skip to content

iart-ai/b-roll-skills / skills/talking-head-b-roll

talking-head-b-roll

Verified

Add b-roll motion graphics to a talking-head video. Transcribes the recording with word timings, decides line by line when the speaker is shown, when a graphic is laid over them and when a full-frame graphic covers them, draws each graphic from what is actually said (numbers, comparisons, steps, key words) in JavaScript on a canvas, and renders the finished MP4 with the original sound, plus the b-roll alone with alpha for an editor. Use when someone has a recording of a person talking to camera (a talking head, a spoken explainer, a course lesson, an ad read, a podcast clip) and wants it more engaging to watch, wants b-roll, or wants motion graphics added to it.

FileKindSize
SKILL.mdskill md10.4 KB
scripts/compare-timing.pyscript3.1 KB
scripts/render.mjsscript22.1 KB
scripts/timing.test.mjsscript3.5 KB
scripts/transcribe.mjsscript10.9 KB
templates/b-roll.htmlother12.0 KB

scripts/compare-timing.py

View on GitHub
#!/usr/bin/env python3
"""Compare a checked baseline alpha layer against a six-frame visual lead.

Usage: python3 compare-timing.py talk.mp4 b-roll.mov output-directory
Requires ffmpeg and ffprobe. The layer must be aligned to recording time zero.
"""
import hashlib
import json
from fractions import Fraction
from pathlib import Path
import subprocess
import sys


def probe(path):
    return json.loads(subprocess.check_output([
        'ffprobe', '-v', 'error', '-show_streams', '-show_format', '-of', 'json', str(path),
    ]))


def audio_hash(path):
    return hashlib.sha256(subprocess.check_output([
        'ffmpeg', '-v', 'error', '-i', str(path), '-map', '0:a:0',
        '-c:a', 'copy', '-f', 'data', '-',
    ])).hexdigest()


if len(sys.argv) != 4:
    sys.exit(__doc__)
source, layer, out = map(lambda p: Path(p).resolve(), sys.argv[1:])
src, alpha = probe(source), probe(layer)
video = next(s for s in alpha['streams'] if s['codec_type'] == 'video')
fps = Fraction(video['r_frame_rate'])
source_video = next(s for s in src['streams'] if s['codec_type'] == 'video')
if Fraction(source_video['r_frame_rate']) != fps:
    sys.exit('Recording and layer must have the same frame rate.')
if (source_video['width'], source_video['height']) != (video['width'], video['height']):
    sys.exit('Recording and layer must have the same dimensions.')
if not video.get('pix_fmt', '').startswith(('yuva', 'rgba', 'bgra', 'gbrap')):
    sys.exit('Use an alpha layer such as ProRes 4444, not a flattened film.')
duration = float(src['format']['duration'])
if abs(float(alpha['format']['duration']) - duration) > 1 / float(fps):
    sys.exit('Layer and recording must have matching durations.')
if not any(s['codec_type'] == 'audio' for s in src['streams']):
    sys.exit('A spoken recording with audio is required.')
out.mkdir(parents=True, exist_ok=True)
records = []
original_audio = audio_hash(source)
for name, frames in [('baseline', 0), ('lead-6f', 6)]:
    dest = out / f'{name}.mp4'
    graph = (
        f'[1:v]trim=start_frame={frames},setpts=PTS-STARTPTS[g];'
        '[0:v][g]overlay=eof_action=pass:repeatlast=0:format=auto,format=yuv420p[v]'
    )
    subprocess.run([
        'ffmpeg', '-v', 'error', '-n', '-i', str(source), '-i', str(layer),
        '-filter_complex', graph, '-map', '[v]', '-map', '0:a:0',
        '-c:v', 'libx264', '-crf', '18', '-preset', 'fast', '-c:a', 'copy',
        '-t', str(duration), '-movflags', '+faststart', str(dest),
    ], check=True)
    result = probe(dest)
    assert audio_hash(dest) == original_audio, 'Audio changed'
    assert abs(float(result['format']['duration']) - duration) <= 1 / float(fps), 'Duration changed'
    records.append({'file': dest.name, 'leadFrames': frames, 'leadSeconds': frames / float(fps),
                    'audioPacketsUnchanged': True, 'duration': float(result['format']['duration'])})
    print(f'Created {dest}', flush=True)
(out / 'results.json').write_text(json.dumps({
    'source': str(source), 'layer': str(layer), 'layerFps': str(fps),
    'scope': 'Whole visual layer shifted; audio unchanged. Not a viewer preference result.',
    'variants': records,
}, indent=2) + '\n')
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall