Skip to content

gooseworks-ai/goose-skills / skills/video/stitch-videos-ffmpeg

stitch-videos-ffmpeg

Verified

Stitch video segments with ffmpeg concat, xfade, overlay, audio mux, and export settings, and trim a source into named clips at exact windows (trim_clips.py). Ships montage.py, a free montage assembler (python3 + ffmpeg, no keys). It takes a JSON EDL of clips and stills, normalizes them and hard-cuts them in order, burns captions from an SRT, a cue list or word timings, and lays a VO over a music bed that ducks under it, mastered to -14 LUFS.

FileKindSize
SKILL.mdskill md13.4 KB
scripts/composite.pyexecutablescript4.8 KB
scripts/composite_final.pyexecutablescript3.5 KB
scripts/composite_final.shexecutablescript295 B
scripts/montage.pyexecutablescript49.3 KB
scripts/normalize_clip.shexecutablescript668 B
scripts/trim_clips.pyexecutablescript7.1 KB
scripts/voiceless/composite.pyscript4.5 KB
skill.meta.jsonconfig190 B
tests/expected-output.mdmarkdown300 B
tests/human-test.mdmarkdown853 B
tests/sample-input.mdmarkdown568 B
tests/smoke-test.mdmarkdown642 B
tests/test_stitch_montage.pyscript18.1 KB
tests/test_trim_clips.pyscript2.2 KB

tests/test_trim_clips.py

View on GitHub
"""scripts/trim_clips.py cuts the windows it is asked for (free: local ffmpeg only, no network).

Run: python3 -m pytest skills/video/stitch-videos-ffmpeg/tests -q
"""
import json
import shutil
import subprocess
import sys
from pathlib import Path

import pytest

SCRIPT = Path(__file__).resolve().parent.parent / "scripts" / "trim_clips.py"
FRAME = 1 / 30

pytestmark = pytest.mark.skipif(not (shutil.which("ffmpeg") and shutil.which("ffprobe")),
                                reason="ffmpeg/ffprobe not installed")


def duration(path):
    out = subprocess.run(["ffprobe", "-v", "error", "-show_entries", "format=duration",
                          "-of", "default=nw=1:nk=1", str(path)], capture_output=True, text=True, check=True)
    return float(out.stdout)


def test_cuts_each_window_and_records_bad_specs(tmp_path):
    src = tmp_path / "src.mp4"
    subprocess.run(["ffmpeg", "-y", "-hide_banner", "-loglevel", "error",
                    "-f", "lavfi", "-i", "testsrc=size=160x284:rate=30:duration=4",
                    "-f", "lavfi", "-i", "sine=frequency=440:duration=4",
                    "-c:v", "libx264", "-pix_fmt", "yuv420p", "-c:a", "aac", "-shortest", str(src)], check=True)
    clips = tmp_path / "clips.json"
    clips.write_text(json.dumps([
        {"name": "Hook Shot", "start": 0.5, "end": 2.0},
        {"name": "middle", "start": "00:02", "duration": 1},
        {"name": "backwards", "start": 1, "end": 0.5},
        {"name": "tail", "start": 3.5, "duration": 2},
    ]))
    out = tmp_path / "out"
    proc = subprocess.run([sys.executable, str(SCRIPT), "--source", str(src), "--clips", str(clips),
                           "--output-dir", str(out)], capture_output=True, text=True)
    assert proc.returncode == 0, proc.stderr

    assert abs(duration(out / "hook-shot.mp4") - 1.5) <= 2 * FRAME
    assert abs(duration(out / "middle.mp4") - 1.0) <= 2 * FRAME
    assert not (out / "backwards.mp4").exists()

    manifest = json.loads((out / "manifest.json").read_text())
    assert manifest["status"] == "needs human review"
    assert any(e.startswith("backwards:") for e in manifest["errors"])
    assert any(w.startswith("tail:") and "past the end" in w for w in manifest["warnings"])
receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementationStars: 323kUpdated Claude CodeCodexVerifiedInstall
requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirementsStars: 323kUpdated Claude CodeCodexVerifiedInstall
using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallbackStars: 323kUpdated Claude CodeCodexVerifiedInstall
verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions alwaysStars: 323kUpdated Claude CodeCodexVerifiedInstall