Created
January 20, 2011 08:44
-
-
Save xiongchiamiov/787592 to your computer and use it in GitHub Desktop.
determine quality of mp3 files
This file contains 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
#!/usr/bin/env ruby | |
require 'shellwords' | |
ARGV.each do |file| | |
info = %x{mediainfo #{Shellwords.escape(file)}}.split("\n") | |
if !info.grep(/Variable/).empty? | |
bitrate = info.grep(/-V (\d+)/){$1}[0] | |
puts "#{file}: Variable bitrate v#{bitrate}" | |
elsif !info.grep(/Constant/).empty? | |
bitrate = info.grep(/([\d\.]+) Kbps/){$1}[0] | |
puts "#{file}: Constant bitrate #{bitrate}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I lost most of my music recently, so while I'm in the process of ripping, I figured I'd re-rip some things I have around in lower qualities. I really couldn't be arsed to look up all these bitrates myself, though, so this is a simple call-and-parse script.
Requires mediainfo and I think Ruby 1.9. Expects you to not pass it anything other than mp3s.
Example (partial) run:
┌─[pearson@Bragi] - [~/music] - [Thu Jan 20, 12:41]
└─[$]> quality Yoko\ Kanno/*/01
Yoko Kanno/Brain Powerd/Brain Powerd - Field of Love/01 - Field of Love.mp3: Constant bitrate 320
Yoko Kanno/Brain Powerd/Brain Powerd OP - In My Dream/01. In My Dream.mp3: Variable bitrate v0
Yoko Kanno/Brain Powerd/Brain Powerd OST 1/01 - Power of The Light.mp3: Constant bitrate 320
Yoko Kanno/Brain Powerd/Brain Powerd OST 2/01. Light of Love.mp3: Constant bitrate 320
Yoko Kanno/Cowboy Bebop OSTs/Cowboy Bebop - Ask DNA Single/01 - WHAT PLANET IS THIS.mp3: Variable bitrate v0
Yoko Kanno/Cowboy Bebop OSTs/Cowboy Bebop - Limited Edition Boxset/Disc 4/01 - Tank! (Live).mp3: Variable bitrate v0
Yoko Kanno/Cowboy Bebop OSTs/Cowboy Bebop - Limited Edition Boxset/Disc 5/01 - Wandering Cowboy with vocals by Ed.mp3: Variable bitrate v0
Yoko Kanno/Cowboy Bebop OSTs/Cowboy Bebop OST 1/01 - Tank!.mp3: Variable bitrate v0
Yoko Kanno/Cowboy Bebop OSTs/Cowboy Bebop OST 2 - No Disc/01 - American Money.mp3: Variable bitrate v0
Yoko Kanno/Cowboy Bebop OSTs/Cowboy bebop OST 3 - BLUE/01 - BLUE.mp3: Variable bitrate v0
Yoko Kanno/Cowboy Bebop OSTs/Cowboy Bebop - Tank! THE! BEST!/01 - Tank! (TV stretch).mp3: Variable bitrate v0
Yoko Kanno/Cowboy Bebop OSTs/Cowboy Bebop The Movie - FUTURE BLUES/01 - 24hours OPEN.mp3: Variable bitrate v0
Yoko Kanno/Cowboy Bebop OSTs/Cowboy Bebop - Vitaminless/01 - The Real Folk Blues.mp3: Variable bitrate v0
Yoko Kanno/Cowboy Bebop OSTs/Cowgirl Ed OST/01 - Goodnight Julia.mp3: Variable bitrate v0
Yoko Kanno/Earth Girl Arjuna/Earth Girl Arjuna OST 1/01 - Early Bird.mp3: Variable bitrate v2
Yoko Kanno/Earth Girl Arjuna/Earth Girl Arjuna OST 2/01 - Gold Fish.mp3: Variable bitrate v2