unix4artists/im/title.sh

42 lines
837 B
Bash
Raw Normal View History

2021-05-08 16:53:26 +00:00
#!/bin/bash -e
#####################################################
#
# This script will create a 15 second title with a
# 5 second fade in and a 5 second fade out
#
# Usage: bash im/title.sh <title text> <output video>
#
#####################################################
TEXT="${1}"
OUTPUT="${2}"
# Check if output file extension is .mov
if [[ "${OUTPUT}" != *".mov" ]]; then
echo "Please use an .mov extension on your output file argument"
exit 1
fi
convert -size 1280x720 \
-background black \
-fill white \
-gravity Center \
-weight 700 \
-pointsize 200 \
label:"${TEXT}" \
title.png
ffmpeg -loop 1 \
-framerate 24 \
-f image2 \
-i title.png \
-s 1280x720 \
-vf "fade=t=in:st=0:d=5,fade=t=out:st=10:d=5" \
-c:v prores_ks \
-profile:v 3 \
-t 15 \
"${OUTPUT}"
# Clean up by removing the image
rm title.png