-
-
Save thomastraum/2781770 to your computer and use it in GitHub Desktop.
Encode some h264 videos, multithreaded boo yah
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
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