Fixed bug in having -s override Handbrake preset bitrates
[rip_dvd/.git] / rip_dvd
diff --git a/rip_dvd b/rip_dvd
index 94b96fc1290499d289da30a0f96aecc8609d6d59..e68012a3f237df2190c5053bbb67477ef8885fd6 100755 (executable)
--- a/rip_dvd
+++ b/rip_dvd
@@ -1094,14 +1094,15 @@ function get_audio_track_from_vob {
   
   # find the stream that matches our aid
   #stream=`grep "Stream.*\[0x$aid_hex\]" $aidcheck`
-  stream=`grep "scan: audio" $aidcheck | grep -n "" | grep "scan: audio 0x$aid_hex"`
+  #stream=`grep "scan: audio" $aidcheck | grep -n "" | grep "scan: audio 0x$aid_hex"`
+  stream=`grep "add_audio_to_title:" $aidcheck | grep -n "" | grep "add_audio_to_title:.* stream 0x$aid_hex"`
  
   # extract the track number that handbrake uses
   #track=`expr match "$stream" '.*#[0-9]\.\([0-9]*\)'`
   track=`expr match "$stream" '^\([0-9]*\):'`
 
   if [ -n "$track" ]; then   
-    echo "-> Setting the audio ID to $aid. Setting the audio track to $track." | tee -a "$logfile"
+    echo "   Setting the audio ID to $aid. Setting the audio track to $track." | tee -a "$logfile"
   fi
 }
 
@@ -1238,6 +1239,7 @@ function calculate_bitrate_from_target_size {
   if [ $target_size -ne 0 ]; then
     vob_length=`mplayer -identify -v "$vobfile" -endpos 0 2>&1 | grep ID_LENGTH | awk -F '=' '{ print $2 }' | awk -F '.' '{ print $1 }'`
     ((target_bitrate = (target_size * 1024 * 8) / vob_length ))
+    custom_bitrate=1
     echo "   With a given target size of $target_size MB, the estimated bit rate will need to be $target_bitrate kbits/sec"
   fi
 }