/media-os:ffmpeg-hdr-color [operation] [input]from media-os
HDR to SDR tone-mapping and color-space conversion with ffmpeg: tonemap, zscale, libplacebo, colorspace filters. Detects HDR type (HDR10, HDR10+, HLG, Dolby Vision) and converts to Rec.709 SDR.
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
Inspect color_transfer, color_primaries, color_space, and side_data_list of the video stream.
ffprobe -v error -select_streams v:0 \
-show_entries stream=color_space,color_transfer,color_primaries,color_range:stream_side_data=+ \
-of json input.mkv
Decision map:
color_transfer | color_primaries | Side data | Type |
|---|---|---|---|
smpte2084 | bt2020 | Mastering display metadata | HDR10 |
smpte2084 | bt2020 | HDR Dynamic Metadata SMPTE2094-40 | HDR10+ |
arib-std-b67 | bt2020 | (may be absent) | HLG |
smpte2084 (DoVi profile 5/7/8) | bt2020 | DOVI configuration record | Dolby Vision |
bt709 / smpte170m | bt709 | — | SDR |
Or use the helper: uv run ${CLAUDE_SKILL_DIR}/scripts/hdrcolor.py detect --input input.mkv.
tonemap filter (CPU, zimg): safe default, works on any ffmpeg built with --enable-libzimg. Requires floating-point linear-light input (the zscale=t=linear,format=gbrpf32le sandwich — see Gotchas). Operators: hable (default, recommended), mobius, reinhard, gamma, clip, linear.libplacebo filter (Vulkan, higher quality): better roll-off, built-in debanding, peak detection. Requires -init_hw_device vulkan and ffmpeg built with --enable-libplacebo --enable-vulkan. On Apple Silicon most Homebrew ffmpeg builds lack Vulkan — fall back to tonemap.colorspace filter: does matrix/primaries/trc conversion but not real HDR tone-mapping. Use for BT.2020-SDR → BT.709-SDR, not for PQ/HLG → SDR.Check availability:
ffmpeg -hide_banner -filters | grep -E "zscale|tonemap|libplacebo|colorspace"
ffmpeg -i hdr.mkv \
-vf "zscale=t=linear:npl=100,format=gbrpf32le,zscale=p=bt709,tonemap=tonemap=hable:desat=0,zscale=t=bt709:m=bt709:r=tv,format=yuv420p" \
-c:v libx264 -crf 19 -preset medium \
-c:a copy \
-color_primaries bt709 -color_trc bt709 -colorspace bt709 -color_range tv \
out.mp4
ffmpeg -init_hw_device vulkan \
-i hdr.mkv \
-vf "format=yuv420p10le,hwupload,libplacebo=tonemapping=bt.2390:colorspace=bt709:color_primaries=bt709:color_trc=bt709:format=yuv420p,hwdownload,format=yuv420p" \
-c:v libx264 -crf 18 -preset medium \
-c:a copy \
-color_primaries bt709 -color_trc bt709 -colorspace bt709 -color_range tv \
out.mp4
ffmpeg -i hlg.mkv \
-vf "zscale=t=linear:npl=100:tin=arib-std-b67,format=gbrpf32le,zscale=p=bt709,tonemap=tonemap=hable:desat=0,zscale=t=bt709:m=bt709:r=tv,format=yuv420p" \
-c:v libx264 -crf 19 \
-color_primaries bt709 -color_trc bt709 -colorspace bt709 -color_range tv \
out.mp4
Profile 5 is PQ-based and can be tone-mapped like HDR10; the DoVi RPU metadata is discarded. Profiles 7 and 8 need a real DV-aware decoder (e.g. dovi_tool/hdr10plus_tool pre-processing) — ffmpeg alone cannot fully resolve enhancement layers.
ffmpeg -i dovi_p5.mkv \
-vf "zscale=t=linear:npl=100,format=gbrpf32le,zscale=p=bt709,tonemap=tonemap=hable:desat=0,zscale=t=bt709:m=bt709:r=tv,format=yuv420p" \
-c:v libx264 -crf 19 \
-color_primaries bt709 -color_trc bt709 -colorspace bt709 -color_range tv \
out.mp4
ffmpeg -i bt2020_sdr.mkv \
-vf "zscale=primaries=709:transfer=709:matrix=709" \
-c:v libx264 -crf 18 \
-color_primaries bt709 -color_trc bt709 -colorspace bt709 -color_range tv \
out.mp4
ffmpeg -i sdr.mp4 \
-vf "zscale=t=linear:npl=100,format=gbrpf32le,zscale=p=bt2020,tonemap=tonemap=linear:param=4,zscale=t=smpte2084:m=bt2020nc:r=tv,format=yuv420p10le" \
-c:v libx265 -crf 18 -x265-params hdr10=1:colorprim=bt2020:transfer=smpte2084:colormatrix=bt2020nc \
-color_primaries bt2020 -color_trc smpte2084 -colorspace bt2020nc \
out.mkv
Real HDR requires real dynamic range; "upconverting" SDR rarely produces a better image.
Always pass explicit container flags so downstream players don't guess:
-color_primaries bt709 -color_trc bt709 -colorspace bt709 -color_range tv
Verify they stuck:
ffprobe -v error -select_streams v:0 \
-show_entries stream=color_space,color_transfer,color_primaries,color_range \
-of default=nw=1 out.mp4
Expected:
color_range=tv
color_space=bt709
color_transfer=bt709
color_primaries=bt709
scripts/hdrcolor.py — stdlib-only helper. Subcommands: detect, hdr-to-sdr, hlg-to-sdr, bt2020-to-bt709. Supports --dry-run, --verbose, --method {tonemap,libplacebo}, --crf.uv run ${CLAUDE_SKILL_DIR}/scripts/hdrcolor.py detect --input in.mkv
uv run ${CLAUDE_SKILL_DIR}/scripts/hdrcolor.py hdr-to-sdr --input in.mkv --output out.mp4 --method tonemap --crf 19
uv run ${CLAUDE_SKILL_DIR}/scripts/hdrcolor.py hdr-to-sdr --input in.mkv --output out.mp4 --method libplacebo
uv run ${CLAUDE_SKILL_DIR}/scripts/hdrcolor.py hlg-to-sdr --input hlg.mkv --output out.mp4
uv run ${CLAUDE_SKILL_DIR}/scripts/hdrcolor.py bt2020-to-bt709 --input in.mkv --output out.mp4
references/colorspace.md for tone-map operator trade-offs, full zscale / libplacebo / colorspace option catalogs, HDR metadata profiles, and primaries/transfer/matrix lookup tables.tonemap operates on linear-light, floating-point frames only. You MUST sandwich it: zscale=t=linear:npl=100,format=gbrpf32le before, and zscale=t=bt709:m=bt709:r=tv,format=yuv420p after. Skip the sandwich and you get a black or banded result.npl=100 is nominal peak luminance (cd/m²) — usual reference for SDR targets. Raise to 200–400 for brighter-looking output; lower clips highlights.tonemap=desat=0 preserves saturation. Values 1.0–2.0 progressively desaturate highlights; 2.0 mangles skin tones.libplacebo requires -init_hw_device vulkan before -i. Also needs hwupload before and hwdownload,format=yuv420p after in the filter chain.libplacebo will error with "No such filter". Use the tonemap recipe instead.dovi_tool to strip/convert the RPU first).tonemap and libplacebo. That is expected when the output is SDR.-color_primaries/-color_trc/-colorspace on the output tags the file with unspecified flags; some players (QuickTime, Chrome on macOS) then assume BT.709 and display your still-HDR pixels as neon garbage, or display your tone-mapped pixels as washed-out.zscale comes from zimg. Check with ffmpeg -filters | grep zscale; if absent, ffmpeg wasn't built with --enable-libzimg — rebuild or use Homebrew's ffmpeg with --with-libzimg, or fall back to colorspace + format for SDR-only conversions.-c:a copy.-colorspace bt709 vs zscale m=bt709 vs colorspace=bt709 inside libplacebo — same concept, three syntaxes, easy to cross-wire.hable (default, safe, filmic), mobius (softer roll-off), reinhard (flatter, often crushed blacks), clip (hard cutoff — banding), linear (scales only, no roll-off), gamma (simple power curve). Default to hable.zscale=tin=arib-std-b67 (or t=arib-std-b67 before linearization). Forgetting it treats HLG code values as PQ and produces a dark, wrong-gamma picture.-color_range tv vs pc matters: most broadcast/streaming is tv (limited, 16–235). Tagging pc when the pixels are tv crushes blacks and blows highlights.ffmpeg -i hdr10_2160p.mkv \
-vf "zscale=t=linear:npl=100,format=gbrpf32le,zscale=p=bt709,tonemap=tonemap=hable:desat=0,zscale=t=bt709:m=bt709:r=tv,format=yuv420p,scale=1920:1080:flags=lanczos" \
-c:v libx264 -crf 20 -preset slow -profile:v high -level 4.1 \
-c:a aac -b:a 192k \
-color_primaries bt709 -color_trc bt709 -colorspace bt709 -color_range tv \
-movflags +faststart \
phone_sdr_1080p.mp4
ffmpeg -i bbc_hlg.mxf \
-vf "zscale=t=linear:npl=200:tin=arib-std-b67,format=gbrpf32le,zscale=p=bt709,tonemap=tonemap=mobius:desat=0.5,zscale=t=bt709:m=bt709:r=tv,format=yuv420p" \
-c:v libx264 -crf 18 -preset medium \
-c:a copy \
-color_primaries bt709 -color_trc bt709 -colorspace bt709 -color_range tv \
proxy.mp4
ffmpeg -i bt2020_sdr.mov \
-vf "zscale=primaries=709:transfer=709:matrix=709" \
-c:v libx264 -crf 17 \
-color_primaries bt709 -color_trc bt709 -colorspace bt709 -color_range tv \
rec709.mp4
No such filter: 'zscale'Cause: ffmpeg built without zimg.
Solution: brew reinstall ffmpeg (Homebrew includes zimg); or build ffmpeg with --enable-libzimg. As a workaround, colorspace=all=bt709:iall=bt2020ncl:fast=1 can do BT.2020-SDR → BT.709-SDR but cannot tone-map.
Impossible to convert between the formats supported by the filter 'Parsed_tonemap_0' and the filter 'auto_scaler_0'Cause: tonemap received non-float pixels.
Solution: Prepend zscale=t=linear:npl=100,format=gbrpf32le and append zscale=t=bt709:m=bt709:r=tv,format=yuv420p.
No such filter: 'libplacebo' or Failed to initialize VulkanCause: ffmpeg built without libplacebo/Vulkan (common on macOS Homebrew).
Solution: Use the tonemap recipe instead. Check with ffmpeg -filters | grep libplacebo and ffmpeg -init_hw_device list.
Cause: Missing output color tags, wrong npl, or desat too high.
Solution: Add -color_primaries bt709 -color_trc bt709 -colorspace bt709 -color_range tv; try npl=150 or npl=200; set desat=0.
Cause: Tone-map chain not actually in the graph (e.g. -c:v copy used) or output tagged as BT.2020/PQ.
Solution: Confirm re-encode is happening (not -c copy); re-verify with ffprobe per Step 4.
Cause: DV profile 7/8 enhancement layer discarded by ffmpeg.
Solution: Pre-process with dovi_tool (strip RPU to profile 8.1 single-track, or demux BL only), then run the HDR10 recipe.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
hdr-to-sdr, tone-mapping, color-space-conversion, ffmpeg-hdr
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