Recently I needed to convert some avi files to mp4, on linux, so that I could push them to my ipad. Here is the command I used:
/usr/local/bin/handbrake/HandBrakeCLI -i ${file} -o ${file}.mp4 --preset="Normal" --cpu 3
Note you first need to install Handbrake CLI. I took a 64 bit Centos build from here.