MP4 to MP3 one liner

02 Feb 2006

I wanted to listen to the excellent Structure and Interpretation of Computer Programs lectures on my way to work, but they're all in MP4 format - i.e., video with audio. To extract the audio was a mere one-liner in Ruby:

 ruby -e 'Dir.glob("*.MP4").each {|f| `faad -o - #{f} | lame -h - #{f.gsub(/MP4/, "mp3")}` }'

Of course, all the real work is done by faad and lame, but, still!

After listening to the first couple of lectures I'm not sure exactly how much I'm getting out of the audio-only version; there's a lot of chalk-on-blackboard noise and code examples that I can't see. But the instructor commentary is interesting nonetheless, and it sure beats talk radio.