Skip to content

Instantly share code, notes, and snippets.

@josuecau
Last active February 2, 2019 12:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josuecau/f5796fdc9c675a6427d999ad467d7d31 to your computer and use it in GitHub Desktop.
Save josuecau/f5796fdc9c675a6427d999ad467d7d31 to your computer and use it in GitHub Desktop.
Convert FLAC to MP3 using ffmpeg(1)
#!/usr/bin/env bash
#
# Convert FLAC to MP3 using ffmpeg(1)
# Source: https://stackoverflow.com/a/26109838/2397516
set -e
if [ $# -lt 1 ]; then
echo "Usage: $(basename "$0") /files/to/convert"
exit 1
fi
if ! type ffmpeg >/dev/null 2>&1; then
echo 'ffmpeg(1) not found'
exit 1
fi
find "$1" -name "*.flac" -exec ffmpeg -i {} -ab 320k -loglevel warning \
-map_metadata 0 -id3v2_version 3 -vsync 2 {}.mp3 \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment