/media-os:media-subtitle-sync [subs] [video]from media-os
Syncs subtitle files (SRT/ASS/VTT) to video audio using alass and ffsubsync, handling constant offset, drift, framerate mismatch, and batch operations.
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
sync-reference)shift)batch-sync)brew install alass # macOS
# or: download static binary from https://github.com/kaegi/alass/releases
pip install ffsubsync # Python; needs ffmpeg on PATH
# or: pipx install ffsubsync
Verify:
uv run ${CLAUDE_SKILL_DIR}/scripts/subsync.py check
Both tools shell out to ffmpeg to extract the reference audio track. alass needs ffmpeg 4+.
| Symptom | Pick |
|---|---|
| Clean webrip, small linear shift | ffsubsync — fast, simple VAD+FFT |
| TV rip with commercial breaks, scene cuts | alass — splits + linear segment alignment |
| Framerate mismatch (25 ↔ 23.976 ↔ 29.97) | either — both auto-detect |
| Known-good ref sub exists in any language | either with sync-reference |
| Video has little/no dialogue (music, animation) | use ref-sub mode; VAD fails on silence |
| You only need a constant offset | shift subcommand (no tool needed) |
| Both tools disagree wildly | try ref-sub mode, or manual shift |
Unsure → let --tool auto try alass first, fall back to ffsubsync.
# Via wrapper (handles tool pick, fallback, dry-run)
uv run ${CLAUDE_SKILL_DIR}/scripts/subsync.py sync \
--video movie.mkv --subs movie.en.srt --output movie.en.synced.srt --tool auto
# Raw alass
alass movie.mkv movie.en.srt movie.en.synced.srt
# alass fast mode (no scene-split analysis, linear only)
alass --no-split movie.mkv movie.en.srt movie.en.synced.srt
# alass with split-penalty tuning (higher = fewer splits)
alass --split-penalty 10 movie.mkv movie.en.srt movie.en.synced.srt
# Raw ffsubsync
ffsubsync movie.mkv -i movie.en.srt -o movie.en.synced.srt
# ffsubsync, disable framerate adjustment (when FR is known-correct)
ffsubsync movie.mkv -i movie.en.srt -o movie.en.synced.srt --no-fix-framerate
# ffsubsync, widen search (default ±60s)
ffsubsync movie.mkv -i movie.en.srt -o movie.en.synced.srt --max-offset-seconds 180
Use when the video's audio language differs from the sub language, or when the video has poor dialogue. The reference sub should be known-good, ideally in the video's audio language.
uv run ${CLAUDE_SKILL_DIR}/scripts/subsync.py sync-reference \
--reference-subs movie.ja.synced.srt --subs movie.en.srt --output movie.en.synced.srt
# Raw alass: swap video for reference srt
alass movie.ja.synced.srt movie.en.srt movie.en.synced.srt
# Raw ffsubsync: same pattern
ffsubsync movie.ja.synced.srt -i movie.en.srt -o movie.en.synced.srt
Use for "everything is 3.5s late" — no drift, just translation.
uv run ${CLAUDE_SKILL_DIR}/scripts/subsync.py shift \
--subs movie.srt --output movie.shifted.srt --seconds 3.5
# Negative shift (subs are ahead)
uv run ${CLAUDE_SKILL_DIR}/scripts/subsync.py shift \
--subs movie.srt --output movie.shifted.srt --seconds -2.1
# Raw ffmpeg equivalent (LINEAR only)
ffmpeg -itsoffset 3.5 -i movie.srt -c copy movie.shifted.srt
uv run ${CLAUDE_SKILL_DIR}/scripts/subsync.py batch-sync \
--video-dir ./S01 --subs-dir ./S01 --output-dir ./S01/synced --tool alass
# Raw shell loop
for v in *.mkv; do
base="${v%.mkv}"
alass "$v" "${base}.srt" "synced/${base}.synced.srt"
done
framerate ratio 25/23.976 in logs, the source was PAL-speedup. Confirm the synced file sounds in-sync, not just at endpoints.Score: 0.xx — below 0.5 means alignment was weak; retry with alass or reference sub..srt, .ass, .ssa, .vtt, .sub; alass is primarily SRT (convert first via ffmpeg-subtitles skill if needed).--no-fix-framerate when you know FR is correct and only offset is wrong.--max-offset-seconds default is 60. For subs pulled from the wrong release group, widen to 180–300.--split-penalty tunes split sensitivity. Raise (≥10) if alass over-splits and adds phantom breaks; lower (≤3) if it misses commercial cuts.shift — if that works, the problem was constant offset all along (tools over-fit). If it doesn't, the sub is from a different edit/cut of the video; re-download.shift or ref-sub mode.ffsubsync wedding.mkv -i wedding.en.srt -o wedding.en.synced.srt
# or
uv run ${CLAUDE_SKILL_DIR}/scripts/subsync.py sync \
--video wedding.mkv --subs wedding.en.srt --output wedding.en.synced.srt --tool ffsubsync
alass broadcast.ts broadcast.srt broadcast.synced.srt
# If over-splitting:
alass --split-penalty 10 broadcast.ts broadcast.srt broadcast.synced.srt
uv run ${CLAUDE_SKILL_DIR}/scripts/subsync.py sync-reference \
--reference-subs film.es.synced.srt --subs film.en.srt --output film.en.synced.srt
uv run ${CLAUDE_SKILL_DIR}/scripts/subsync.py shift \
--subs episode.srt --output episode.shifted.srt --seconds 4.8
uv run ${CLAUDE_SKILL_DIR}/scripts/subsync.py batch-sync \
--video-dir ./S02 --subs-dir ./S02-subs --output-dir ./S02-synced --tool auto --verbose
ffmpeg: command not found (from alass or ffsubsync)Cause: Both tools shell out to ffmpeg for audio extraction.
Solution: brew install ffmpeg (or your platform equivalent); ensure on PATH.
alass: unknown format / alass hangs on .assCause: alass is SRT-first. ASS/SSA often fails or is lossy through it.
Solution: Convert to SRT first using the ffmpeg-subtitles skill: ffmpeg -i in.ass out.srt. Sync. Convert back if ASS styling is needed.
Cause: Silent section in video, wrong release cut, or music-only intro mismatch.
Solution: Try alass. If alass also fails, use ref-sub mode with a known-good sub. Last resort: manual shift.
Cause: Over-splitting on false scene cuts.
Solution: Raise --split-penalty to 10–20, or use --no-split if it's really linear drift.
Cause: Framerate mismatch (23.976 ↔ 25). Both tools auto-detect, but can miss.
Solution: Force framerate scaling via ffsubsync (default on). If disabled via --no-fix-framerate, remove that flag.
Cause: alass always writes UTF-8 LF; some players want CRLF / Windows-1252.
Solution: Post-process: iconv -f UTF-8 -t WINDOWS-1252 in.srt > out.srt && unix2dos out.srt.
sync-reference still produces driftCause: Reference sub is itself out of sync, or from a different edit. Solution: Pick a different reference, or sync the reference to the video first, then use it as ref for the target language.
references/subsync.md for tool-comparison table, framerate-detection notes, recipe book, and handoff to ffmpeg-subtitles for format conversion.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
subtitle-sync, alass, ffsubsync, srt, batch-sync, video-timing
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