#!/bin/sh
# $1 is the input file $2 is the output file
#encode the file
mencoder -o $2.avi -profile ipod-mpeg4 $1
#split the audio and video so that they can be merged to .mp4
mplayer $2.avi -dumpvideo -dumpfile $2.video.divx
mplayer $2.avi -dumpaudio -dumpfile $2.audio.aac
rm $2.mp4
#merge the audio + video
mp4creator --create=audio.aac $2.mp4
mp4creator --create=video.divx --rate=30 $2.mp4
#make hint lines so that streaming works
mp4creator --hint=1 $2.mp4
mp4creator --hint=2 $2.mp4
#optimize
mp4creator --optimize $2.mp4