From fc0a971447c8c80a2e9cc4e919afd69c3e37b8f7 Mon Sep 17 00:00:00 2001 From: Alan Norton Date: Tue, 23 Apr 2024 09:37:52 -0400 Subject: [PATCH] allow -s to process vids with no audio --- bin.Darwin/speed-up | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/bin.Darwin/speed-up b/bin.Darwin/speed-up index 17eda19..abe5f54 100755 --- a/bin.Darwin/speed-up +++ b/bin.Darwin/speed-up @@ -1,11 +1,33 @@ #!/usr/bin/env bash +AUDIO=1 +PARAMS="" +while (( "$#" )); do + case "$1" in + -s|--no-audio) + AUDIO=0 + shift + ;; + *) # preserve positional arguments + PARAMS="$PARAMS $1" + shift + ;; + esac +done +# set positional arguments in their proper place +eval set -- "$PARAMS" + if [ -z "$1" ]; then echo "Usage: speed-up " exit 1 fi input_file="$1" -output_file="${input_file%.*}.faster.${input_file##*.}" -ffmpeg -i "$input_file" -filter_complex "[0:v]setpts=0.625*PTS[v];[0:a]atempo=1.6[a]" -map "[v]" -map "[a]" "$output_file" +if [[ $AUDIO -eq 1 ]]; then + output_file="${input_file%.*}.faster.${input_file##*.}" + ffmpeg -i "$input_file" -filter_complex "[0:v]setpts=0.625*PTS[v];[0:a]atempo=1.6[a]" -map "[v]" -map "[a]" "$output_file" +else + output_file="${input_file%.*}.faster.silent.${input_file##*.}" + ffmpeg -i "$input_file" -filter_complex "[0:v]setpts=0.625*PTS[v]" -map "[v]" -an "$output_file" +fi