Skip to content

Instantly share code, notes, and snippets.

@richard512
Last active May 30, 2018 23:24
Show Gist options
  • Save richard512/be9184f393fb4acd9e0922e7f720d9f3 to your computer and use it in GitHub Desktop.
Save richard512/be9184f393fb4acd9e0922e7f720d9f3 to your computer and use it in GitHub Desktop.
Linux BASH script to convert all webm and mp4 video files in a directory to mp3
for FILE in music/*.{mp4,webm}; do
if [ ! -f "${FILE%.webm}.mp3" ]; then
#echo "File not found: ${FILE%.webm}.mp3"
echo -e "Processing video '\e[32m$FILE\e[0m'";
ffmpeg -i "${FILE}" -vn -ab 128k -ar 44100 -y "${FILE%.webm}.mp3";
fi
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment