diff --git a/av/video-compress b/av/video-compress index 90c93e9..a0a2ffc 100755 --- a/av/video-compress +++ b/av/video-compress @@ -116,6 +116,7 @@ preset="compress" overwrite="" if [[ -z "$1" ]]; then helpexit; fi +argcount=0 for (( i=1; i<=$#; i++ )); do [[ ${!i} = "-h" ]] && helpexit [[ ${!i} = "-low" ]] && { @@ -124,27 +125,27 @@ for (( i=1; i<=$#; i++ )); do abit=64 resize="-s hd480" preset="low" - shift 1 + argcount=$(( argcount + 1 )) } [[ ${!i} = "-med"* ]] && { FORCE=1 crf=23 abit=96 preset="med" - shift 1 + argcount=$(( argcount + 1 )) } [[ ${!i} = "-high" ]] && { FORCE=1 crf=18 abit=128 preset="high" - shift 1 + argcount=$(( argcount + 1 )) } [[ ${!i} = "-yify" ]] && { FORCE=1 YIFY_PRESET=1 preset="yify" - shift 1 + argcount=$(( argcount + 1 )) } [[ ${!i} = "-custom"* ]] && { FORCE=1 @@ -156,14 +157,14 @@ for (( i=1; i<=$#; i++ )); do if [[ -n "$resize" ]]; then resize="-s $resize" fi - shift 1 + argcount=$(( argcount + 1 )) } [[ ${!i} = "-y" ]] && { overwrite="-y" - shift 1 + argcount=$(( argcount + 1 )) } done - +shift $argcount compression="-g 250 -c:v libx264 -crf $crf" audio="-c:a aac -ar 44100 -b:a ${abit}k -strict -2" if [[ "$YIFY_PRESET" -eq 1 ]]; then