How to get the metadata from an .mp3 file?

Someone knows how to get the Title, Artist, Genre of an .mp3 file?
File.stat(“Music.mp3”) does not have all the fields I need.

2 Likes

I guess the best way to do so for now is to use any custom tool for your OS that provides this informations and combine it with System.cmd/3.

This is how it works for Python.

2 Likes

@bentanweihao has an article on his blog that describes it: http://benjamintan.io/blog/2014/06/10/elixir-bit-syntax-and-id3/

back im the day I used some Linux command line tool to do the job, but can’t recall the name.

5 Likes

Wonderful article!

As for the linux command line tool: I have a suspicion that you might be referring to SoX, which is what I have used in the past to extract all kinds of info (both metadata and e.g. frequency spectra) from audio files.

3 Likes