Skip to content

Instantly share code, notes, and snippets.

@thomastraum
Forked from miketucker/gist:2775466
Created May 24, 2012 14:09
Show Gist options
  • Save thomastraum/2781770 to your computer and use it in GitHub Desktop.
Save thomastraum/2781770 to your computer and use it in GitHub Desktop.
Encode some h264 videos, multithreaded boo yah
require 'rubygems'
require 'streamio-ffmpeg'
threads = []
i = 1
Dir.glob('*.avi') do |f|
j = i.to_s
threads.push Thread.new {
begin
movie = FFMPEG::Movie.new(File.absolute_path(f));
movie.transcode(j+'.mp4') { |progress| puts j + ": " + progress.to_s }
rescue
puts "shit!"
end
}
i += 1
end
threads.each {|t| t.join }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment