Skip to content

Instantly share code, notes, and snippets.

@markhalliwell
Last active August 6, 2020 11:12
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markhalliwell/39f4f19a287ce9d439baab45f8c26ac6 to your computer and use it in GitHub Desktop.
Save markhalliwell/39f4f19a287ce9d439baab45f8c26ac6 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
[ ! -d .git ] && "This is not a git directory." && exit 1
# Setup the gource info for the repo.
~/gource/setup
# Create the video.
gource --load-config ./.git/gource/config.ini | ffmpeg -y -r 60 -f image2pipe -vcodec ppm -i - -vcodec libx264 -preset ultrafast -pix_fmt yuv420p -crf 1 -threads 8 -bf 0 ./gource.mp4
#!/usr/bin/perl
#fetch Gravatars (from https://github.com/acaudwell/Gource/wiki/Gravatar-Example)
use Cwd;
use strict;
use warnings;
use LWP::Simple;
use Digest::MD5 qw(md5_hex);
my $size = 300;
my $git_dir = cwd() . '/.git';
die("no .git/ directory found in current path\n") unless -d "$git_dir";
my $gource_dir = "$git_dir/gource";
mkdir($gource_dir) unless -d "$gource_dir";
my $output_dir = "$gource_dir/avatar";
mkdir($output_dir) unless -d "$output_dir";
open(GITLOG, q/git log --pretty=format:"%ae|%an" |/) or die("failed to read git-log: $!\n");
my %processed_authors;
while(<GITLOG>) {
chomp;
my($email, $author) = split(/\|/, $_);
# Skip authors we've already processed.
next if $processed_authors{$author}++;
print "Fetching avatar image for \"$author\" - ";
# Skip images we already have.
my $author_image_file = "$output_dir/$author.png";
if (-e "$author_image_file") {
print "done!\n";
next;
}
#try and fetch image
my $grav_url = "http://www.gravatar.com/avatar/" . md5_hex(lc $email) . "?d=404&size=$size";
my $rc = getstore("$grav_url", "$author_image_file");
if ($rc == 200) {
print "done!";
}
else {
unlink($author_image_file);
print "doesn't exist!";
}
print "\n";
}
close GITLOG;
#!/usr/bin/env bash
[ ! -d .git ] && "This is not a git directory." && exit 1
[ ! -d .git/gource ] && mkdir .git/gource
~/gource/gravatar.pl
git tag -l | while read tag; do git log -1 --pretty=format:"%at|$tag%n" $tag ;done | cat > .git/gource/captions.txt
(
cat <<EOF
[display]
multi-sampling=true
output-ppm-stream=-
viewport=1280x720
[gource]
auto-skip-seconds=0.25
background-colour=0000FF
caption-duration=1
caption-file=.git/gource/captions.txt
date-format=%Y-%m-%d
file-idle-time=0
git-branch=8.x-3.x
hide=progress,filenames,mouse
max-file-lag=0.1
seconds-per-day=0.1
title=Drupal Bootstrap (https://www.drupal.org/project/bootstrap)
user-friction=1
user-image-dir=.git/gource/avatar/
EOF
) > .git/gource/config.ini;
@markhalliwell
Copy link
Author

markhalliwell commented Jan 15, 2018

Requirements (macOS):

  • brew install gource
  • brew install ffmpeg
  • iMovie (or similar video editing program)

Installation:

  1. Create a folder named gource in your home directory and save all 3 above files in there.
  2. Modify the gource config in setup.sh to match your project (this is currently setup for the 8.x-3.x branch of https://www.drupal.org/project/bootstrap)

Gource creation:

  1. Navigate to your project and execute ~/gource/setup.sh (this step is important as it will install the gource configuration into the project's .git directory)
  2. Then execute ~/gource/create.sh (will take a while depending on how big the repo is and how fast your computer is)

Once completed there should be a new file in your project root named gource.mp4.

Post-production:

  1. Take gource.mp4 and import into iMovie (or similar video editing program).
  2. Add another clip as an additional layer in the iMovie project that will act as the background layer.
  3. Add a "Blue Screen" effect on the gource.mp4 clip (https://filmora.wondershare.com/imovie/imovie-green-screen-effect.html#part2 or https://blogs.cofc.edu/tlttutorials/2015/10/21/changing-your-videos-background-in-imovie/)
  4. Continue editing to your heart's desire until you get the desired outcome.

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