agentleFS
sennaBrunosennaBruno/claude-skills/skills/video-to-context/SKILL.md

video-to-context

Skill1 starsChanged 8 months agoApache-2.0View on GitHub

Use when the user shares a screen recording, demo video, or bug reproduction video and you need to understand what happens in it. Extracts speech transcript (via Whisper GPU) and key frames (via ffmpeg) into a markdown document you can read directly. Symptoms: user mentions video, screen recording, .mov/.mp4 file, or asks you to watch/analyze a recording.

  • Installs packages

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Run this to install the transcription stack:

    line 36
  2. Very specific:

    Ensure ~/.local/bin is in PATH, or create a symlink:

    line 64
  3. Very specific:

    Read the .txt transcript first for the full narrative

    line 115
  4. Very specific:

    Read specific frames (.jpg) when you need to see what was on screen at a given moment

    line 116

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Video-to-Context: Extract full context from videos

Turn screen recordings into readable context (transcript + key frames) so you can understand what happened without watching the video.

When to use

  • User shares a screen recording from a Jira card, Slack, or bug report
  • You need to understand both what's shown on screen AND what's being said
  • Video is in .mov, .mp4, .webm, or similar format

Requirements

  • ffmpeg (frame extraction)
  • whisper-ctranslate2 with CUDA (speech-to-text) -- see setup below
  • NVIDIA GPU with CUDA drivers (CPU fallback possible but slow)
  • uv package manager

Setup (one-time)

Run this to install the transcription stack:

#!/bin/bash
set -euo pipefail

VENV="$HOME/.local/share/video-tools"

# Create isolated venv
uv venv "$VENV" --python 3.12

# Install whisper + CUDA libs
VIRTUAL_ENV="$VENV" uv pip install whisper-ctranslate2 nvidia-cublas-cu12 nvidia-cudnn-cu12

# Create wrapper that sets CUDA library paths
mkdir -p "$HOME/.local/bin"
cat > "$HOME/.local/bin/whisper-gpu" << 'SCRIPT'
#!/bin/bash
VENV="$HOME/.local/share/video-tools"
export LD_LIBRARY_PATH="$VENV/lib/python3.12/site-packages/nvidia/cublas/lib:$VENV/lib/python3.12/site-packages/nvidia/cudnn/lib:${LD_LIBRARY_PATH:-}"
exec "$VENV/bin/whisper-ctranslate2" "$@"
SCRIPT
chmod +x "$HOME/.local/bin/whisper-gpu"

# Verify
whisper-gpu --help &>/dev/null && echo "Ready." || echo "Setup failed."

Ensure ~/.local/bin is in PATH, or create a symlink:

sudo ln -sf ~/.local/bin/whisper-gpu /usr/local/bin/whisper-gpu

Extraction process

Step 1: Transcribe audio

whisper-gpu "$VIDEO" \
  --model large-v3 \
  --language en \
  --device cuda \
  --compute_type int8_float16 \
  --output_format all \
  --output_dir "$OUTDIR" \
  --word_timestamps True \
  --vad_filter True \
  --batched True \
  --batch_size 8

This produces .txt (plain transcript), .srt (timestamped), and .json (word-level timestamps).

For non-English videos, change --language or remove it for auto-detection.

Step 2: Extract scene-change frames

ffmpeg -y -i "$VIDEO" \
  -vf "select='gt(scene,0.3)',scale=1280:-1,drawtext=text='%{pts\:hms}':fontsize=24:fontcolor=white:box=1:boxcolor=black@0.7:x=w-tw-10:y=h-th-10" \
  -vsync vfr -q:v 3 \
  "$OUTDIR/frames/scene_%04d.jpg"

The scene>0.3 threshold catches major visual changes (page navigations, modal opens, screen switches). Timestamps are burned into each frame's bottom-right corner.

Step 3: Extract interval frames (every 5s)

ffmpeg -y -i "$VIDEO" \
  -vf "fps=1/5,scale=1280:-1,drawtext=text='%{pts\:hms}':fontsize=24:fontcolor=white:box=1:boxcolor=black@0.7:x=w-tw-10:y=h-th-10" \
  -q:v 3 \
  "$OUTDIR/frames/interval_%04d.jpg"

Interval frames fill gaps where no scene change was detected but something relevant might still be happening.

Step 4: Read the output

  1. Read the .txt transcript first for the full narrative
  2. Read specific frames (.jpg) when you need to see what was on screen at a given moment
  3. Cross-reference .srt timestamps with frame timestamps to match speech to visuals

Gotcha: macOS filenames with Unicode spaces

macOS screen recordings use U+202F (NARROW NO-BREAK SPACE) instead of regular spaces in filenames. If your file isn't found, try:

# Rename to regular spaces
find "$DIR" -maxdepth 1 -name "Screen*Recording*" -exec bash -c '
  NEW=$(echo "$1" | sed "s/\xe2\x80\xaf/ /g")
  [ "$1" != "$NEW" ] && mv "$1" "$NEW"
' _ {} \;

Or add a glob fallback in your script:

if [ ! -f "$VIDEO" ]; then
  RESOLVED=$(find "$(dirname "$VIDEO")" -maxdepth 1 \
    -name "$(basename "$VIDEO" | sed 's/ /*/g')" -print -quit 2>/dev/null)
  [ -n "$RESOLVED" ] && VIDEO="$RESOLVED"
fi

Output structure

video_context/
  context.md          # Transcript + frame list (read this first)
  recording.txt       # Plain transcript
  recording.srt       # Timestamped transcript
  recording.json      # Word-level timestamps
  frames/
    scene_0001.jpg    # Scene-change frames (timestamps burned in)
    scene_0002.jpg
    interval_0001.jpg # Every-5s frames (timestamps burned in)
    interval_0002.jpg

Quick reference

WhatCommand/FlagNotes
Whisper modellarge-v3Best accuracy. Use medium for speed.
Quantizationint8_float16Good for 8GB VRAM GPUs (e.g. RTX 4060)
Scene thresholdgt(scene,0.3)Lower = more frames. 0.3 is a good default.
Frame intervalfps=1/5Every 5 seconds. Change denominator as needed.
CPU fallback--device cpuWorks but 10-20x slower than CUDA
Output formats--output_format allGets txt, srt, json, vtt, tsv at once
VAD filter--vad_filter TrueSkips silence, improves accuracy
Batched mode--batched TrueFaster on GPU, uses more VRAM

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.