Last active
August 29, 2015 14:13
-
-
Save pikesley/d8a7ba5e4f8ab1970f11 to your computer and use it in GitHub Desktop.
Generative art with Gource - https://vimeo.com/117098506
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The Ruby is terrible but it works, and Gource and ffmpeg can only be understood with the bamboo headphones on |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'date' | |
require 'fileutils' | |
require 'git' | |
root = '/tmp/movie' | |
alpha = 'abcdefghijklmnop'.split('') | |
extensions = %w{rb css py java c h erb png jpeg yml} | |
start_date = Date.parse '1970-01-01' | |
FileUtils.rm_rf root | |
FileUtils.mkdir_p root | |
g = Git.init root | |
1600.times do |i| | |
path = ['one/', 'two/', 'three/', 'four/'].sample | |
Random.rand(alpha.count - 1).times do |j| | |
path << alpha.sample | |
path << '/' | |
end | |
file = "file.#{extensions.sample}" | |
here = Dir.pwd | |
Dir.chdir root | |
FileUtils.mkdir_p path | |
FileUtils.touch "#{path}/#{file}" | |
command = "git add #{path}/#{file}" | |
system command | |
command = "GIT_AUTHOR_DATE=#{start_date.to_s}T12:00:00 GIT_COMMITTER_DATE=#{start_date.to_s}T12:00:00 git commit --allow-empty -m 'Creating Art'" | |
system command | |
Dir.chdir here | |
start_date += 1 | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd /tmp/movie | |
gource -s 1 -1024x768 -a 1 -r 60 --multi-sampling --hide date,filenames,dirnames,users,mouse --colour-images --disable-bloom --camera-mode overview -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 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment