Download HandBrake CLI for your OS here.
cd
into the folder where you have the HandBrakeCLI file and run this inside it:
./HandBrakeCLI -i /path/to/input.mov -o /path/to/output.mp4 -e x264 -q 28 -r 15 -B 64 -X 1280 -O
Done!
Reference:
http://thanhsiang.org/faqing/node/196
root@ubuntu:/handbrake_test# ls -l --block-size=M
total 1118M
-rw-r--r-- 1 root root 631M Jan 7 22:00 input.mp4
-rw-r--r-- 1 root root 488M Jan 7 23:14 output.mp4