77
88about () {
99    cat << EOF 
10- $program  5.8  of January 21 , 2015
10+ $program  5.9  of January 22 , 2015
1111Copyright (c) 2013-2015 Don Melton 
1212EOF 
1313    exit  0
@@ -42,7 +42,7 @@ usage() {
4242    --slow, --slower, --veryslow 
4343                    use x264 encoder preset to trade speed for compression 
4444    --crop T:B:L:R  set video crop values (default: 0:0:0:0) 
45-                         (use \` detect- crop.sh \`  script for optimal bounds ) 
45+                         (use \` -- crop detect \`  to invoke  \` detect-crop.sh \` ) 
4646                        (use \` --crop auto\`  for \` HandBrakeCLI\`  behavior) 
4747    --720p          constrain video to fit within 1280x720 pixel bounds 
4848    --audio TRACK   select main audio track (default: 1) 
@@ -51,6 +51,7 @@ usage() {
5151    --version       output version information and exit 
5252
5353Requires \` HandBrakeCLI\`  executable in \$ PATH. 
54+ Requires \` detect-crop.sh\`  script in \$ PATH when using \` --crop detect\` . 
5455Output and log file are written to current working directory. 
5556EOF 
5657    exit  0
@@ -86,7 +87,7 @@ Quality options:
8687
8788Video options: 
8889    --crop T:B:L:R  set video crop values (default: 0:0:0:0) 
89-                         (use \` detect- crop.sh \`  script for optimal bounds ) 
90+                         (use \` -- crop detect \`  to invoke  \` detect-crop.sh \` ) 
9091                        (use \` --crop auto\`  for \` HandBrakeCLI\`  behavior) 
9192    --720p          constrain video to fit within 1280x720 pixel bounds 
9293    --1080p             "       "   "   "    "    1920x1080  "     " 
@@ -173,6 +174,7 @@ Other options:
173174    --version       output version information and exit 
174175
175176Requires \` HandBrakeCLI\`  executable in \$ PATH. 
177+ Requires \` detect-crop.sh\`  script in \$ PATH when using \` --crop detect\` . 
176178May require \` mp4track\`  and \` mkvpropedit\`  executables in \$ PATH for some options. 
177179Output and log file are written to current working directory. 
178180EOF 
@@ -606,6 +608,19 @@ if [ -e "$output" ]; then
606608    die " output file already exists: $output " 
607609fi 
608610
611+ if  [ " $crop_values "   ==  ' detect'   ];  then 
612+ 
613+     if  !  $( which detect-crop.sh > /dev/null) ;  then 
614+         die ' script not in $PATH: detect-crop.sh' 
615+     fi 
616+ 
617+     crop_values=" $( detect-crop.sh --title $media_title  --values-only " $input " ) " 
618+ 
619+     if  [ !  " $crop_values "   ];  then 
620+         die " crop ambiguous or unavailable for: $input " 
621+     fi 
622+ fi 
623+ 
609624#  VIDEO
610625# 
611626readonly  size_array=($( echo " $media_info "   |  sed -n ' s/^  + size: \([0-9]\{1,\}\)x\([0-9]\{1,\}\).*$/\1 \2/p' )  )
0 commit comments