Created
June 4, 2018 21:54
-
-
Save Calinou/697eeeecda4d15a0ef07842e1b97f418 to your computer and use it in GitHub Desktop.
Render text overlays for use with the Blender Video Sequence Editor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Renders text captions for videos; targeted at Blender usage. | |
# Usage: ./render.sh | |
# | |
# Copyright © 2018 Hugo Locurcio | |
# Licensed under CC0 1.0 Universal: https://creativecommons.org/publicdomain/zero/1.0/ | |
set -euo pipefail | |
IFS=$'\n\t' | |
# Read entries from a file (one per line) | |
texts_file="texts.txt" | |
echo "Removing old images…" | |
rm -f *.png | |
while read -r text; do | |
output="$(echo "$text" | sed "s/\\( \\|'\\|:\\)/_/g").png" | |
echo -e "Rendering \e[1m$text\e[0m…" | |
convert \ | |
-size "1920x1080" \ | |
xc:none \ | |
-fill "hsla(250, 65%, 12%, 0.8)" \ | |
-draw "rectangle 0,880,960,1000" \ | |
-fill "white" \ | |
-gravity "SouthWest" \ | |
-font "Montserrat-SemiBold" \ | |
-interword-spacing "18" \ | |
-pointsize "56" \ | |
-draw "text 85,105 \"${text^^}\"" \ | |
"$output" | |
done < "$texts_file" | |
echo -e "\e[1;32mDone rendering.\e[0m" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment