Read and write MPEG-4 audio files with iTunes metadata.
This module will read MPEG-4 audio information and metadata, as found in Apple’s MP4 (aka M4A, M4B, M4P) files.
There is no official specification for this format. The source code for TagLib, FAAD, and various MPEG specifications at
were all consulted.
Bases: mutagen._file.FileType
An MPEG-4 audio file, probably containing AAC.
If more than one track is present in the file, the first is used. Only audio (‘soun’) tracks will be read.
Variables: |
---|
Bases: mutagen._util.DictProxy, mutagen._tags.Metadata
Dictionary containing Apple iTunes metadata list key/values.
Keys are four byte identifiers, except for freeform (‘—-‘) keys. Values are usually unicode strings, but some atoms have a special structure:
Text values (multiple values per key are supported):
Boolean values:
Tuples of ints (multiple values per key are supported):
Others:
The freeform ‘—-‘ frames use a key in the format ‘—-:mean:name’ where ‘mean’ is usually ‘com.apple.iTunes’ and ‘name’ is a unique identifier for this frame. The value is a str, but is probably text that can be decoded as UTF-8. Multiple values per key are supported.
MP4 tag data cannot exist outside of the structure of an MP4 file, so this class should not be manually instantiated.
Unknown non-text tags and tags that failed to parse will be written back as is.
Remove the metadata from the given filename.
Save the metadata to the given filename.
MPEG-4 stream information.
Attributes:
A cover artwork.
Attributes:
A freeform value.
Attributes:
Remove tags from a file.
Bases: mutagen.mp4.MP4
Like MP4, but uses EasyMP4Tags for tags.
Variables: |
|
---|
Register a new key mapping.
A key mapping is four functions, a getter, setter, deleter, and lister. The key may be either a string or a glob pattern.
The getter, deleted, and lister receive an MP4Tags instance and the requested key name. The setter also receives the desired value, which will be a list of strings.
The getter, setter, and deleter are used to implement __getitem__, __setitem__, and __delitem__.
The lister is used to implement keys(). It should return a list of keys that are actually in the MP4 instance, provided by its associated getter.
Register a text key.
If the key you need to register is a simple one-to-one mapping of MP4 atom name to EasyMP4Tags key, then you can use this function:
EasyMP4Tags.RegisterTextKey("artist", "©ART")
Bases: mutagen._util.DictMixin, mutagen._tags.Metadata
A file with MPEG-4 iTunes metadata.
Like Vorbis comments, EasyMP4Tags keys are case-insensitive ASCII strings, and values are a list of Unicode strings (and these lists are always of length 0 or 1).
If you need access to the full MP4 metadata feature set, you should use MP4, not EasyMP4.
Register a text key.
If the key you need to register is a simple one-to-one mapping of MP4 freeform atom (—-) and name to EasyMP4Tags key, then you can use this function:
EasyMP4Tags.RegisterFreeformKey(
"musicbrainz_artistid", "MusicBrainz Artist Id")
Register a scalar integer key.
Register a new key mapping.
A key mapping is four functions, a getter, setter, deleter, and lister. The key may be either a string or a glob pattern.
The getter, deleted, and lister receive an MP4Tags instance and the requested key name. The setter also receives the desired value, which will be a list of strings.
The getter, setter, and deleter are used to implement __getitem__, __setitem__, and __delitem__.
The lister is used to implement keys(). It should return a list of keys that are actually in the MP4 instance, provided by its associated getter.
Register a text key.
If the key you need to register is a simple one-to-one mapping of MP4 atom name to EasyMP4Tags key, then you can use this function:
EasyMP4Tags.RegisterTextKey("artist", "©ART")
Print tag key=value pairs.