/media-os:ffmpeg-transcode [input] [target-format]from media-os
Transcodes video/audio between codecs and containers using ffmpeg. Handles conversion, re-encoding, CRF/bitrate control, 2-pass encoding, container change, and web/mobile/social-media compatibility.
Ships in media-os. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Context: $ARGUMENTS
ffmpeg-hwaccel; for trimming/joining use ffmpeg-cut-concat;
for filters/scaling use ffmpeg-video-filter; for raw inspection use ffmpeg-probe.First probe the input:
ffprobe -v error -show_entries stream=index,codec_type,codec_name,pix_fmt,profile,channels,sample_rate -of json "$IN"
Decision tree:
ffmpeg -i in.mkv -c copy -map 0 out.mp4
Caveats: H.264/HEVC in raw .ts vs .mp4 need a bitstream filter — see
ffmpeg-bitstream. AAC from .ts → .mp4 needs aac_adtstoasc.Container → codec compatibility matrix:
| Container | Video codecs (common) | Audio codecs (common) | Subtitles |
|---|---|---|---|
| MP4 / M4V | H.264, HEVC, AV1, MPEG-4 | AAC, ALAC, AC3, MP3 (avoid Opus) | mov_text only |
| MOV | H.264, HEVC, ProRes, DNxHD | AAC, PCM, ALAC | mov_text |
| MKV | anything | anything | SRT/ASS/PGS/... |
| WebM | VP8, VP9, AV1 only | Vorbis, Opus only | WebVTT |
If unsure which codec to pick, default to H.264 + AAC in MP4 — works on every browser, every phone, every social platform.
Three modes, pick exactly one per video encode:
-b:v 5M. Single pass is fine for live/streaming targets;
otherwise 2-pass is higher quality at the same size.ffmpeg2pass-*.log.CRF typical ranges (NOT comparable across codecs):
| Encoder | Sane CRF range | Visually-lossless-ish | Notes |
|---|---|---|---|
| libx264 | 18–28 (default 23) | 17–18 | -crf 0 = mathematically lossless |
| libx265 | 20–28 (default 28) | 18–20 | -crf 0 = lossless |
| libsvtav1 | 25–40 (default 35) | 20–25 | Higher numbers than x264 for same quality |
| libaom-av1 | 25–40 (set -b:v 0 -crf N for CRF) | 20–25 | Slow; prefer libsvtav1 |
| libvpx-vp9 | 24–37 (set -b:v 0 -crf N) | 15–23 | Must pass -b:v 0 to enable constant-quality |
2-pass recipe (size-targeted):
# Pass 1: analyse only, no audio, discard output
ffmpeg -y -i "$IN" -c:v libx264 -b:v 5M -preset medium \
-pass 1 -an -f null /dev/null
# Pass 2: real encode, reuse stats
ffmpeg -i "$IN" -c:v libx264 -b:v 5M -preset medium \
-pass 2 -c:a aac -b:a 128k \
-movflags +faststart "$OUT"
Compute -b:v from a size budget: bitrate_bps = target_size_bits / duration_seconds − audio_bps.
Recipe A — Web MP4 (default go-to):
ffmpeg -i "$IN" \
-c:v libx264 -preset medium -crf 20 \
-pix_fmt yuv420p \
-c:a aac -b:a 128k -ac 2 \
-movflags +faststart \
"$OUT.mp4"
Recipe B — HEVC in MKV (archive / smaller size):
ffmpeg -i "$IN" \
-c:v libx265 -preset medium -crf 22 \
-pix_fmt yuv420p10le \
-c:a libopus -b:a 128k \
"$OUT.mkv"
Put HEVC in MP4 instead by adding -tag:v hvc1 (Apple/QuickTime requires it).
Recipe C — AV1 in MP4 (modern web / YouTube-style):
ffmpeg -i "$IN" \
-c:v libsvtav1 -preset 6 -crf 30 \
-pix_fmt yuv420p10le \
-c:a libopus -b:a 96k \
-movflags +faststart \
"$OUT.mp4"
(Use -preset 4 for better quality / slower, -preset 8 for faster / larger.)
Recipe D — WebM (VP9 + Opus):
ffmpeg -i "$IN" \
-c:v libvpx-vp9 -b:v 0 -crf 32 -row-mt 1 -cpu-used 2 \
-pix_fmt yuv420p \
-c:a libopus -b:a 96k \
"$OUT.webm"
Recipe E — ProRes for editing (MOV):
ffmpeg -i "$IN" \
-c:v prores_ks -profile:v 3 -pix_fmt yuv422p10le \
-c:a pcm_s16le \
"$OUT.mov"
Profiles: 0=proxy, 1=lt, 2=standard, 3=hq, 4=4444, 5=4444xq.
Stream selection (-map):
# Keep video 0 + audio 1 only, drop all subs:
ffmpeg -i "$IN" -map 0:v:0 -map 0:a:1 -c:v libx264 -crf 20 -c:a aac "$OUT"
# Preserve all streams + copy metadata + copy chapters:
ffmpeg -i "$IN" -map 0 -map_metadata 0 -map_chapters 0 -c copy "$OUT"
Preset runner:
uv run ${CLAUDE_SKILL_DIR}/scripts/transcode.py \
--input "$IN" --output "$OUT" --preset web-mp4
Presets: web-mp4 (H.264/AAC MP4), hevc-mkv, web-webm, av1-mp4, prores, archive.
ffprobe -v error -show_format -show_streams -of json "$OUT" | jq '.format.duration, .streams[].codec_name'
Check:
codec_name + audio codec_name are what you asked for.pix_fmt is yuv420p if you need browser/phone playback.ffprobe -v trace ... 2>&1 | head | grep moov should show moov atom early
(or simply: the file starts playing instantly in a browser = faststart worked).yuv420p is required for broad playback (browsers, iOS, most TVs). ProRes captures
and RGB sources often land on yuv444p/yuv422p — always add -pix_fmt yuv420p
for web output, or yuv420p10le for 10-bit HDR-ish HEVC/AV1.-movflags +faststart is MP4/MOV only. Does nothing for MKV/WebM. Without it,
web players have to download the whole file before playback starts.ffmpeg-bitstream skill.-crf 0 is lossless only for libx264 / libx265. For AV1 / VP9 it's the best-quality
CRF value but still lossy. For true lossless VP9 use -lossless 1.-b:v is ignored when -crf is set on libx264/libx265 unless you also pass
-maxrate/-bufsize (then CRF becomes a capped-CRF ceiling). Pick one mode.-c:v copy -c:a aac -b:a 128k.-tag:v hvc1 to play on Apple QuickTime / Safari / iOS.-b:v and -preset between the two passes. Stats log
is per-working-directory — run both passes from the same cwd.aac
encoder unless you know your build has fdk.ffmpeg -i in.mov -c:v libx264 -preset medium -crf 20 -pix_fmt yuv420p \
-c:a aac -b:a 128k -movflags +faststart out.mp4
Duration 10 min = 600s. Budget: 25 MB × 8 / 600s ≈ 333 kbps total. Reserve 64k audio, leave 260k video. 2-pass mandatory at that ratio:
ffmpeg -y -i in.mp4 -c:v libx264 -b:v 260k -preset slow -pass 1 -an -f null /dev/null
ffmpeg -i in.mp4 -c:v libx264 -b:v 260k -preset slow -pass 2 \
-c:a aac -b:a 64k -ac 1 -movflags +faststart out.mp4
ffprobe in.mkv # confirm codecs are H.264/HEVC + AAC/AC3
ffmpeg -i in.mkv -c copy -map 0 -movflags +faststart out.mp4
If subtitle streams are SRT/ASS, add -map 0:v -map 0:a to drop them (MP4 only takes
mov_text) or add -c:s mov_text to convert.
ffmpeg -i master.mov -c:v libx265 -preset slow -crf 18 -pix_fmt yuv420p10le \
-x265-params "profile=main10" \
-c:a flac -compression_level 8 archive.mkv
Could not find tag for codec opus in stream #1, codec not currently supported in containerCause: Opus audio in MP4 isn't universally supported by ffmpeg's MP4 muxer.
Solution: Use MKV/WebM, or re-encode audio to AAC: -c:a aac -b:a 128k.
[libx264 @ ...] height not divisible by 2Cause: libx264 with yuv420p requires even dimensions.
Solution: Add -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" or an explicit even target.
Cause: moov atom at end of MP4.
Solution: Add -movflags +faststart. (MP4/MOV only.)
Cause: yuv444p or yuv422p pixel format.
Solution: Add -pix_fmt yuv420p.
Cause: tag is hev1 instead of hvc1.
Solution: Re-mux with ffmpeg -i in.mp4 -c copy -tag:v hvc1 out.mp4.
Cause: build doesn't include non-free fdk.
Solution: Swap libfdk_aac → aac (native encoder is fine for ≥128 kbps stereo).
references/codecs.md.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub damionrashford/media-os --plugin media-os110 skills in this plugin
/audio-coreaudioManipulate macOS audio at the Core Audio HAL layer: afinfo (audio file metadata), afplay (play), afconvert (convert format/rate/bit-depth/channel layout), say (TTS), SwitchAudioSource (change default input/output/system device — brew install switchaudio-osx), audiodevice CLIs (npm/Go variants), AppleScript via osascript to drive System Preferences Sound. HAL plugins at /Library/Audio/Plug-Ins/HAL/ load virtual drivers (BlackHole 2ch/16ch/64ch, Loopback, Background Music). Aggregate Device (drift-corrected multi-in) and Multi-Output Device via Audio MIDI Setup.app or AudioHardwareCreateAggregateDevice. Use when the user asks to change default macOS audio device, route audio between apps on Mac, install BlackHole, build an Aggregate Device, convert audio files with afconvert, or script Mac audio from the terminal.
/audio-jackRoute professional low-latency audio with JACK Audio Connection Kit (jackaudio.org): jackd server (ALSA/CoreAudio/PortAudio/ASIO backends), jack_control (D-Bus JACK2 config), jack_lsp (list ports/connections), jack_connect/jack_disconnect (manage links), jack_cpu_load, jack_samplerate, jack_bufsize (runtime period size), jack_transport, jack_rec (multi-channel WAV recording), jack_iodelay (round-trip latency), jack_wait, jack_midi_dump. JACK1 C maintenance vs JACK2 C++ multicore. Modern Linux swaps jackd for PipeWire's libjack shim — same client API. JackTrip for uncompressed multichannel UDP over the Internet. Use when the user asks to run a JACK server, connect audio clients, measure roundtrip latency, record from JACK ports, set JACK period size, or bridge JACK over the network with JackTrip.
/audio-pipewireRoute and introspect Linux audio/video/MIDI graphs with PipeWire: pw-cli (interactive object/module control), pw-dump (full graph JSON with --monitor), pw-link (list/create/destroy port links), pw-cat / pw-play / pw-record (playback+record), pw-top (real-time DSP load + xrun viewer), pw-metadata (shared metadata store), pw-loopback (source/sink bridges), pw-midiplay/pw-midirecord, pw-jack (JACK client compat shim), pw-mon, pw-profiler. WirePlumber session manager handles routing/defaults/profiles. Replaces PulseAudio (via pipewire-pulse) and JACK (via libjack.so shim) simultaneously. Use when the user asks to route Linux audio, link two apps, list audio devices on Linux, create a loopback, record system audio, monitor the audio graph, or set up a virtual audio device on modern Linux.
/audio-wasapiManipulate Windows audio via WASAPI (learn.microsoft.com/coreaudio): SoundVolumeView + svcl.exe (NirSoft — set default device, per-app volumes, save/load profiles), AudioDeviceCmdlets PowerShell module (Get-AudioDevice, Set-AudioDevice, Get-AudioDevicePlaybackMute), nircmd setdefaultsounddevice. Shared mode (Windows engine resamples all streams to endpoint fixed format) vs Exclusive mode (bit-perfect, audiophile, ~sub-3ms latency with IAudioClient3 + event-driven callbacks). WASAPI then MMDevice then Audio Engine (audiodg.exe) then WDM/KS. ASIO is Steinberg's parallel stack bypassing Windows audio. Virtual audio devices: VB-Audio Virtual Cable, VoiceMeeter/Banana/Potato. Use when the user asks to change Windows default audio device, route app audio, use VoiceMeeter, install VB-Cable, set a specific device from PowerShell, or enable exclusive-mode low-latency output.
/cv-mediapipeGoogle MediaPipe Tasks API (current supported, NOT legacy mediapipe.solutions): Vision Tasks (Face Detector, Face Landmarker, Face Stylizer, Hand Landmarker, Gesture Recognizer, Pose Landmarker, Holistic Landmarker, Object Detector, Image Classifier, Image Segmenter, Interactive Segmenter, Image Embedder, Image Generator), Audio Tasks (Audio Classifier), Text Tasks (Text Classifier, Text Embedder, Language Detector), GenAI Tasks (LLM Inference — on-device Gemma/Phi-2/Falcon/StableLM). Three run modes: IMAGE, VIDEO, LIVE_STREAM (async). Python: mediapipe.tasks.python.vision/audio/text/genai. Docs at ai.google.dev/edge/mediapipe/solutions. Model Maker for transfer learning. Use when the user asks to detect pose/face/hand landmarks, classify an image, run a body-pose model, segment people, recognize gestures, do on-device LLM inference via MediaPipe, or build a mobile/embedded CV pipeline.
/cv-opencvComputer vision on images + video with OpenCV (docs.opencv.org/4.x/): core (Mat / ndarray, linalg), imgproc (filtering, morphology, geometric transforms, color conv, histograms, contours), imgcodecs (imread/imwrite — PNG, JPEG, TIFF, WebP, EXR), videoio (VideoCapture / VideoWriter — FFMPEG, GStreamer, V4L2, AVFoundation, MSMF backends), calib3d (camera calibration, stereo, solvePnP, homography), features2d (ORB, AKAZE, BRISK, KAZE, SIFT), objdetect (FaceDetectorYN, FaceRecognizerSF, HOG, ArUco, QRCode), dnn (ONNX/TF/Caffe/Darknet, CUDA + OpenVINO + Vulkan backends, model zoo at github.com/opencv/opencv_zoo), photo (inpainting, denoising, HDR Debevec/Robertson), stitching (panorama), video (optical flow Farneback/LK/DIS, BackgroundSubtractorMOG2/KNN, tracking KCF/CSRT/MIL/Nano/Vit/DaSiamRPN). Python-first via cv2. Use when the user asks to detect faces, track objects, run YOLO inference, capture + process webcam frames, calibrate a camera, stitch a panorama, or use OpenCV from Python/C++.
Other plugins' skills for the same job