+ if [ "$profile" == "mp4" ] || [ "$profile" == "mp4hq" ] || [ "$profile" == "mp4vhq" ]; then
+
+ final_output_file="$dest/$dvdname.mp4"
+ mencoder_general_opts="-quiet $lang_opts -passlogfile $passlogfile"
+ mencoder_output_opts="-ofps 30000/1001 -sws 9 -of lavf -lavfopts format=mp4"
+ mencoder_video_filter_opts="-vf harddup$CROP$SCALE";
+ mencoder_video_encoder_opts="-ovc x264 -x264encopts pass=%PASS"
+
+ # Very High Quality (6fps)
+ if [ "$profile" == "mp4vhq" ]; then
+ video_encoder_opts[0]="bitrate=$target_bitrate"
+ video_encoder_opts[1]="threads=$mencoder_threads"
+ video_encoder_opts[2]="subq=6"
+ video_encoder_opts[3]="frameref=5"
+ video_encoder_opts[4]="bframes=3"
+ video_encoder_opts[5]="8x8dct"
+ video_encoder_opts[6]="me=umh"
+ video_encoder_opts[7]="b_pyramid"
+ video_encoder_opts[8]="weight_b"
+ video_encoder_opts[9]="partitions=all"
+ fi
+ # High Quality (13fps)
+ if [ "$profile" == "mp4hq" ]; then
+ video_encoder_opts[0]="bitrate=$target_bitrate"
+ video_encoder_opts[1]="threads=$mencoder_threads"
+ video_encoder_opts[2]="subq=5"
+ video_encoder_opts[3]="frameref=2"
+ video_encoder_opts[4]="bframes=3"
+ video_encoder_opts[5]="8x8dct"
+ video_encoder_opts[6]="b_pyramid"
+ video_encoder_opts[7]="weight_b"
+ fi
+ # Fast
+ if [ "$profile" == "mp4hq" ]; then
+ video_encoder_opts[0]="bitrate=$target_bitrate"
+ video_encoder_opts[1]="threads=$mencoder_threads"
+ video_encoder_opts[2]="subq=4"
+ video_encoder_opts[3]="bframes=2"
+ video_encoder_opts[4]="b_pyramid"
+ video_encoder_opts[5]="weight_b"
+ fi
+
+ for OPTS in "${video_encoder_opts[@]}"; do
+ mencoder_video_encoder_opts="$mencoder_video_encoder_opts:$OPTS"
+ done
+
+ if [ $audio_2ch -eq 0 ]; then
+ # These options produce good 6 channel audio for linux and windows
+ #mencoder_audio_opts="-oac copy"
+ # There are 3 different ways to specify 6 channel encoding. We'll try the other ones in order if one of them fails.
+ #mencoder_audioch_opts[0]="-channels 6 -af channels=6"
+ #mencoder_audioch_opts[1]="-af channels=6"
+ #mencoder_audioch_opts[2]=""
+ mencoder_audio_opts="-oac faac -faacopts mpeg=4:object=2:br=$audio_bitrate:raw"
+ mencoder_audioch_opts[0]="-channels 6 -srate 48000"
+ else
+ # These options produce good 2 channel audio for linux and windows (including the internal mythvideo player)
+ #mencoder_audio_opts="-oac mp3lame -lameopts cbr:br=$audio_bitrate"
+ #mencoder_audioch_opts[0]=""
+ mencoder_audio_opts="-oac faac -faacopts mpeg=4:object=2:br=$audio_bitrate:raw"
+ mencoder_audioch_opts[0]="-channels 2 -srate 48000"
+ fi
+
+ fi
+