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
18
votes
3 answers

Does anyone have good examples of using mutagen to write to files?

Just as the title asks — does anyone have a good example of using the Mutagen Python ID3 library to write to .mp3 files? I'm looking, in particular, to add disc/track number information, but examples editing the title and artist would be helpful as…
YGA
  • 9,546
  • 15
  • 47
  • 50
16
votes
1 answer

Reading file data during form's clean method

So, I'm working on implementing the answer to my previous question. Here's my model: class Talk(models.Model): title = models.CharField(max_length=200) mp3 = models.FileField(upload_to = u'talks/', max_length=200) Here's my…
Dominic Rodger
  • 97,747
  • 36
  • 197
  • 212
14
votes
1 answer

Python Mutagen add image cover doesn't work

i try to edit mp3 tags with mutagen. Now i got it working to set tags like title. But APIC still not work. My code: from mutagen.mp3 import MP3 from mutagen.id3 import ID3, APIC, TT2, TPE1, TRCK, TALB, USLT, error # ID3 info: # APIC: picture # TIT2:…
Daniel Däschle
  • 766
  • 10
  • 32
12
votes
1 answer

mutagen: how to detect and embed album art in mp3, flac and mp4

I'd like to be able to detect whether an audio file has embedded album art and, if not, add album art to that file. I'm using mutagen 1) Detecting album art. Is there a simpler method than this pseudo code: from mutagen import File audio =…
foosion
  • 7,619
  • 25
  • 65
  • 102
8
votes
2 answers

Extract ID3 tags of a MP3 URL with partial download using python

I need to extract ID3 tags and meta-data of remote mp3 files. I wrote few lines that could get ID3 tags of local file: from mutagen.mp3 import MP3 import urllib2 audio = MP3("Whistle.mp3") songtitle = audio["TIT2"] artist = audio["TPE1"] print…
Anish
  • 1,920
  • 11
  • 28
  • 48
8
votes
1 answer

Using Mutagen to process all accepted file types

What do I need to do in order to process every file type accepted by mutagen, .ogg, .apev2, .wma, flac, mp4, and asf? (I excluded mp3 because it has the most documentation on it) I'd appreciated if someone who know how this is done could provide…
lzc
  • 1,645
  • 5
  • 27
  • 41
7
votes
2 answers

Python - how to a open remote file in binary read mode?

I'm trying to use the mutagen module to read the metadata of an mp3 file. The problem is that the module is expecting a local mp3 file, but my mp3 files are on a remote server. This is the line in the module that raises an error when I send a remote…
sujjj
  • 73
  • 1
  • 3
6
votes
2 answers

Mutagen's save() does not set or change cover art for MP3 files

I am trying to use Mutagen for changing ID3 (version 2.3) cover art for a bunch of MP3 files in the following way: from mutagen.mp3 import MP3 from mutagen.id3 import APIC file = MP3(filename) with open('Label.jpg', 'rb') as albumart: …
user4028648
6
votes
1 answer

Writing ID3 tags using EasyID3

I am writing a script that uses mutagen to update metadata information in .mp3 files. There seems to be an issue with the comment tag. This is my code so far import mutagen from mutagen.easyid3 import EasyID3 path = 'song.mp3' try: tag =…
Giannis
  • 143
  • 2
  • 8
5
votes
1 answer

Embedding album cover in MP4 file using Mutagen

I'd like to be able to add album cover into the file using mutagen, however when I add it as a file it returns with: File "D:\Download\pandora\renamingMETAEFF.pyw", line 71, in meta['covr'] = image File…
5
votes
2 answers

Python (Mutagen) - Can't get artist from MP4/MP3 file

These are my first experiences with Python and external APIs; I'm trying to get the artist name from a MP3 / MP4 file but I'm not succeeding. In the first case (MP3) I get the following error: HeaderNotFoundError: can't sync to an MPEG frame In the…
peperunas
  • 428
  • 1
  • 6
  • 17
5
votes
3 answers

How can I stop mutagen automatically updating the ID3 version?

When I tried to embed album art in an MP3, mutagen updated the ID3 tag to version 2.4 - which I don't want, because in ID3v2.4 my cell phone (which runs Windows Phone 8) and my computer can't recognize the tags. Apparently, simply changing the…
prehawk
  • 195
  • 12
5
votes
3 answers

What is the "TPE1" KeyError?

I'm using the mutagen module for Python to get the artist of various MP3 files I have. Here's the code giving the error: audio = EasyID3(C:\Users\Owner\Music\Music\Blue Öyster Cult\Blue Öyster Cult\Cities on Flame) print audio["artist"] The code is…
Cisplatin
  • 2,860
  • 3
  • 36
  • 56
4
votes
0 answers

Connecting from one docker container to another managed by mutagen

I have mutagen running across two projects. Project A runs on port 1025 and project B runs on port 1027. When I want to connect from project A to project B, I always get curl: (52) Empty reply from server. Previously, when I wanted to do this, I set…
realshadow
  • 2,599
  • 1
  • 20
  • 38
4
votes
1 answer

Mutagen : how to extract album art properties?

I am trying to get properties (just width & heigth so far, but probably more later) of an album art picture from an mp3 file using python 3.7.1 and mutagen 1.42, but nothing seems to work so far. I am yet able to extract some other information…
Arkeen
  • 554
  • 8
  • 20
1
2 3
9 10