shell script to convert all wav files in the current working directory to mp3 files using ffmpeg
#!/bin/bash
FILES=*.wav
for f in $FILES
do
# echo "Processing ${f/.wav/.mp3} file..."
echo "Processing $f file..."
ffmpeg -i "$f" -codec:a libmp3lame -qscale:a 0 "${f/.wav/.mp3}"
# take action on each file. $f store current file name
# cat $f
done
# Source:
# file looping - https://www.cyberciti.biz/faq/bash-loop-over-file/
# string manipulation - http://www.tldp.org/LDP/abs/html/string-manipulation.html
# ffmpeg mp3 encoding guide - https://trac.ffmpeg.org/wiki/Encode/MP3