I'm trying to convert a bunch of .aac files to .mp3 files in separate subdirectories in a directory. This is the code I've written:
for dir in */
do
OUTPUT_DIR=./mp3
mkdir "$OUTPUT_DIR"
for i in *.aac;
do name=`echo "$i" | cut -d'.' -f1`
echo "$name"
ffmpeg -i "$i" -vn -ar 44100 -ac 2 -b:a 192k "$OUTPUT_DIR/${name}.mp3"
done
done
However this just try to run the commands in the outside directory and gives an error. I'm new at bash so it might be a very simple mistake I'm not seeing.