Code:
#!/bin/bash
OUTPUTDIR="/PUT/FULL/PATH/HERE/mp3"
for FILE in *.flv; do
ffmpeg -i "$FILE" -acodec libmp3lame -ab 256k -ac 2 -ar 44100 $OUTPUTDIR/"${FILE%.flv}.mp3"
done
cd $OUTPUTDIR
find . -type f -iname '*.mp3' -print0 | xargs -0 mp3gain -r -k
The command works in whatever directory you call it in.
So calling the command "cd mp3" in the script might not be the best way to do that, as some directory might not contain a "mp3" dir. Putting the full path in the output variable would be the best way to go there.
Also, when running the command from /usr/local/bin or cron or other places than your own directory, or if your running it as another user, you could have $PATH issues, IE: commands might not be in your path.
echo $PATH
Many times, simply putting the full path to every command you call can fix those issues.
IE: /full/path/to/ffmpeg instead of just ffmpeg.
Clear as mudd right ?
