/media-os:media-gpac [operation]from media-os
Performs advanced MP4/ISOBMFF authoring and diagnostics with GPAC (MP4Box, gpac): fragmented MP4, DASH+CMAF packaging, box-level surgery, CENC encryption, sidx injection, track extraction, and repair. Use when ffmpeg can't handle the task.
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
info / diso)dash subcommand)fragment)extract-track)encrypt)media-shaka skill-diso).# macOS
brew install gpac
# Debian/Ubuntu
sudo apt install gpac
# Fedora/RHEL
sudo dnf install gpac
# Verify
MP4Box -version
gpac -version
MP4Box is the legacy (stable, widely documented) CLI for ISOBMFF surgery. gpac is the newer filter-graph CLI (similar philosophy to ffmpeg filters). Prefer MP4Box for most tasks — it's documented everywhere.
| Task | Tool |
|---|---|
| Human-readable summary | MP4Box -info in.mp4 |
| Full box tree as XML | MP4Box -diso in.mp4 (writes in_info.xml) |
| Extract track as raw ES | MP4Box -raw TID in.mp4 |
| Fragment for fMP4 | MP4Box -frag 2000 in.mp4 |
| DASH / CMAF package | MP4Box -dash 4000 -frag 4000 -rap … |
| Inject sidx | MP4Box -add-sidx 4000 in.mp4 |
| CENC encrypt | MP4Box -crypt drm.xml -out o.mp4 in.mp4 |
| CENC decrypt | MP4Box -decrypt drm.xml -out o.mp4 in.mp4 |
| Remove track | MP4Box -rem TID in.mp4 |
| Set language | MP4Box -lang TID=jpn in.mp4 |
| Enable/disable | MP4Box -enable TID -disable TID in.mp4 |
| Split by time | MP4Box -splitx T1:T2 in.mp4 |
| Edit list | MP4Box -elst '0,N,1' in.mp4 |
| Add tracks | MP4Box -add a.h264 -add a.aac out.mp4 |
Always pass -out when you want a new file — MP4Box edits in-place otherwise. Back up first.
The scripts/gpac.py wrapper gives an argparse interface over these operations. Stdlib-only, non-interactive, --dry-run prints the command.
# Inspect
uv run ${CLAUDE_SKILL_DIR}/scripts/gpac.py info --input in.mp4
uv run ${CLAUDE_SKILL_DIR}/scripts/gpac.py diso --input in.mp4 --output boxes.xml
# Extract raw track 1 (ES)
uv run ${CLAUDE_SKILL_DIR}/scripts/gpac.py extract-track --input in.mp4 --track 1 --output track1.h264
# Fragment (2-second fragments, in-place copy with -out)
uv run ${CLAUDE_SKILL_DIR}/scripts/gpac.py fragment --input in.mp4 --output frag.mp4 --fragment-ms 2000
# DASH/CMAF (live profile)
uv run ${CLAUDE_SKILL_DIR}/scripts/gpac.py dash --input in.mp4 --outdir dashout --segment-ms 4000 --profile live
# CENC ClearKey encrypt
uv run ${CLAUDE_SKILL_DIR}/scripts/gpac.py encrypt \
--input in.mp4 --output enc.mp4 \
--key-id 0123456789abcdef0123456789abcdef \
--key fedcba9876543210fedcba9876543210
# Remove track 2 (usually audio #2)
uv run ${CLAUDE_SKILL_DIR}/scripts/gpac.py remove-track --input in.mp4 --output stripped.mp4 --track 2
# Set language on track 2
uv run ${CLAUDE_SKILL_DIR}/scripts/gpac.py set-lang --input in.mp4 --track 2 --lang jpn
# Split by time
uv run ${CLAUDE_SKILL_DIR}/scripts/gpac.py split-time --input in.mp4 --output-pattern seg --start 00:00:10 --end 00:00:30
Add --dry-run to print the MP4Box command without executing. Add --verbose to echo the command before running.
After any authoring step, confirm result with:
MP4Box -info out.mp4
For DASH, validate the manifest:
xmllint --noout manifest.mpd
ls -la dashout/ # should contain init.mp4 + seg_*.m4s (live) OR one onDemand file
For CENC: play with ffplay -decryption_key KEY enc.mp4 or a Shaka-Player ClearKey page. For fragmented MP4: MP4Box -info shows Fragmented: yes and lists moof count.
scripts/gpac.py — argparse wrapper for MP4Box: check, info, diso, extract-track, fragment, dash, encrypt, decrypt, remove-track, set-lang, split-time. Generates DRM XML for CENC ops in a temp file.Read references/gpac.md when:
live, onDemand, main, full).moov, moof, sidx, senc, saio, saiz, pssh, mvex).gpac filter graph syntax.MP4Box vs gpac: both ship with the GPAC framework. MP4Box is legacy CLI (stable, everywhere). gpac (lowercase) is the newer filter-graph CLI — gpac -i input -o output with a filter pipeline; list plugins via gpac -h filters. Prefer MP4Box unless you need filter-graph semantics.-out. Always back up or pass -out.MP4Box -info lists them.-raw TID extracts the ES (elementary stream: raw H.264 NAL units, raw AAC ADTS, etc.) — not a container. Feed it back in via -add track.h264.-diso dump is huge — dumps the entire box tree as XML. Redirect to a file; don't cat it.-dash 4000 = 4000 ms segment duration. -frag is fragment duration inside each segment (usually equal to -dash).-rap forces each segment to start on a random access point (IDR). Omit and you will get unseekable DASH.sidx = Segment Index box. Required for byte-range DASH (onDemand profile). Live profile uses separate .m4s files and doesn't need it..m4s + init.mp4. Sent as independent files over HTTP.-dash-profile live → segmented, fragmented, templated URLs ($Number$). onDemand → single file with indexed byte ranges. main/full = older DASH profiles.-dash-ctx <file> saves packaging state — required for continuous live DASH across MP4Box invocations.KID and key are hex with 0x prefix. IV_size is 8 (CTR-64) or 16 (CTR-full). first_IV seeds the counter.media-shaka skill.senc vs saio/saiz: MP4Box writes the correct auxiliary-info boxes; don't mix CENC between tools mid-pipeline.-tight reorders the moov box for streaming (fast-start). Equivalent to ffmpeg's -movflags +faststart.-splitx T1:T2 uses timecodes (e.g., 00:01:00:00:02:00). Some versions want -splitx T1/T2 syntax — check MP4Box -h split on your build.MP4Box -dash 4000 -frag 4000 -rap \
-segment-name 'seg_$RepresentationID$_$Number$' \
-dash-profile live \
-out dashout/manifest.mpd \
input.mp4#video input.mp4#audio
Result: dashout/manifest.mpd, per-representation init.mp4, and seg_video_1.m4s, seg_audio_1.m4s, ...
# 1. Inspect: look for missing sidx, broken edit list, or non-fragmented moov
MP4Box -info broken.mp4
# 2. Rewrite with fragments + sidx
MP4Box -frag 2000 -add-sidx 2000 -out fixed.mp4 broken.mp4
# 3. Verify
MP4Box -info fixed.mp4 # "Fragmented: yes", moof count > 0, sidx present
drm.xml:
<GPACDRM>
<CrypTrack trackID="1" IsEncrypted="1" IV_size="8"
first_IV="0x0123456789abcdef" saiSavedBox="senc">
<key KID="0xABCDEF01234567890ABCDEF012345678"
value="0x112233445566778899AABBCCDDEEFF00"/>
</CrypTrack>
</GPACDRM>
MP4Box -crypt drm.xml -out enc.mp4 in.mp4
Decrypt with the same XML: MP4Box -decrypt drm.xml -out dec.mp4 enc.mp4.
MP4Box -raw 1 in.mp4 # writes in_track1.h264
MP4Box -raw 2 in.mp4 # writes in_track2.aac
MP4Box -add in_track1.h264 -add in_track2.aac -new combined.mp4
Cannot find adaptation setCause: DASH packager couldn't correlate streams — usually bad #video/#audio track-selection syntax.
Solution: list tracks via MP4Box -info. Use input.mp4#trackID=1 explicit syntax instead of #video.
Segment duration not a multiple of frame rateCause: -dash 4000 doesn't align to the GOP. With 24 fps + 2s GOP, pick 4000/8000 ms (multiples of GOP ms).
Solution: re-encode source with a fixed GOP matching your segment duration, or use -rap and accept slightly variable segment sizes.
Cannot write to file: permission deniedCause: MP4Box tries to edit input in-place and the file is read-only.
Solution: pass -out newname.mp4 explicitly.
Unknown track referenceCause: operating on a track ID that doesn't exist.
Solution: MP4Box -info file.mp4 — track IDs are 1-based and listed in the summary.
Encryption: wrong KID/key formatCause: hex values missing 0x prefix or wrong length (KID must be 16 bytes / 32 hex chars; key must be 16 bytes / 32 hex chars).
Solution: double-check lengths. openssl rand -hex 16 generates valid values.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
mp4box, isobmff, dash-packaging, cmaf, cenc-encryption, mp4-surgery
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.
Other plugins' skills for the same job