/extract-audio — Extract Audio from Video
Extract the audio track from MP4 or other video files using ffmpeg. Stream-copies audio without re-encoding for fast, lossless extraction.
Usage
/extract-audio <input.mp4> [output-file]
/extract-audio video.mp4
/extract-audio video.mp4 audio.aac
/extract-audio video.mp4 audio.mp3 # re-encode to MP3
Arguments
| Argument | Required | Description |
|---|---|---|
input | Yes | Path to input video file (MP4, MKV, MOV, etc.) |
output | No | Output audio file (default: <input-name>.aac) |
Execution
Delegates to scripts/extract-audio.sh:
bash scripts/extract-audio.sh <input> [output]
Or call directly:
# Stream-copy (lossless, fast — preserves original codec)
ffmpeg -i input.mp4 -vn -acodec copy output.aac
# Re-encode to MP3 (if needed)
ffmpeg -i input.mp4 -vn -acodec libmp3lame -q:a 2 output.mp3
# Re-encode to WAV (uncompressed)
ffmpeg -i input.mp4 -vn -acodec pcm_s16le output.wav
Prerequisites
brew install ffmpeg # macOS
apt install ffmpeg # Linux
Output Formats
| Format | Flag | Use Case |
|---|---|---|
| AAC (default) | -acodec copy | Lossless stream copy from MP4 |
| MP3 | -acodec libmp3lame | Wide compatibility |
| WAV | -acodec pcm_s16le | Uncompressed, editing |
| FLAC | -acodec flac | Lossless compressed |
| OGG | -acodec libvorbis | Open source |
Related
/mp4-audio-extractionskill — batch processing and format conversion patternsscripts/extract-audio.sh— underlying script
Completion Checklist
- ffmpeg installed and accessible
- Input file exists and is a valid video
- Output file created at expected path
- Audio plays back correctly
Author: Claude (Opus 4.6) Track: H (Framework) Created: 2026-02-19