Skip to content
Skillv1.0.0

ffmpeg

Safety rules and decision logic for media processing with ffmpeg/ffprobe via shell — inspect, convert, trim, merge, resize, compress, extract frames/audio, GIFs, subtitles, overlays. Condensed from gr

by Matrixx0070(0) 0 installs
Free
Sign in to install

Free account. Installing gives you the manifest plus copy-paste snippets.

See reviews

About

Imported from Matrixx0070/sudo-ai (skills/ffmpeg/SKILL.md). Install upstream with npx skills add Matrixx0070/sudo-ai --skill ffmpeg. Copyright stays with the author.

ffmpeg — agent safety rules + decision logic

Full recipes: skills/ffmpeg/references/recipes.md (concat, remux, audio replace, GIF palette, subtitles, overlays, slideshows). Extended doc: skills/ffmpeg/references/FULL_SKILL.md. Read them for anything beyond the core moves below.

Safety policy (always)

  • No-overwrite default: use -n; only -y when the user explicitly asks to overwrite. Never delete the input unless explicitly requested.
  • Temp-file workflow: write to ${OUT%.*}.tmp.${OUT##*.}, verify with ffprobe -v error, then mv into place.
  • Quote every path. Local files only — never pass user-supplied URLs to ffmpeg/ffprobe.
  • After producing output, verify with ffprobe (exists + streams sane), and clean up temp files.

Inspect first

Probe unknown media before any complex operation:

ffprobe -v error -show_format -show_streams -of json "$INPUT"

Decision: copy vs re-encode

  • -c copy (fast, lossless) when only trimming on keyframes, remuxing containers, or concatenating files with IDENTICAL codecs/resolution/fps.
  • Re-encode when changing resolution/fps/codec, applying filters, needing frame-accurate cuts, or concatenating mismatched inputs.
  • Audio: keep AAC as-is (-c:a copy); re-encode other codecs to AAC for MP4.

Web-compatible MP4 defaults

ffmpeg -n -i "$INPUT" -c:v libx264 -preset medium -crf 23 \
  -pix_fmt yuv420p -movflags +faststart -c:a aac -b:a 128k "$OUTPUT"

Core moves

# Concat, identical codecs (else re-encode per recipes.md):
printf "file '%s'\n" /abs/a.mp4 /abs/b.mp4 > /tmp/list.txt
ffmpeg -n -f concat -safe 0 -i /tmp/list.txt -c copy "$OUTPUT"

# Trim (frame-accurate, re-encode):
ffmpeg -n -ss 00:00:05 -to 00:00:12 -i "$INPUT" -c:v libx264 -c:a aac "$OUTPUT"

# Resize to width 1280 (height auto, even):
ffmpeg -n -i "$INPUT" -vf "scale=1280:-2" -c:a copy "$OUTPUT"

# Single frame at 3s:
ffmpeg -n -ss 3 -i "$INPUT" -frames:v 1 "$OUTPUT.jpg"

# Extract audio without re-encoding (match container to codec):
ffmpeg -n -i "$INPUT" -vn -c:a copy "$OUTPUT.m4a"

Common failure modes

  • Concat artifacts/desync → inputs weren't identical; re-encode instead of -c copy.
  • "height/width not divisible by 2" → use -2 in scale expressions.
  • No audio in output → check -map; ffmpeg keeps only one stream per type by default.
  • Player won't open MP4 → missing yuv420p/faststart (see defaults above).

Agent behavior

  • State what the command will do in one line before running it.
  • Prefer one ffmpeg invocation over chains; avoid needless generational re-encodes.
  • sudo-ai also has media.video-edit (structured cut/trim/merge) — prefer it for simple cases; drop to raw ffmpeg for anything it doesn't cover.

Use it

Copy one of these into your project. Installing also returns the manifest and these snippets.

yaml
targets:
  - https://api.opensmartroute.ai/api/v1/registry/matrixx0070-sudo-ai-ffmpeg/manifest   # or paste the manifest below

Manifest

An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.

matrixx0070-sudo-ai-ffmpeg.ocm.jsonjson
{
  "ocm": "1",
  "id": "matrixx0070-sudo-ai-ffmpeg",
  "kind": "skill",
  "name": "ffmpeg",
  "description": "Safety rules and decision logic for media processing with ffmpeg/ffprobe via shell — inspect, convert, trim, merge, resize, compress, extract frames/audio, GIFs, subtitles, overlays. Condensed from grok's ffmpeg skill; full recipes in references/.",
  "publisher": "Matrixx0070",
  "version": "1.0.0",
  "capabilities": {
    "domains": [
      "general"
    ],
    "tags": [
      "skill-md",
      "ffmpeg",
      "video",
      "audio",
      "media-processing",
      "github"
    ],
    "languages": [
      "en"
    ]
  },
  "quality_prior": 0.6,
  "examples": [
    "Safety rules and decision logic for media processing with ffmpeg/ffprobe via shell — inspect, convert, trim, merge, resize, compress, extract frames/audio, GIFs, subtitles, overlays. Condensed from grok's ffmpeg skill; full recipes in references/."
  ],
  "primary": false,
  "metadata": {
    "source": {
      "provider": "github",
      "repository": "https://github.com/Matrixx0070/sudo-ai",
      "path": "skills/ffmpeg/SKILL.md",
      "ref": "e1ab8f5ef8ccaf6396265f30a5c474f38f449295",
      "url": "https://github.com/Matrixx0070/sudo-ai/blob/e1ab8f5ef8ccaf6396265f30a5c474f38f449295/skills/ffmpeg/SKILL.md",
      "key": "Matrixx0070/sudo-ai/skills/ffmpeg/SKILL.md"
    }
  },
  "instructions": "# ffmpeg — agent safety rules + decision logic\n\nFull recipes: `skills/ffmpeg/references/recipes.md` (concat, remux, audio\nreplace, GIF palette, subtitles, overlays, slideshows). Extended doc:\n`skills/ffmpeg/references/FULL_SKILL.md`. Read them for anything beyond the\ncore moves below.\n\n## Safety policy (always)\n\n- **No-overwrite default**: use `-n`; only `-y` when the user explicitly asks\n  to overwrite. Never delete the input unless explicitly requested.\n- **Temp-file workflow**: write to `${OUT%.*}.tmp.${OUT##*.}`, verify with\n  `ffprobe -v error`, then `mv` into place.\n- Quote every path. L",
  "cost": {
    "context_tokens": 694
  }
}

Fetch it by URL: GET /api/v1/registry/matrixx0070-sudo-ai-ffmpeg/manifest?version=1.0.0

Reviews

Star ratings from people who tried it. One review per account; edit yours any time.

No reviews yet. Install it, try it, and be the first to rate it.