All pastes #877797 Raw Edit

aac2mp3.rb

public ruby v1 · immutable
#877797 ·published 2008-01-29 11:42 UTC
rendered paste body
#!/usr/bin/ruby -wabort("usage: #{$0} file_to_encode") if ARGV.size == 0STDOUT.sync = trueARGV.map do |f|  abort("File #{f} doesn't exist. Quit") unless File.exist? f  ext = File.extnname(f)  name = File.basename(f,ext) + '.mp3'  print "Convert: '#{name}' ..."  `mplayer -ao pcm:fast '#{f}'`  `lame -b 320 audiodump.wav '#{name}'`  `rm audiodump.wav`  puts "done."end