Reading (and writing?) audio file tags

P

Paul Moore

I'd like to write some scripts to analyze and manipulate my music
files. The files themselves are in MP3 and FLAC format (mostly MP3,
but FLAC where I ripped original CDs and wanted a lossless format).
I've no idea what form of tags are used in the files (ID3v1, ID3v2,
OGG, APE, ...) I just used whatever the program that set them up used.
I'm completely confused by the various tag formats that exist - there
seems to be little standardisation, and quite a few compatibility
pitfalls. For example, I have files with tags using accented
characters - I suspect that this causes some tools to switch format
(because I've seen what looked like corrupt data at times, which
turned out to be the program displaying the "wrong format" of tag).

I've seen various Python libraries that talk about ID3 tag reading -
but I'm not clear if they read other tag formats (many applications
which call themselves "ID3 readers" actually handle multiple formats,
but I don't know if that's true for (Python) libraries. Also, there
seem to be few libraries that will *write* tags.

Is there a good "music file tag handling" library for Python that's
worth looking at? I use Windows, so it would have to be for that
platform, and although I have a compiler, I don't really want to spend
a lot of time collecting and porting/building support libraries, so
I'd be looking for a binary distribution.

In the absence of something suitable, I'll probably go back to dumping
the tags via a generic "MP3 tag reader" program, then manipulate them
as a text file, then try to do some sort of bulk reload.

Thanks,
Paul.
 
D

darren kirby

quoth the Paul Moore:
I'd like to write some scripts to analyze and manipulate my music
files. The files themselves are in MP3 and FLAC format (mostly MP3,
but FLAC where I ripped original CDs and wanted a lossless format).
I've no idea what form of tags are used in the files (ID3v1, ID3v2,
OGG, APE, ...)

Flac files use Vorbis comments, the same that Ogg Vorbis files use. As for
MP3, they use ID3v2 or ID3v1, or both.

Anyway, what you want is Mutagen. It handles both Flac and Mp3 tags, as well
as many others: http://www.sacredchao.net/quodlibet/wiki/Development/Mutagen
I just used whatever the program that set them up used.
I'm completely confused by the various tag formats that exist - there
seems to be little standardisation, and quite a few compatibility
pitfalls. For example, I have files with tags using accented
characters - I suspect that this causes some tools to switch format
(because I've seen what looked like corrupt data at times, which
turned out to be the program displaying the "wrong format" of tag).

I've seen various Python libraries that talk about ID3 tag reading -
but I'm not clear if they read other tag formats (many applications
which call themselves "ID3 readers" actually handle multiple formats,
but I don't know if that's true for (Python) libraries. Also, there
seem to be few libraries that will *write* tags.

ID3 = MP3 only. A lot of people call _all_ tags 'id3' tags to save having to
say 'Flac tags, and Vorbis tags, and Ape tags' etc....these people are the
source of your confusion.
Is there a good "music file tag handling" library for Python that's
worth looking at? I use Windows, so it would have to be for that
platform, and although I have a compiler, I don't really want to spend
a lot of time collecting and porting/building support libraries, so
I'd be looking for a binary distribution.

From the read me: "Mutagen works on Python 2.3+ and has no dependencies
outside the CPython standard library" so it should work on Windows I think.
It is just pure Python so there you go...
In the absence of something suitable, I'll probably go back to dumping
the tags via a generic "MP3 tag reader" program, then manipulate them
as a text file, then try to do some sort of bulk reload.

Thanks,
Paul.

-d
 
P

Paul Moore

quoth the Paul Moore:


Flac files use Vorbis comments, the same that Ogg Vorbis files use. As for
MP3, they use ID3v2 or ID3v1, or both.

Anyway, what you want is Mutagen. It handles both Flac and Mp3 tags, as well
as many others:http://www.sacredchao.net/quodlibet/wiki/Development/Mutagen

Excellent! The web page you mentioned gave "access denied", but I got
to it via Google's cache, and the download link still worked :)

It does seem to build a Windows installer quite happily, so that's a
great start. I'll see how it goes tonight.

Thanks for the pointer.
Paul.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,821
Latest member
AleidaSchi

Latest Threads

Top