Skip to content

Instantly share code, notes, and snippets.

@garrettheaver
Created November 25, 2015 19:17
Show Gist options
  • Save garrettheaver/284e000e867b56d3722d to your computer and use it in GitHub Desktop.
Save garrettheaver/284e000e867b56d3722d to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
$stdin.each_line do |line|
path = line.chomp
base = File.basename(path, '.m4a')
name = File.join(File.dirname(path), "#{base}.mp3")
next if File.exists?(name)
cmd = %(ffmpeg -i "#{path}" -acodec libmp3lame -ab 160k "#{name}" < /dev/null)
puts cmd
puts system(cmd) rescue nil
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment