Skip to content

Instantly share code, notes, and snippets.

@Lucbug
Created April 24, 2018 07:24
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 Lucbug/f555be957ab39428dc4933ce7bc2c96a to your computer and use it in GitHub Desktop.
Save Lucbug/f555be957ab39428dc4933ce7bc2c96a to your computer and use it in GitHub Desktop.
#!/bin/bash
# Uses Gource (http://gource.io) to generate a lossless PPM and a high quality MP4 visualizing the history of a Git repo.
# By Jayden Seric: https://gist.github.com/jaydenseric/df3263eb3c33856c11ce
# Install Gource and FFmpeg with Homebrew:
# brew install gource
# brew install ffmpeg
# Ensure this script can execute:
# chmod +x gource.sh
# Use this script within the root directory of your Git repo.
# Usage:
# <title> <logo path> <avatar directory> <output file base name>
# Example, assuming this script and assets are in ~/Desktop:
# cd ~/Sites/my-project
# ~/Desktop/gource.sh 'Project title' ~/Desktop/team-logo.png ~/Desktop/avatars my-project-visualization
# Adjust MP4 quality via the -crf parameter: 0 is lossless, 23 is FFmpeg default, and 51 is worst possible.
title=$1
logo_path=$2
avatar_dir=$3
output_file_name=$4
frame_rate=60
gource -r $frame_rate --multi-sampling --key --title "$title" --logo $logo_path --user-image-dir $avatar_dir --seconds-per-day .1 -1920x1080 -o ${output_file_name}.ppm
ffmpeg -r $frame_rate -f image2pipe -vcodec ppm -i ${output_file_name}.ppm -c:v libx264 -pix_fmt yuv420p -profile:v baseline -level 3.0 -crf 4 -preset veryslow -an -movflags +faststart -threads 0 ${output_file_name}.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment