Here's a 2-liner Ruby script I used to convert everything from wma to mp3 format:
#!/usr/bin/env ruby ext = ".wma" Dir.glob("**/*#{ext}").each {|f| m = f.gsub(ext, '.mp3'); `ffmpeg -i '#{f}' -ab 192k -ac 2 -ar 44100 '#{m}'` }
I got this from https://ariejan.net/2010/09/11/mass-convert-wma-to-mp3-using-ffmpeg-and-ruby but found out that it only worked on .wma files in the directory from which you ran the script. Google and StackOverflow saved the day and helped me to convert the Dir.glob to match all subdirectory levels.
I used:
Dir.glob("**/*#{ext}")
instead of
Dir.glob("*#{ext}")
I've never used Ruby before and probably could've done the same thing in Python but this is the first command line example that came up in google so I dove in and gave it a try...
No comments:
Post a Comment