.m4a a .mp3

# Convert .m4a files in a given directory to .mp3, removing the .m4a files as
# we go.
function m4a2mp3 {(
cd
"${1:-.}" &&
for f in *.m4a
do ffmpeg -i "$f" -ab 320k -acodec libmp3lame "${f%.m4a}.mp3" && rm "$f"
done
)}


# Another way, using find to discover all .m4a files, at any depth.
function m4a2mp3 {(
cd
"${1:-.}" &&
find
. -type f -name '*.m4a' -print0 | while read -r -d '' f
do ffmpeg -i "$f" -ab 320k -acodec libmp3lame "${f%.m4a}.mp3" && rm "$f"
done
)}