Created
May 23, 2012 14:17
-
-
Save miketucker/2775466 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', "-acodec libmp3lame -ar 48000 -ab 128k -ac 2 -vcodec libx264 -b 600k -strict experimental") { |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