Adjusted ipod/iphone MP4 encoding settings
[rip_dvd/.git] / rip_dvd
diff --git a/rip_dvd b/rip_dvd
index 44d700080975bbc626bc486e9f47738ad5afbaed..b11c77d7b60656e0a42c86d83223ac3e55aea916 100755 (executable)
--- a/rip_dvd
+++ b/rip_dvd
@@ -109,7 +109,8 @@ function usage() {
     echo >&2 "                 5) If dvdname is a full path to an ISO file, it will be ripped as a DVD instead of $dev"
     echo >&2 "   -p <profile>  Specify which encoding profile to use in -x mode as shown below:"
     echo >&2 "                 - hdtv = AVI, Xvid codec, 2 pass encoding (default)"
-    echo >&2 "                 - ipod = MP4, x264 codec, 2 pass encoding, 576:320 scaling"
+    echo >&2 "                 - iphone = MP4, x264 codec, 2 pass encoding, 480:320 scaling"
+    echo >&2 "                 - ipod = MP4, x264 codec, 2 pass encoding, 320:240 scaling"
     echo >&2 "   -e <ext>      Specify a suffix extension to apply to the end of the final image filename (like .hdtv, .ipod, etc)"
     echo >&2 "                 If you run multiple instances of this script ripping the same DVD, you need to specify this option."
     echo >&2 "   -m            Make a mirror image of the DVD and save it as a DVD ISO file"
@@ -179,7 +180,7 @@ if [ "$aspect" != "" ]; then
   fi
   echo "$aspect" | grep -q ":"
   if [ $? != 0 ]; then
-    SCALE=",scale -zoom -xy $aspect"
+    SCALE=",scale -zoom -sws 9 -xy $aspect"
   else
     SCALE=",scale=$aspect"
   fi
@@ -843,10 +844,22 @@ function compress_vob_file {
  
   fi
 
-  if [ "$profile" == "ipod" ]; then
+  if [ "$profile" == "iphone" ] || [ "$profile" == "ipod" ]; then
     # MP4 encoding 
     found_profile=1
-    SCALE=",scale=576:320"
+    if [ "$profile" == "iphone" ]; then
+      # SCALE: 480x320
+      # scale width to 480, set height appropriately, but keep a multiple of 16
+      #SCALE=",scale=480:-10"
+      # scale the video down however far is necessary to fit in 480x320
+      SCALE=",dsize=480:320:0,scale=-8:-8"
+    else
+      # SCALE: 320x240
+      # scale width to 320, set height appropriately, but keep a multiple of 16
+      #SCALE=",scale=320:-10"
+      # scale the video down however far is necessary to fit in 320x240
+      SCALE=",dsize=320:240:0,scale=-8:-8"
+    fi
     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"
@@ -863,6 +876,8 @@ function compress_vob_file {
     video_encoder_opts[8]="trellis=1"
     video_encoder_opts[9]="level_idc=30"
     video_encoder_opts[10]="global_header"
+    video_encoder_opts[11]="bframes=0"
+    video_encoder_opts[12]="partitions=all"
     for OPTS in "${video_encoder_opts[@]}"; do 
       mencoder_video_encoder_opts="$mencoder_video_encoder_opts:$OPTS"
     done