content/video.sh

25 lines
569 B
Bash

#/bin/bash
W=800
H=600
TMP=$(mktemp -d)
ffmpeg -ss 460 -i "${1}" -r 8 -t 30 -vf "scale=-1:34,crop=19:34:(iw-19)/2:0" "${TMP}/frame_%06d.png"
QR=$(mktemp -d)
source env/bin/activate
for FILE in "${TMP}/"*; do
FILENAME=$(basename "${FILE}")
echo "${FILENAME}..."
bash generate.sh "${FILE}" "${QR}/${FILENAME}"
done
deactivate
ffmpeg -y -framerate 8 -pattern_type glob -i "${QR}/frame_"'*.png' -c:v libx264 -r 24 -pix_fmt yuv420p -vf "scale=${W}:${H}:force_original_aspect_ratio=decrease,pad=${W}:${H}:-1:-1:color=white" "${2}"
rm -rf "${QR}"
rm -rf "${TMP}"