Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 29 lines (21 sloc) 681 Bytes
#!/usr/bin/env bash
# ffboxblur: Turn a vertical video into a 16:9 video with blurred sides.
set -eo pipefail
function help {
echo "Usage: ffboxblur <input> <output>"
exit
}
function installed {
cmd=$(command -v "${1}")
[[ -n "${cmd}" ]] && [[ -f "${cmd}" ]]
return ${?}
}
[[ $# -eq 2 && -f $1 && ! -f $2 ]] || help
installed ffmpeg || { >&2 echo "Missing ffmpeg."; exit 1; }
# https://stackoverflow.com/a/30832903/
ffmpeg -i "${1}" \
-filter_complex \
'[0:v]scale=ih*16/9:-1,boxblur=luma_radius=min(h\,w)/20:luma_power=1:
chroma_radius=min(cw\,ch)/20:chroma_power=1[bg];
[bg][0:v]overlay=(W-w)/2:(H-h)/2,crop=h=iw*9/16' \
"${2}"