Skip to content

Instantly share code, notes, and snippets.

@issess
Created October 5, 2022 10:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save issess/9a31892c73cf09a1e78d8bfd7f963745 to your computer and use it in GitHub Desktop.
Save issess/9a31892c73cf09a1e78d8bfd7f963745 to your computer and use it in GitHub Desktop.
test video generator
#!/bin/bash
START_COUNT=0
END_COUNT=2000
SIZEs=( 400x400 1920x1080 )
FPSs=( 30 60 75 90 120)
FONT_SIZE=150
for size in "${SIZEs[@]}"
do
for fps in "${FPSs[@]}"
do
echo "create $fps fps, $size image..."
mkdir -p "${fps}_${size}"
for ((i=START_COUNT; i<=END_COUNT; i++)); do
echo -ne "generate ... ${i}\r"
convert -size $size xc:White -gravity Center -pointsize $FONT_SIZE -font DejaVu-Sans-Mono -annotate 0 "$i" -gravity North -pointsize 30 -annotate 1 "${fps} FPS, ${size}" ${fps}_${size}/$(printf '%04d' $i).png
done
echo "create ${fps} FPS video..."
ffmpeg -y -framerate $fps -pattern_type glob -i "${fps}_${size}/*.png" -c:v libx264 -vf format=yuv420p "${fps}fps_${size}.mp4"
echo "${fps}fps_${size}.mp4 done"
rm -rf "${fps}_${size}"
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment