Questions tagged [mutagen]

Mutagen is a Python module to handle audio metadata.

Mutagen is a Python module to handle audio metadata.

It supports ASF, FLAC, M4A, Monkey's Audio, MP3, Musepack, Ogg FLAC, Ogg Speex, Ogg Theora, Ogg Vorbis, True Audio, WavPack and OptimFROG audio files.

All versions of ID3v2 are supported (for reading), and all standard ID3v2.4 frames are parsed. It can only write ID3v2.4 (and ID3v1.1) so it is not compatible with libid3 nor Windows Media Player (which still require ID3V2.3 as of 2013). It can read Xing headers to accurately calculate the bitrate and length of MP3s. ID3 and APEv2 tags can be edited regardless of audio format. It can also manipulate Ogg streams on an individual packet/page level.

Home Page: http://www.sacredchao.net/quodlibet/wiki/Development/Mutagen

146 questions
4
votes
3 answers

Removing Single Tag from Audio Files (.MP3 and .FLAC) (Python, Mutagen)

So I'm using Python 3 and Mutagen, and I know how to remove ALL tag metadata from audio files. For mp3 files, I simply have to use: from mutagen.easyid3 import EasyID3 audio = EasyID3(filepath) audio.delete() audio.save() For .flac I have to…
joejoejoejoe4
  • 1,206
  • 1
  • 18
  • 38
4
votes
2 answers

Embed Album Cover to mp3 with Mutagen in Python 3

ID3. This is the Python 3 API, i'm not sure how to embed an image, so far I have this where I change the tags, def addMetaData(url, title, artist, album, track): response = requests.get(url, stream=True) with open('img.jpg', 'wb') as…
Robert Jeers
  • 121
  • 1
  • 2
  • 9
4
votes
1 answer

mutagen read TemporaryUploadedFile in django

I want to validate my mp3s before saving them to disk, using Mutagen. However with mutagen I can only open a file if it's on disk. Is there a way around this? I would like to be able to do this: files = request.FILES mp3 = files.get('mp3') mp3_audio…
Sebastian Olsen
  • 10,318
  • 9
  • 46
  • 91
4
votes
1 answer

Change embedded image type in APIC ID3 tag via Mutagen

I have a large music library which I have just spent around 30 hours organizing. For some of the MP3 files, I embedded the cover art image as type 0 (Other) and I'd like to change it to type 3 (Front Cover). Is there a way to do this in Python,…
Naftuli Kay
  • 87,710
  • 93
  • 269
  • 411
4
votes
0 answers

How accurate is mutagen track length info

I'm doing some auditing of my music library (using Mutagen/Python), including looking for duplicates. In particular, I am writing a program to look for duplicates and I am using track-length as part of the way I compare two tracks. In the process of…
RFlack
  • 436
  • 1
  • 5
  • 19
4
votes
2 answers

How to set: "artist", "album artist", "year", "album", "song number" and "title" fields of the tag, with mutagen

I'm trying to use mutagen (with Python 2.7.5) to create a program that, given that the path to songs is ...\Artist\Year Album\Songnumber Title.mp3, sets the artist, album artist, year, album, song number and title tags of the song, and preserves the…
H.v.M.
  • 1,348
  • 3
  • 16
  • 42
4
votes
4 answers

Retrieve lyrics from an mp3 file in Python using eyeD3

I am currently trying to use Python and its eyeD3 library to extract the lyrics from an mp3 file. The lyrics have been embedded into the mp3 file already (via: MusicBee). I am trying to use eyeD3 to return the lyrics. I can't figure out how to do…
DonJuma
  • 2,028
  • 13
  • 42
  • 70
3
votes
1 answer

Optimizing Python Code Using SQLite3 + Mutagen

I'm in the process of improving an open-source music database, which reads songs in from my collection and stores them to an SQLite database. In turn, I'm able to leverage the database to find duplicates, run queries on my collection, and (if I so…
Makoto
  • 104,088
  • 27
  • 192
  • 230
3
votes
2 answers

How to add track number metadata for an MP4 file using Mutagen?

Every other tag seems to work e.g. title, cover art, artist but I encounter an error for the track number tag [trkn] every time import mutagen from mutagen import MP4, MP4Cover filePath = 'LoadFiles/UserUpload/test.mp4' mp4_meta =…
yst0
  • 31
  • 3
3
votes
1 answer

Pygame doesn't play mp3 files tagged with mutagen

After tagging an audio file with mutagen pygame no longer seems to be able to play the file. It however loads the file successfully and the call to pygame.mixer.music.play() throws no error. I actually use the music-tag library which is just a…
droptop
  • 1,372
  • 13
  • 24
3
votes
1 answer

How to get title, artist, and album art using mutagen (Python and Django)?

So, I am using mutagen to get information about uploaded musics in my website. I tried the following code: import mutagen mutagen.File(filePath) it displays the following message: {'TXXX:compatible_brands': TXXX(encoding=,…
Sphinx
  • 394
  • 3
  • 17
3
votes
1 answer

Running into problems setting cover art for MP4 files using Python and Mutagen

Following multiple suggestions from other StackOverflow questions and the mutagen documentation, I was able to come up with code to get and set every ID3 tag in both MP3 and MP4 files. The issue I have is with setting the cover art for M4B files. I…
3
votes
0 answers

Mutagen Python FileNotFoundError handling

I want to create FileNotFoundError error for the below function where i get genre of a mp3 file using EasyID3 class of mutagen package, But i am still getting FileNotFoundError. i am using Anaconda environment with Python 3.6.5 from mutagen.easyid3…
3
votes
1 answer

Is it possible to add ID3 tags to m4a files using mutagen?

I run into a problem while writing a script to tag my music library with mutagen. The following code works fine when dealing with mp3 files but corrupts the m4a files. def set_video_tags(video, filepath): try: tags = ID3(filepath,…
dobrovv
  • 33
  • 1
  • 5
3
votes
1 answer

why am I unable to display the USLT lyrics

I am using mutagen to try to find lyrics on my media. when i run the following import mutagen.mp3 mp3 = MP3(mp3file) print mp3.pprint() I can see that the frame USLT exists and it contains: USLT=[unrepresentable data] I do not understand why the…
penfold1992
  • 305
  • 2
  • 14
1
2
3
9 10