Skip to content

Instantly share code, notes, and snippets.

@badsyntax
Forked from PhiSYS/multiple-gource.sh
Created April 8, 2022 08:19
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 badsyntax/a006a4be403d15da4e1ebc7bbe39b0ec to your computer and use it in GitHub Desktop.
Save badsyntax/a006a4be403d15da4e1ebc7bbe39b0ec to your computer and use it in GitHub Desktop.
Create multiple repositories visualization video using gource and ffmpeg
#!/usr/bin/bash
declare -a repos=(
"$HOME/Projects/myproject/testing/.git"
"$HOME/Projects/myproject/testing-bundle/.git"
"$HOME/Projects/myproject/service-skeleton/.git"
"$HOME/Projects/myproject/documentation-web/.git"
"$HOME/Projects/myproject/documentation-api/.git"
"$HOME/Projects/myproject/coding-standard/.git"
"$HOME/Projects/myproject/context/microservice1/.git"
"$HOME/Projects/myproject/context/microservice2/.git"
"$HOME/Projects/myproject/context/microservice3/.git"
"$HOME/Projects/myproject/context/microservice4/.git"
)
declare -a logs=(
"$HOME/Projects/myproject/vendor.testing.gource"
"$HOME/Projects/myproject/vendor.testing-bundle.gource"
"$HOME/Projects/myproject/service-skeleton.gource"
"$HOME/Projects/myproject/documentation-web.gource"
"$HOME/Projects/myproject/documentation-api.gource"
"$HOME/Projects/myproject/vendor.coding-standard.gource"
"$HOME/Projects/myproject/context.microservice1.gource"
"$HOME/Projects/myproject/context.microservice2.gource"
"$HOME/Projects/myproject/context.microservice3.gource"
"$HOME/Projects/myproject/context.microservice4.gource"
)
# get length of an array
arraylength=${#repos[@]}
# use for loop to read all values and indexes
for (( i=0; i<${arraylength}; i++ ));
do
gource --output-custom-log "${logs[$i]}" "${repos[$i]}"
#Delete directories up to myproject
branch=${logs[$i]##*/myproject/}
#Strips extension .gource:
branch=${branch%.gource}
#Escapes slash
branch=${branch/./\\\/}
sed -i -r "s#(.+)\|#\1|/$branch#" "${logs[$i]}"
done
cat ${logs[@]} | sort -n > "$HOME/Projects/myproject/combined.gource"
rm ${logs[@]}
gource "$HOME/Projects/dosfarma/combined.gource" -1920x1080 --camera-mode overview --auto-skip-seconds 1 --seconds-per-day 5 --file-idle-time 0 --date-format "%y/%m/%d %T" --title "My Project" --hide mouse,progress -bloom-multiplier 0.6 --bloom-intensity 0.6 -r 60 -o - | ffmpeg -r 60 -f image2pipe -vcodec ppm -i - -c:v libx265 -profile:v main444-10 -preset:v slower -crf:v 20 -x265-params "aq-mode=3" -y "$HOME/Videos/myproject.HEVC.mkv"
if [ $? -eq 0 ]; then
rm "$HOME/Projects/myproject/combined.gource"
ffmpeg -i "$HOME/Videos/myproject.HEVC.mkv" -filter:v "fps=fps=30,format=yuv420p" -c:v libx264 -profile:v high -preset:v slower -tune animation -crf:v 24 -x264-params "aq-mode=3" -movflags faststart -y "$HOME/Videos/myproject.AVC.mp4"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment