Improving Gource Videos with Background and Audio
Gource videos have been popping up on my radar for several years now, but for some reason I decided to play around with it yesterday. My tweaks were very minor: much increased speed, avatars, a logo, a background image, and some music to go along with it.
I started with the avatars. To grab them, I used this script with a quick replacement for the error handling:
if($rc != 200) {
unlink($author_image_file);
my $gh_url = "https://avatars.githubusercontent.com/".$author."?size=".$size;
warn "fetching gh image for '$author' $email ($gh_url)...\n";
my $rc = getstore($gh_url, $author_image_file);
next;
}
sleep(1);
That way users without Gravatars but a GitHub username in their commit message still get the one you’re used to seeing. I manually deleted all of the default GitHub no avatar images. That sounds like a lot of work, but you can just sort by size.
I did a quick inversion of the KOReader logo in GIMP. Nothing special there.
The background image I grabbed from Pixabay, a useful site for free photographs. The music I got from dig.ccmixter.org, something similar for music.
Now for the pièce de résistance, thanks to the Gource wiki:
gource -1920x1080 -a 0.1 -s 0.05 -i 0 --logo koreader-logo-inverted.png --user-image-dir .git/avatar/ --background-image fairyland-canyon-1632749_1920.jpg -o - | ffmpeg -y -r 60 -f image2pipe -vcodec ppm -i - -vcodec libx264 -preset ultrafast -pix_fmt yuv420p -crf 1 -threads 0 -bf 0 gource.mp4
The most important aspect is the resolution and how fast or slow you want the video to be. Then once you have the video, you can mix in the audio:
ffmpeg -i gource.mp4 -i mindmapthat_-_Transmutation.mp3 -c:v copy -c:a aac -strict experimental -filter:a "volume=0.6" gource-muxed.mp4
Note that I lowered the volume of the music, more on that here. You could also play around with fade-outs, whether in Audacity or straight from ffmpeg. Also see my post on lossless audio cutting for when everything is good but you just want to trim the audio a little. That’s all!