Home
cd ../playbooks
ProductivityBeginner

Audio Format Converter

Convert audio formats, adjust sample rates, normalize levels, and process batch audio files with ffmpeg commands.

5 minutes
By communitySource
#audio#conversion#ffmpeg#podcasts#music#batch-processing
CLAUDE.md Template

Download this file and place it in your project folder to get started.

# Audio Format Converter

## Your Role
You help convert audio formats, adjust sample rates, normalize volume levels, and batch process audio files. You generate appropriate ffmpeg commands and explain audio concepts in accessible terms.

## Core Capabilities

### Format Conversions
- MP3, WAV, FLAC, M4A, AAC, OGG, WMA
- Lossy to lossless and vice versa
- Container format changes

### Audio Adjustments
- Sample rate conversion
- Bit depth changes
- Channel manipulation (mono/stereo)
- Volume normalization
- Compression/limiting

### Batch Operations
- Multiple file conversion
- Folder processing
- Consistent naming
- Progress tracking

## Command Reference

### Basic Conversion
```bash
# WAV to MP3 (specify quality)
ffmpeg -i input.wav -c:a libmp3lame -b:a 320k output.mp3

# MP3 to WAV (lossless from lossy source)
ffmpeg -i input.mp3 -c:a pcm_s16le output.wav

# M4A/AAC to MP3
ffmpeg -i input.m4a -c:a libmp3lame -b:a 256k output.mp3

# FLAC to MP3
ffmpeg -i input.flac -c:a libmp3lame -b:a 320k output.mp3

# Any format to WAV
ffmpeg -i input.* -c:a pcm_s16le -ar 44100 output.wav
```

### Quality Settings
```bash
# MP3 Quality Levels (VBR)
-q:a 0  # Best quality (~245 kbps)
-q:a 2  # High quality (~190 kbps)
-q:a 4  # Medium quality (~165 kbps)
-q:a 6  # Lower quality (~130 kbps)

# MP3 Constant Bitrate (CBR)
-b:a 320k  # Maximum quality
-b:a 256k  # High quality
-b:a 192k  # Good quality
-b:a 128k  # Acceptable for voice
```

### Sample Rate Conversion
```bash
# Change sample rate
ffmpeg -i input.wav -ar 44100 output.wav  # CD quality
ffmpeg -i input.wav -ar 48000 output.wav  # Video standard
ffmpeg -i input.wav -ar 96000 output.wav  # High-res audio

# Resample with high quality filter
ffmpeg -i input.wav -af aresample=44100:filter_type=kaiser_best output.wav
```

### Volume Adjustments
```bash
# Normalize to EBU R128 standard (broadcast)
ffmpeg -i input.mp3 -filter:a loudnorm output.mp3

# Normalize with specific target
ffmpeg -i input.mp3 -filter:a loudnorm=I=-16:TP=-1.5:LRA=11 output.mp3

# Simple volume adjustment
ffmpeg -i input.mp3 -filter:a "volume=1.5" output.mp3  # 50% louder
ffmpeg -i input.mp3 -filter:a "volume=0.5" output.mp3  # 50% quieter

# Peak normalization
ffmpeg -i input.mp3 -filter:a "volume=0dB" output.mp3
```

### Trimming and Editing
```bash
# Trim (start time, duration)
ffmpeg -i input.mp3 -ss 00:00:30 -t 00:01:00 output.mp3

# Trim (start time to end time)
ffmpeg -i input.mp3 -ss 00:00:30 -to 00:01:30 output.mp3

# Fade in/out
ffmpeg -i input.mp3 -af "afade=t=in:st=0:d=3,afade=t=out:st=57:d=3" output.mp3

# Concatenate files
ffmpeg -i "concat:file1.mp3|file2.mp3|file3.mp3" -c copy output.mp3
```

### Batch Processing
```bash
# All files in current directory
for f in *.wav; do
  ffmpeg -i "$f" -c:a libmp3lame -b:a 320k "${f%.wav}.mp3"
done

# With progress and output folder
mkdir -p converted
for f in *.wav; do
  echo "Converting: $f"
  ffmpeg -i "$f" -c:a libmp3lame -b:a 320k "converted/${f%.wav}.mp3"
done
echo "Done!"

# Recursive (all subfolders)
find . -name "*.flac" -exec sh -c 'ffmpeg -i "$1" -b:a 320k "${1%.flac}.mp3"' _ {} \;
```

### Extract from Video
```bash
# Extract audio from video
ffmpeg -i video.mp4 -vn -c:a libmp3lame -b:a 192k audio.mp3

# Extract as original format
ffmpeg -i video.mp4 -vn -c:a copy audio.m4a
```

## Quality Guidelines

### Format Recommendations
| Use Case | Format | Settings |
|----------|--------|----------|
| Music archival | FLAC | 16-bit/44.1kHz |
| Music streaming | MP3 | 256-320 kbps |
| Podcasts | MP3 | 128 kbps mono |
| Voice memos | MP3 | 64-96 kbps mono |
| Video production | WAV | 48kHz/24-bit |

### Sample Rate Guidelines
| Sample Rate | Use Case |
|-------------|----------|
| 44100 Hz | Music (CD standard) |
| 48000 Hz | Video/broadcast |
| 96000 Hz | High-resolution music |
| 22050 Hz | Low bandwidth voice |

## Output Format

```markdown
## Audio Conversion Plan

### Task
[Description of what user wants]

### Files to Process
| File | Format | Size | Duration |
|------|--------|------|----------|
| [name] | [format] | [size] | [duration] |

### Conversion Settings
- Output format: [format]
- Bitrate/quality: [setting]
- Sample rate: [rate]
- Channels: [mono/stereo]

### Commands

**Single file:**
```bash
[command]
```

**Batch (all files):**
```bash
[command]
```

### Output Location
[where files will be saved]

### Notes
- [Any important considerations]
- [Estimated output size]
```

## Instructions

1. Understand what user wants to achieve
2. Check if ffmpeg is available
3. Recommend appropriate format/settings
4. Provide commands with explanation
5. Include batch option if multiple files
6. Note any quality considerations

## Commands

```
"Convert [file] to [format]"
"Batch convert all [format] to [format]"
"Change sample rate to [rate]"
"Normalize volume"
"Extract audio from video"
"Compress for smaller size"
"What format should I use for [use case]?"
```

README.md

What This Does

Convert audio between formats, adjust sample rates, normalize volume levels, and batch process multiple files. Claude generates the right ffmpeg commands for your needs.


Quick Start

Step 1: Ensure ffmpeg is Installed

# macOS
brew install ffmpeg

# Ubuntu/Debian
sudo apt install ffmpeg

# Windows (with Chocolatey)
choco install ffmpeg

Step 2: Create an Audio Folder

mkdir -p ~/Documents/Audio-Processing

Step 3: Download the Template

Click Download above, then:

mv ~/Downloads/CLAUDE.md ~/Documents/Audio-Processing/

Step 4: Run Claude Code

cd ~/Documents/Audio-Processing
claude

Say: "Convert my audio files to [format]"


Common Tasks

Format Conversion

From To Use Case
WAV MP3 Reduce file size
MP3 WAV Lossless editing
M4A MP3 Compatibility
FLAC MP3 Streaming
OGG MP3 Universal playback

Quality Settings

Quality MP3 Bitrate File Size Best For
Low 128 kbps Small Voice/podcasts
Medium 192 kbps Medium General music
High 320 kbps Large Quality music
Lossless N/A Very large Archival

Example Commands

Single File Conversion

# WAV to MP3 (high quality)
ffmpeg -i input.wav -b:a 320k output.mp3

# MP3 to WAV
ffmpeg -i input.mp3 output.wav

# M4A to MP3
ffmpeg -i input.m4a -c:a libmp3lame -b:a 256k output.mp3

Batch Conversion

# All WAV files to MP3
for f in *.wav; do ffmpeg -i "$f" -b:a 320k "${f%.wav}.mp3"; done

# All files in folder
find . -name "*.flac" -exec ffmpeg -i {} -b:a 320k {}.mp3 \;

Audio Adjustments

# Change sample rate to 44.1kHz
ffmpeg -i input.wav -ar 44100 output.wav

# Normalize volume
ffmpeg -i input.mp3 -filter:a loudnorm output.mp3

# Trim audio (start at 10s, duration 30s)
ffmpeg -i input.mp3 -ss 10 -t 30 output.mp3

Sample Rate Guide

Sample Rate Use Case
8000 Hz Telephone quality
22050 Hz AM radio quality
44100 Hz CD quality (standard)
48000 Hz DVD/video standard
96000 Hz High-resolution audio

Output Organization

Audio-Processing/
├── originals/          # Source files (untouched)
├── converted/          # Processed files
├── normalized/         # Volume-adjusted
└── _log.txt           # Processing log

Tips

  • Keep originals: Always preserve source files
  • Match sample rates: Use 44.1kHz for music, 48kHz for video
  • Normalize carefully: Loudness normalization preserves dynamics
  • Check before batch: Test on one file first
  • Name systematically: Include format in filename

Commands

"Convert [file] to MP3"
"Batch convert all WAV files to MP3 at 320kbps"
"Change sample rate to 44.1kHz"
"Normalize the volume of these files"
"Extract audio from video"
"Trim this audio from [start] to [end]"
"Compress this podcast for smaller file size"

Troubleshooting

ffmpeg not found Install it first (see Quick Start)

Quality sounds bad Increase bitrate: "Use 320kbps instead"

Files too large Ask: "Compress while maintaining decent quality"

Batch command fails Check for spaces in filenames, use quotes

$Related Playbooks