Media Converter

Media Converter is a free agent skill maintained by Scopeful. It teaches an AI coding agent such as Claude Code, Cursor, Windsurf or Codex how to drive this tool correctly, so you do not have to re-explain it every session. Every published Scopeful skill is free and the install command is public, with no sign-in required. Scopeful also tracks hand-verified USD pricing for 39 AI creative tools at https://www.scopeful.org/tools.

Convert, compress, resize, or trim video, audio, and image files.

Tags: video, audio, image, ffmpeg

Reference


name: media-converter description: Use this skill whenever the user wants to convert, compress, resize, trim, or transform video, audio, or image files. Triggers include "compress this video", "convert mov to mp4", "make this smaller for email/Slack/web", "gif to mp4", "mp4 to gif", "extract the audio", "trim this clip", "heic to jpg", "png to webp", "strip metadata", or any file conversion between media formats. Uses correct ffmpeg/ImageMagick recipes so the agent doesn't guess flags and ruin quality.

Media Converter

Agents guess ffmpeg flags and produce huge, broken, or ugly files. This skill is the recipe book. Every command below is safe to run as written.

Ground rules

  1. Probe before converting: ffprobe -v error -show_format -show_streams -of json input.mp4 — know codec, resolution, duration, audio before picking a recipe.
  2. Never overwrite the input. Output to a new name; use -n (never overwrite) not -y.
  3. Quote all paths. Spaces in filenames break half of all ffmpeg invocations.
  4. Even dimensions always: append -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" when dimensions might be odd — H.264 requires it.
  5. Report before/after size when the goal was compression.

Video

Compress for web / general sharing (H.264 — plays everywhere)

ffmpeg -i in.mov -c:v libx264 -crf 23 -preset slow -pix_fmt yuv420p \
  -c:a aac -b:a 128k -movflags +faststart -map_metadata -1 out.mp4

Compress harder (AV1 — ~half the size of H.264, modern browsers/players only)

ffmpeg -i in.mov -c:v libsvtav1 -crf 32 -preset 6 -pix_fmt yuv420p \
  -c:a libopus -b:a 96k -movflags +faststart -map_metadata -1 out.mp4

Use SVT-AV1 (libsvtav1), not libaom — 6–10× faster, same quality. Preset 6 is the production balance. Warn the user: old TVs/Windows without codec pack may not play AV1.

Hit a target size (email/Slack caps)

Downscale + higher CRF first — resolution is the biggest lever:

ffmpeg -i in.mp4 -vf "scale=1280:-2" -c:v libx264 -crf 28 -preset slow \
  -c:a aac -b:a 96k -movflags +faststart out.mp4

Still too big? scale=854:-2 and -crf 30. Exact target → two-pass with bitrate = (target_MB × 8192 / seconds − audio_kbps).

Convert container without re-encoding (instant, lossless)

ffmpeg -i in.mkv -c copy out.mp4

Only when the codecs are mp4-compatible (h264/hevc + aac). If it errors, re-encode with the compress recipe.

Trim

# Fast, no re-encode (cuts snap to keyframes — start may shift up to ~2s):
ffmpeg -ss 00:00:10 -to 00:00:25 -i in.mp4 -c copy out.mp4
# Frame-accurate (re-encodes):
ffmpeg -ss 00:00:10 -to 00:00:25 -i in.mp4 -c:v libx264 -crf 20 -c:a aac out.mp4

GIF ↔ MP4

# GIF → MP4 (do this to every GIF; ~10× smaller):
ffmpeg -i in.gif -movflags +faststart -pix_fmt yuv420p \
  -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" out.mp4

# MP4 → GIF done right (palette pass, or colors will be awful):
ffmpeg -i in.mp4 -vf "fps=12,scale=480:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" out.gif

Audio

# Extract audio untouched (check stream codec with ffprobe first):
ffmpeg -i in.mp4 -vn -c:a copy out.m4a
# Extract to mp3:
ffmpeg -i in.mp4 -vn -c:a libmp3lame -q:a 2 out.mp3
# Normalize loudness (podcast/voiceover standard):
ffmpeg -i in.wav -af loudnorm=I=-16:TP=-1.5:LRA=11 out.m4a
# Speech-optimized small file (transcription uploads):
ffmpeg -i in.mp4 -vn -ac 1 -ar 16000 -c:a libmp3lame -b:a 48k out.mp3

Images

# HEIC → JPG (iPhone photos):
magick in.heic -quality 90 out.jpg          # ImageMagick 7; use `heif-convert` if magick lacks HEIC
# PNG → WebP (web assets, ~30% smaller):
magick in.png -quality 85 out.webp
# Batch resize a folder to max 1920px wide (originals preserved):
mkdir -p resized && for f in *.jpg; do magick "$f" -resize "1920x>" "resized/$f"; done
# Strip all metadata (GPS, camera, AI prompt) before sharing:
magick in.jpg -strip out.jpg
ffmpeg -i in.mp4 -c copy -map_metadata -1 out.mp4

Note: -strip removes embedded AI prompts too — warn the user if they may want them (see ai-asset-organizer).

Decision guide

User says Recipe
"smaller", "won't upload", "too big for email" Target-size recipe
"for my website / Notion / docs" H.264 web recipe; offer AV1 if they control the players
"screen recording to share" H.264 CRF 23 + scale=1280:-2 if 4K/retina source
"this GIF is huge" GIF → MP4
"iPhone photos won't open on Windows" HEIC → JPG
"send just the audio" Extract audio

Requirements

ffmpeg + ffprobe (brew install ffmpeg / winget install ffmpeg / apt install ffmpeg). ImageMagick 7 for image recipes. Check availability with ffmpeg -version before promising anything.