video-understand
Verstehe Videoinhalte lokal mit ffmpeg zur Frame-Extraktion und Whisper zur Transkription. Vollständig offline, keine API-Schlüssel erforderlich.
Voraussetzungen
ffmpeg+ffprobe(erforderlich):brew install ffmpegopenai-whisper(optional, für Transkription):pip install openai-whisper
Befehle
# Szenenerkennung + Transkription (Standard)
python3 skills/video-understand/scripts/understand_video.py video.mp4
# Keyframe-Extraktion
python3 skills/video-understand/scripts/understand_video.py video.mp4 -m keyframe
# Regelmäßige Intervall-Extraktion
python3 skills/video-understand/scripts/understand_video.py video.mp4 -m interval
# Begrenzung der extrahierten Frames
python3 skills/video-understand/scripts/understand_video.py video.mp4 --max-frames 10
# Verwendung eines größeren Whisper-Modells
python3 skills/video-understand/scripts/understand_video.py video.mp4 --whisper-model small
# Nur Frames, keine Transkription
python3 skills/video-understand/scripts/understand_video.py video.mp4 --no-transcribe
# Lautloser Modus (nur JSON, keine Fortschrittsmeldungen)
python3 skills/video-understand/scripts/understand_video.py video.mp4 -q
# Ausgabe in Datei
python3 skills/video-understand/scripts/understand_video.py video.mp4 -o result.json
CLI-Optionen
| Flag | Beschreibung |
|---|---|
video | Eingabevideodatei (positional, erforderlich) |
-m, --mode | Extraktionsmodus: scene (Standard), keyframe, interval |
--max-frames | Maximale Anzahl zu behaltender Frames (Standard: 20) |
--whisper-model | Whisper-Modellgröße: tiny, base, small, medium, large (Standard: base) |
--no-transcribe | Überspringe Audio-Transkription, extrahiere nur Frames |
-o, --output | Schreibe Ergebnis-JSON in Datei anstatt auf stdout |
-q, --quiet | Unterdrücke Fortschrittsmeldungen, gib nur JSON aus |
Extraktionsmodi
| Modus | Funktionsweise | Am besten geeignet für |
|---|---|---|
scene | Erkennt Szenenwechsel via ffmpeg select='gt(scene,0.3)' | Die meisten Videos, abwechslungsreiche Inhalte |
keyframe | Extrahiert I-Frames (Codec-Keyframes) | Codierte Videos mit natürlicher Keyframe-Platzierung |
interval | Gleichmäßig verteilte Frames basierend auf Dauer und max-frames | Feste Abtastung, vorhersagbare Ausgabe |
Wenn der scene-Modus keine Szenenwechsel erkennt, fällt er automatisch auf den interval-Modus zurück.
Ausgabe
Das Skript gibt JSON auf stdout aus (oder in eine Datei mit -o). Siehe references/output-format.md für das vollständige Schema.
{
"video": "video.mp4",
"duration": 18.076,
"resolution": {"width": 1224, "height": 1080},
"mode": "scene",
"frames": [
{"path": "/abs/path/frame_0001.jpg", "timestamp": 0.0, "timestamp_formatted": "00:00"}
],
"frame_count": 12,
"transcript": [
{"start": 0.0, "end": 2.5, "text": "Hello and welcome..."}
],
"text": "Full transcript...",
"note": "Use the Read tool to view frame images for visual understanding."
}
Verwende das Read-Tool für Frame-Bildpfade, um extrahierte Frames visuell zu inspizieren.
Referenzen
references/output-format.md-- Vollständige Dokumentation des JSON-Ausgabeschemas