Skip to content

Instantly share code, notes, and snippets.

@EricReiche
Created September 4, 2012 14:45
Show Gist options
  • Save EricReiche/3621855 to your computer and use it in GitHub Desktop.
Save EricReiche/3621855 to your computer and use it in GitHub Desktop.
Gource multi repo script
#!/usr/bin/env bash
# Generates gource video (h.264) out of multiple repositories.
# Pass the repositories in command line arguments.
# Example:
# <this.sh> /path/to/repo1 /path/to/repo2
# 960x540 is youtube resolution
RESOLUTION="960x540"
outfile="gource.mp4"
i=0
for repo in $*; do
# 1. Generate a Gource custom log files for each repo. This can be facilitated by the --output-custom-log FILE option of Gource as of 0.29:
logfile="$(mktemp /tmp/gource.XXXXXX)"
gource --output-custom-log "${logfile}" ${repo}
# 2. If you want each repo to appear on a separate branch instead of merged onto each other (which might also look interesting), you can use a 'sed' regular expression to add an extra parent directory to the path of the files in each project:
gsed -i -E "s#(.+)\|#\1|/${repo}#" ${logfile}
# using gnu sed on mac, on linux "sed" should work
logs[$i]=$logfile
let i=$i+1
done
combined_log="$(mktemp /tmp/gource.XXXXXX)"
cat ${logs[@]} | sort -n > $combined_log
rm ${logs[@]}
echo "Committers:"
cat $combined_log | awk -F\| {'print $2'} | sort | uniq
echo "======================"
time gource $combined_log \
-s 0.4 \
-i 0 \
-$RESOLUTION \
--hide mouse,filenames,dirnames \
--key \
--stop-at-end \
-o gource.ppm
ffmpeg -y -r 60 -f image2pipe -vcodec libx264 -i gource.ppm -i /Users/ereiche/Music/Dima_Max_Kompass.mp3 -vcodec libx264 -preset ultrafast -crf 1 -threads 2 -bf 0 gource.mp4
# ffmpeg -y -r 60 -f image2pipe -vcodec ppm -i gource.ppm -i /Users/ereiche/Music/Dima_Max_Kompass.mp3 -vcodec libx264 -preset ultrafast -crf 1 -threads 2 -bf 0 gource.mp4
# ffmpeg -i gource.mp4 -s 960x540 -ps 100000000 -vcodec libx264 output.mp4
rm $combined_log
rm /tmp/gource.*
@EricReiche
Copy link
Author

Die ffmpeg Zeile ist ungetestet. Wenn das nicht klappt, die beiden unteren Zeilen stattdessen benutzen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment