0

A few cool videos from Google Tech Talks

I keep meaning to find some interesting podcasts and online lectures. There’s a ton of material out there, but so much of it sucks. Anyway, browsing the topic “What are the best Google Tech Talks” on Stackoverflow, I found the following, which I now link for your viewing pleasure:

XKCD visits Google – Very funny and interesting, but perhaps less enjoyable unless you’re an xkcd fanboy like me. Jump to 21:30 where xkcd answers a joking question from Donald Knuth.

PolyWorld: Using Evolution to Design Artificial Intelligence – An interesting A-Life experiment/visualization. Jump to 5:35 for some really neat video of an older program that evolves different body morphologies for efficient movement in a simulated physical environment. (I think this is the original work the speaker is citing)

The Next Generation of Neural Networks – The speaker flies through the intro material much too fast for me to understand with only a rudimentary knowledge of NN. Nevertheless, the demo at 21:35 is cool, as is the discussion around 31:40 of using these layered NN for document clustering and classification.

0

Batch Extracting MP3s from YouTube Videos

Last night I wanted to extract audio tracks from a number of YouTube videos that I’d downloaded using youtube-dl. Being only a so-so shell scripter, I’ve always resorted to ugly for-loops when manipulating multiple files. This invariably ends badly when my loop improperly handles whitespace and mangles the filenames.

No more! Skimming a tutorial last night I stumbled on something that heavy shell users already know: the -exec parameter for the find command. This allows you to specify a command to run on everything that find finds. In the case of extracing audio from MP3s, it works like this:

find . -name '*.flv' -exec ffmpeg -i '{}' '{}.mp3' ';'

This command looks in the current directory for flv files and uses ffmpeg to extract the audio to another file with the same name, plus the .mp3 extension. The funny brackets {} are substituted for the file name.

A downside to this approach – your files end up with names like .flv.mp3 instead of .mp3. If that bothers you, you can fix it with the rename command which uses regexes to rename files:

rename 's/\.flv\.mp3/\.mp3/' *.flv.mp3

Ubuntu users like myself will need to install ffmpeg and ubuntu-restricted-extras to get the necessary encoder.

There are certainly lots of other ways to encode a directory worth of files, but I think this one is pretty cool.