Created
April 22, 2011 21:32
-
-
Save BinaryMuse/937728 to your computer and use it in GitHub Desktop.
Convert a directory (and subdirectories) full of .flac files to .mp3 using ffmpeg
This file contains hidden or 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 'find' | |
| def convertFile(path) | |
| puts "Converting #{path}" | |
| choppedSafeFilePath = path.chomp(File.extname(path)) | |
| `ffmpeg -i "#{choppedSafeFilePath}.flac" -ar 44100 -ab 128k -y "#{choppedSafeFilePath}.mp3" 2>/dev/null` | |
| end | |
| Find.find("/media/New Volume/song_directory") do |path| | |
| if File.extname(path) == ".flac" | |
| convertFile path | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment