mediafile
A simple, cross-format library for reading and writing media file metadata.
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 mediafileuv
uv add mediafilepoetry
poetry add mediafileInstalling 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
Tags
More Sound/Audio packages
Reads and writes audio files in formats like…
permissive · top 1,000 on PyPI
pydubPydub provides a high-level Python interface…
permissive · top 5,000 on PyPI
mutagenMutagen reads and writes audio metadata (tags)…
copyleft · top 5,000 on PyPI
torchaudioProvides PyTorch-based audio processing,…
permissive · top 5,000 on PyPI
moviepyMoviePy is a Python library for video editing…
permissive · top 5,000 on PyPI
tinytagReads metadata (artist, title, duration,…
permissive · top 5,000 on PyPI
audiofileReads and writes audio files across formats…
permissive · top 15,000 on PyPI
eyeD3eyeD3 reads, edits, and displays ID3 metadata…
copyleft · top 15,000 on PyPI
musicbrainzngsProvides Python bindings to query the…
permissive · top 15,000 on PyPI
aubioaubio is a Python wrapper around a C library…
copyleft · top 15,000 on PyPI
playsoundPlays audio files (MP3, WAV) and URLs from…
permissive · top 15,000 on PyPI
miniaudioMiniaudio provides Python bindings for…
permissive · top 15,000 on PyPI