Can't remember where I got the original script, i have made a couple of small changes.

Basically it converts AVI to mp4 using handbrake on your mac