# 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`
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
}