Skip to content

Instantly share code, notes, and snippets.

@bokunodev
Created May 6, 2021 21:43
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 bokunodev/5f4dde31b62e6724a8b4be3fdc466b45 to your computer and use it in GitHub Desktop.
Save bokunodev/5f4dde31b62e6724a8b4be3fdc466b45 to your computer and use it in GitHub Desktop.
Batch convert flac to mp3 using ffmpeg with configurable quality
#!/bin/bash
if [ $MP3_QUALTY -eq "" ] ; then
MP3_QUALTY=3
fi
if [ $MP3_COMPRESSION -eq "" ] ; then
MP3_COMPRESSION=0
fi
if [ $OVERWRITE -ne "" ] ; then
OVERWRITE="-y"
fi
for i in *.flac ; do
ffmpeg -i "$i" -c:a libmp3lame -q:a $MP3_QUALTY -compression_level $MP3_COMPRESSION -vsync 2 -threads `nproc` $OVERWRITE "mp3/$i.mp3";
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment