From: Alan J. Pippin Date: Sun, 14 Feb 2010 14:17:11 +0000 (-0700) Subject: Added code to allow a video bitrate and target size to be given on the command line. X-Git-Tag: 2_4~2 X-Git-Url: http://git.pippins.net/embedvideo/.git/%22%22.%24thumbnail.%22/%7Bview%7D?a=commitdiff_plain;h=774cd5372cab8e9265d62cc5e07ce707578cfa89;p=rip_dvd%2F.git Added code to allow a video bitrate and target size to be given on the command line. This allows the code that tries to auto calculate the bitrate from target_size to be overridden. --- diff --git a/rip_dvd b/rip_dvd index e025e57..879920b 100755 --- a/rip_dvd +++ b/rip_dvd @@ -1101,7 +1101,7 @@ function get_audio_track_from_vob { # extract the audio streams in the vob #ffmpeg -i "$vob" > $aidcheck 2>&1 - $handbrake_cli --stop-at 0 -i "$vob" -o /dev/null -v 100 > $aidcheck 2>&1 + $handbrake_cli --stop-at duration:1 -i "$vob" -o /dev/null -v 100 > $aidcheck 2>&1 # find the stream that matches our aid #stream=`grep "Stream.*\[0x$aid_hex\]" $aidcheck` @@ -1247,11 +1247,11 @@ function check_vob_for_a52_crc_errors { function calculate_bitrate_from_target_size { # determine what our bitrate needs to be if a target size was specified instead - if [ $target_size -ne 0 ]; then + if [ $target_size -ne 0 ] && [ $custom_video_bitrate -eq 0 ]; then vob_length=`mplayer -identify -v "$vobfile" -endpos 0 2>&1 | grep ID_LENGTH | awk -F '=' '{ print $2 }' | awk -F '.' '{ print $1 }'` ((target_video_bitrate = (target_size * 1024 * 8) / vob_length )) custom_video_bitrate=1 - echo " With a given target size of $target_size MB, the estimated bit rate will need to be $target_video_bitrate kbits/sec" + echo " With a given target size of $target_size MB, the estimated bit rate will need to be $target_video_bitrate kbits/sec" | tee -a "$logfile" fi }