#!/usr/bin/env ruby if ARGV.size < 1 puts 'usage: ruby ust2smile.rb ' exit end ffmpeg = '/opt/local/bin/ffmpeg' options = '-y -f mp4 -vcodec libx264 -b 64k -bt 64k -r 6 -acodec libfaac -ar 22050 -ab 24k -ac 1 -async 1 -threads 0' ARGV.each do |in_file| out_file = "#{File.basename(in_file, '.flv')}_smile.mp4" 2.times do |n| cmd = "#{ffmpeg} -pass #{n+1} -i #{in_file} #{options} #{out_file}" puts cmd system cmd end puts "\nconversion succeed: #{in_file} => #{out_file}" end