Tuesday, October 14, 2008

How to discover the artist and name of music embedded in a video (in Linux)

It has gotten a lot easier to discover the artist of a song you hear on the radio or in a movie nowadays. Most of the times its sufficient to take down some of the lyrics and do a google search on them. But sometimes it is not so simple - think about electronica or other music without lyrics. I have a couple of clips on my computer which include samples of music that I would love to know the artist of. How, then can I find out? Here is one way that I've found (if there are better ways, please let me know by leaving a comment).

First, you need to extract the audio from the video file. For avi, mpg, or flv files you can do either:

ffmpeg -i my_video_file.avi extracted_audio.mp3


mplayer -dumpaudio my_video_file.avi -dumpfile extracted_audio.mp3

You may need to extract the part that you want using Audacity. Now the question is: How do we go about identifying the extracted audio?

The method I used was to install MusicBrainz Picard. which can use audio fingerprinting to identify the track. Install it and open it up. Click "Add Files" and upload your file. Double click on it and remove any potentially confusing metadata (it will assume that the filename is the name of the track). Click scan. If it has a match, it will bring up the album in which the track is found. If you have an unmatched file, right click it and do scan again. Hopefully it will identify the track in the album that you were looking for.

No comments: