skillfed

mediafile

A simple, cross-format library for reading and writing media file metadata.

mediafile v0.17.0 134.4K downloads/30d#11,478 on PyPI118
Permissive license MIT Active released

What it is and what it does

MediaFile is a Python library that simplifies reading and writing metadata tags in audio files. It sits on top of Mutagen, a mature low-level tag manipulation library, and presents a unified, format-agnostic interface so you can work with tags the same way across different audio formats. Instead of learning format-specific tag APIs, you load an audio file into a MediaFile object, read or modify standard fields like title and artist, and call save() to write changes back.

The library is part of the beets project and supports Python 3.10 or later, including PyPy. It exposes both singular fields and plural fields for repeated metadata values, making it practical for music library tools, batch tagging scripts, and metadata workflows.

Use it for:

  • Batch update or normalize metadata across a music collection without learning format-specific tag APIs.
  • Build a music library management tool that reads and modifies tags consistently across multiple audio formats.
  • Extract and display audio metadata in a music player or cataloging application.
  • Programmatically fix or populate missing tags in audio files.
  • Migrate or convert metadata between different audio formats by reading from one and writing to another.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

MediaFile reads and writes metadata tags across many audio file formats through a single, format-independent Python interface, wrapping the low-level Mutagen library.

Yes. MediaFile is actively maintained, has no known vulnerabilities, low install friction, and a permissive MIT license. It solves a real problem—unified audio metadata handling—with a clean API and proven track record as part of the beets project. Install it if you need to read or write audio tags programmatically.

Install

mediafile on PyPI

pip

pip install mediafile

uv

uv add mediafile

poetry

poetry add mediafile

Installing mediafile

Before you install

Low friction: pure Python wheel, only two runtime dependencies (filetype and mutagen), and actively maintained with a recent release.

License in practice

MIT license permits commercial and private use with minimal restrictions; you may use, modify, and distribute this package freely provided you include the license notice.

Quickstart

pip install mediafile

from mediafile import MediaFile

f = MediaFile("Lucy.mp3")
f.title
f.artist = "The Beatles"
f.save()

Requires Python 3.10 or later.

Verify before relying

  • Which specific audio formats are supported beyond mp3 mentioned in the example.
  • Whether plural fields (artists, composers, etc.) are available for all supported formats or only a subset.
  • Performance characteristics when handling large audio files or batch operations.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 2 — filetype, mutagen
Maintenance actively maintained — 112 days since the last release
Last repo commit
First released
Downloads 134,358/month — #11,478 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: mediafile-0.17.0-py3-none-any.whl

Environment :: Web EnvironmentProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: Implementation :: PyPyTopic :: Multimedia :: Sound/Audio

Tags

audio metadata tags read writemp3 tag editor pythonaudio file metadata librarycross-format audio taggingmutagen wrapperaudio metadata interface
audio-metadatatag-editing

More Sound/Audio packages