Created
April 11, 2020 10:06
-
-
Save joshuaspence/d44bff6fce4bccdb1d12b09a798ef41f to your computer and use it in GitHub Desktop.
ffmpeg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -o errexit | |
set -o nounset | |
set -o pipefail | |
alias ffmpeg='ffmpeg -hide_banner -loglevel warning' | |
function process_video() { | |
local -r VIDEO="$1" | |
test -f "0/${VIDEO}" || { | |
echo "Input file 0/${VIDEO} not found" >&2 | |
return 1 | |
} | |
test -f "1/${VIDEO}" || ffmpeg -i "0/${VIDEO}" -vcodec copy -an "1/${VIDEO}" | |
#test -f "2/${VIDEO}" || test -f "3/${VIDEO}" || ffmpeg -i "1/${VIDEO}" -filter:v 'crop=in_w/2:in_h:in_w/4:0' "2/${VIDEO}" | |
test -f "3/${VIDEO}" || { | |
test -f "2/${VIDEO}" && \ | |
ffmpeg -i "2/${VIDEO}" -r 100 -filter:v 'setpts=PTS/25' "3/${VIDEO}" || \ | |
ffmpeg -i "1/${VIDEO}" -r 100 -filter:v 'setpts=PTS/25' "3/${VIDEO}" | |
} | |
} | |
for INPUT in $@; do | |
process_video "${INPUT}" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment