resizing script for updated videos

This commit is contained in:
Jörn-Michael Miehe 2020-09-06 16:28:38 +02:00
parent 3261984eb7
commit 06706b0346
5 changed files with 32 additions and 0 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

32
ui/public/fake_api/resize Executable file
View file

@ -0,0 +1,32 @@
#!/bin/bash
# complain if no input file given
if [ $# -lt 1 ]; then
>&2 echo "usage: $0 <input_file>"
exit 1
fi
# get input video name
input="${1}"
shift 1
# without file extension
output_base="${input%.*}"
# common video resolutions
heights=(240 360 480)
widths=(426 640 854)
# just a quick-and-dirty loop
for index in $(seq 0 2); do
height="${heights[$index]}"
width="${widths[$index]}"
# actual conversion
ffmpeg -i "${input}" \
-acodec aac -vcodec h264 \
-vf "scale=w=${width}:h=${height}:force_original_aspect_ratio=decrease,pad=${width}:${height}:(ow-iw)/2:(oh-ih)/2" \
"${output_base}_${height}.mp4"
done
exit 0