Skip to content

Instantly share code, notes, and snippets.

@LukasReschke
Created August 31, 2012 14:06
Show Gist options
  • Select an option

  • Save LukasReschke/3553101 to your computer and use it in GitHub Desktop.

Select an option

Save LukasReschke/3553101 to your computer and use it in GitHub Desktop.
Converts all mp3 files in a directory to 128kbit/s if necessary
#!/bin/bash
# Requirements: ffmpeg, mp3info
# Do a "mkdir output" before execution
for f in *.mp3; do
if [ "$(mp3info -r m -p %r "$f")" -ge 128 ]; then
ffmpeg -y -i "$f" -ab 128k "output/${f%.mp3}.mp3"
else
cp "$f" "output/$f"
fi; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment