Skip to content

Instantly share code, notes, and snippets.

@20chan
Created July 27, 2022 10:25
Show Gist options
  • Save 20chan/517da462e0ba0aac5fe8e7b33cd5b97e to your computer and use it in GitHub Desktop.
Save 20chan/517da462e0ba0aac5fe8e7b33cd5b97e to your computer and use it in GitHub Desktop.
애플 앱스토어 영상으로 쓸 자동 리사이즈/크롭 스크립트
set -ex
FILE=$1
WIDTH=$2
HEIGHT=$3
OUTPUT=$4
function resize() {
WIDTH=$1
HEIGHT=$2
OUTPUT=$3
ffmpeg -i "$FILE" -vf "scale=(iw*sar)*max($WIDTH/(iw*sar)\,$HEIGHT/ih):ih*max($WIDTH/(iw*sar)\,$HEIGHT/ih), crop=$WIDTH:$HEIGHT" -q:v 4 -c:a libmp3lame -q:a 4 "$OUTPUT"
}
# resize 1920 886 65.mp4
resize 1920 1080 55.mp4
resize 1600 1200 129.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment