To convert avi files to mp3s (used this page as reference)
This script converts all the avi files in a folder to mp3s.
for file in .; do for filename in *.avi; do mplayer -dumpaudio "$filename" -dumpfile "$filename".mp3; done; done
Tried the above script, and I kept getting core dumps. Modified it to use ffmpeg instead of mplayer.
for file in .; do for filename in *.avi; do ffmpeg -i "$filename" -ab 128k -vn "${filename%.avi}.mp3"; done; done
To convert mp4 files, I found this at this site. It uses some pretty advanced techniques (at least to me) to pass the output of one program (faad) to another (lame).
I added the -V9 (V9=lowest VBR quality), since I wanted a small file size.
#!/bin/bash
for i in *.m4a; do
echo "Converting: ${i%.m4a}.mp3"
faad -o - "$i" | lame -V9 - "${i%.m4a}.mp3"
done