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

iTunes MP4 Tags / Metadata with Python3 and Mutagen

I'm currently using the Mutagen module for Python to prepare the MP4 Tags of a video-file for iTunes. It works fine, but I miss one really important tag, it's called "stik" and stands for the iTunes media type. This is my current…
Pascal Bajorat
  • 464
  • 8
  • 20
3
votes
1 answer

Mutagen pprint() and save() errors (python 2.7.5)

I'm running mutagen 1.21 with python 2.7.5 on windows 8, and I get the errors below when I try to use pprint() and save(). If anyone could figure out what the problem is, I would also appreciate a sample code of how to set the title, artist, album…
H.v.M.
  • 1,348
  • 3
  • 16
  • 42
2
votes
1 answer

Function to write id3 tag with python 3 mutagen

In order to modify an id3 tag value with mutagen - let's say the track number (TRCK) - I found this: filename = '/myDir/myFile.mp3' from mutagen.mp3 import MP3 audio = MP3(fileName) from mutagen.id3 import ID3NoHeaderError, ID3, TRCK try: audio…
Zax
  • 169
  • 3
  • 12
2
votes
2 answers

Mutagen adding year metatag to an MP3 file?

I'm using EasyMP3 from mutagen to add metadata tags to an audio file. But in EasyMP3 the year tag is not defined so I am getting an error saying year is not a valid key. The following code demonstrates the problem: from mutagen.mp3 import…
Charli
  • 31
  • 2
2
votes
1 answer

How do I find the length of a sound generated by pyttsx3

I am making a program that needs the length of speech generated by pyttsx3 I did not find any way to do it using pyttsx3 so I am storing the speech in a file and then trying to use mutagen to get the audio info import pyttsx3 from mutagen.mp3 import…
Coder
  • 31
  • 4
2
votes
2 answers

Editing tag data for .aiff files with Mutagen with errors "TypeError: not a Frame instance" and "ID3NoHeaderError: doesn't start with an ID3 tag"

i'm trying to write tags to a tables .aif file using mutagen. so far not having much success... from the code in the mutagen documentation i try: from mutagen.aiff import AIFF audio = AIFF(“example.aif”) audio["title"] = u"An…
neff
  • 41
  • 2
2
votes
1 answer

Trying to create a ID3-Tag editor. TypeError: Missing filename or fileobj argument

I am creating a tageditor that displays the ID3-Tags of an mp3 file in a "before" "after" style in different textLines. If there's no tag available, nothing is displayed. You are also able to edit the "after" textLines and any changes made to them…
Sampai
  • 45
  • 1
  • 4
2
votes
1 answer

How can I print ID3 tags using mutagen

This code prints out the length and bitrate of an mp3 selected via a filechooser. How do I do this for the title, artist, album, release year, comments, genre etc? import sys import easygui import mutagen from mutagen.mp3 import MP3 audio =…
Sampai
  • 45
  • 1
  • 4
2
votes
1 answer

How do I add cover image to a mp3 file using mutagen in Python?

The code below doesnt seem to update the artwork of the mp3 file. Code:- from mutagen.id3 import ID3, APIC audio = ID3(musicFilename) with open(coverFilename, 'rb') as albumart: print albumart.read() audio['APIC'] = APIC( …
JTT
  • 109
  • 4
  • 14
2
votes
1 answer

What kind of object is needed as first argument in mutagen.mp4.MP4Cover?

I would like to use the function mutagen.mp4.MP4Cover(data, imageformat) (direct link to documentation), however the documentation only specifies imageformat, but not what data is. I have a .png file that I would like to add to an .mp3 as…
imrek
  • 2,930
  • 3
  • 20
  • 36
2
votes
2 answers

python mutagen, mp4 file, how to use ‘rtng’ – Content Rating tag?

On Windows, when you look at "Details" tab for an mp4 file, there is a "Parental rating" field which seems to be free text. I am trying to set that to "PG", "R", etc. for my movies. The mutagen python module has a "rtng" tag, described as Content…
2
votes
0 answers

Mutagen throws error when reading .flac file

I have coded this script to read the metadata from a FLAC file, sometimes it works, but sometimes throws this error and don't know why. These files are not damaged. Seems that it has trouble reading the header of certain FLAC files, but I don't know…
xavier
  • 746
  • 2
  • 12
  • 22
2
votes
1 answer

Fixing encoding of ID3 tags with mutagen

I'm trying to fix encoding of ID3 tags so that my Nokia Lumia 630 with windows 8 onboard would display correctly Cyrillic letters. I'm doing this with mutagen: # -*- coding: utf-8 -*- import os import mutagen.id3 for path in [u'Sergei Babkin -…
x-yuri
  • 16,722
  • 15
  • 114
  • 161
2
votes
1 answer

How to modify incorrect mp3 song length in python

I am using mutagen to modify the metadata for a file: "temp.mp3". The song is 3:00 long. When I try: from mutagen.mp3 import MP3 audio = MP3('temp.mp3') print audio.info.length audio.info.length = 180 print audio.info.length audio.save() audio =…
Nezo
  • 567
  • 4
  • 18
2
votes
1 answer

Delete Music File Metadata Tag

How do I delete a metadata tag from a FLAC file or MP3 ID3 tag? I can use mutagen to edit information, but how would I delete a single portion of information? I need to delete a tag entitled fmps_playcount, but not the rest of the metadata.
mh00h
  • 1,824
  • 3
  • 25
  • 45
1 2
3
9 10