Skip to content

Instantly share code, notes, and snippets.

@VuokkoVuorinnen
Created May 22, 2014 08:37
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 VuokkoVuorinnen/c897f0aa64209270bc78 to your computer and use it in GitHub Desktop.
Save VuokkoVuorinnen/c897f0aa64209270bc78 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Generate a gource video, and upload it to YouTube
# If you have problems with the built in ffmpeg,
# you might want to try and compile it yourself:
#
# https://gist.github.com/taeram/4552318
# fail fast
set -e
REPO_DIR=$1
REPO_NAME=$2
VIDEO_RESOLUTION=1920x1080
VIDEO_FRAMERATE=30
if [ -z "$REPO_DIR" ] || [ -z "$REPO_NAME" ]; then
echo "Usage: "`basename $0`" [git-repo-directory] [repo-name]"
exit 1
fi
if [ -z `which gource` ] || [ -z `which ffmpeg` ] | [ -z `which google` ]; then
sudo apt-get install gource ffmpeg googlecl
fi
# Generate the video
echo
echo "*** Generating the video"
VIDEO_FILE=`mktemp --suffix=.mp4`
gource -${VIDEO_RESOLUTION} -o - --date-format "%B %e, %Y" --auto-skip-seconds 1 --elasticity 0.03 --time-scale 4.0 --seconds-per-day 0.1 --file-idle-time 0 --hide bloom,dirnames,filenames,mouse,progress,users,usernames --output-framerate $VIDEO_FRAMERATE --title "$REPO_NAME" "$REPO_DIR" | \
ffmpeg -y -r $VIDEO_FRAMERATE -f image2pipe -vcodec ppm -i - -vcodec libx264 -preset ultrafast -crf 1 -threads 0 -bf 0 "$VIDEO_FILE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment