--- name: ffmpeg-audio description: Attach, generate, detect, remove, and transcode audio with FFmpeg, including silence workflows and telephony formats such as G.711 μ-law, G.711 A-law, GSM, and PCM. Use when audio is the primary media concern. --- # FFmpeg Audio Use this skill for audio-first workflows. For attaching or adding silence tracks to video, prefer the canonical `video attach-audio` / `video add-silence` commands; the older audio-domain aliases remain compatible. ## Activation scope Use for: - attaching or replacing audio on video; - generating silence; - adding a silence track; - detecting silence intervals; - removing silence from audio-only media; - telephony transcoding and codec/container clarification. ## Do not use Do not use for video timing edits unless audio handling is secondary to the video operation. Do not use `remove-silence` on video when doing so would create A/V desynchronization; the toolkit intentionally restricts unsafe cases. ## Required inputs Identify: - input media; - whether an existing audio track may be replaced; - silence thresholds/durations when relevant; - telephony codec, sample rate, channels, and container requirements. ## Preflight Probe media when stream presence matters. Never assume a video lacks audio. For telephony, distinguish codec from container before building the command. ## Toolkit surface selection Use the highest-level toolkit surface available to the host: 1. Use the associated `scripts/run.mjs` entry point for supported audio actions. 2. For silence detection, add-silence, telephony transcoding, or other supported audio operations, use `cecilia-ffmpeg`. 3. If the global binary is unavailable, use: `npm exec --yes --package=@cecilialabs/ffmpeg -- cecilia-ffmpeg `. 4. Use native FFmpeg only when the toolkit lacks the required operation or the user explicitly requests native syntax. ## Associated scripts Use `scripts/run.mjs` with `input.action` set to `attach`, `silence`, `add-silence`, `detect-silence`, `remove-silence`, or `telephony`. Audio inputs, codec/container choices, and output policy stay explicit in `input`; the script returns typed intervals or an FFprobe-backed artifact report. ```bash printf '%s\n' '{"context":"codex","input":{"action":"detect-silence","input":"speech.wav","noiseDb":-35,"minDuration":0.5}}' \ | node skills/ffmpeg-audio/scripts/run.mjs ``` ## Preferred toolkit commands ```bash cecilia-ffmpeg video attach-audio