Skip to content

Instantly share code, notes, and snippets.

@rowan-m
Created November 20, 2012 14:47
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 rowan-m/4118361 to your computer and use it in GitHub Desktop.
Save rowan-m/4118361 to your computer and use it in GitHub Desktop.
Turn lolcommits into a video slideshow set to music
#! /bin/bash
# Where lolcommits stores its images
LOLCOMMITS_DIR=/home/rowan/.lolcommits
# The subdirectory in the lolcommits directory you want to us
LOLCOMMITS_REPO=project
# Image mask used to blur commit message
BLUR_MASK_IMG=/home/rowan/mask.jpg
# Video frames per second
VIDEO_FPS=4
# Audio track to use for the video
VIDEO_AUDIO=/home/rowan/totes-legal.mp3
# Working directory
WORK_DIR=/home/rowan/Desktop/lol
IMAGES_DIR=$WORK_DIR/images
IMAGES_BLURRED_DIR=$WORK_DIR/images_blurred
mkdir -p $IMAGES_DIR
mkdir -p $IMAGES_BLURRED_DIR
cp -r $LOLCOMMITS_DIR/$LOLCOMMITS_REPO $WORK_DIR
# Renames the images from {commit-hash}.jpg to a date format for ordering
jhead -n$IMAGES_DIR/%Y%m%d-%H%M%S $WORK_DIR/$LOLCOMMITS_REPO/*.jpg
# Blur out the commit message if you work on TOP SECRET projects
for img_in in $IMAGES_DIR/*.jpg
do
img_out=$(basename "$img_in")
convert $img_in $BLUR_MASK_IMG \
-compose blur -define compose:args=7 -composite \
$IMAGES_BLURRED_DIR/$img_out
done
cd $IMAGES_BLURRED_DIR
# Encode the video - play around with the FPS to get something that works for you
mencoder "mf://*.jpg" -mf fps=4 -vf scale=640:480 -o $WORK_DIR/history.avi -ovc x264 -x264encopts bitrate=250 -oac copy -audiofile $VIDEO_AUDIO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment