#audio-metadata #metadata #mp4 #parser #m4a

mp4ameta

A library for reading and writing iTunes style MPEG-4 audio metadata

24 releases

0.12.1 Feb 25, 2025
0.11.0 Jun 15, 2021
0.9.1 Feb 14, 2021
0.7.3 Dec 13, 2020
0.1.0 Mar 26, 2020

#100 in Parser implementations

Download history 10891/week @ 2024-11-19 12283/week @ 2024-11-26 7739/week @ 2024-12-03 9614/week @ 2024-12-10 8113/week @ 2024-12-17 4699/week @ 2024-12-24 5439/week @ 2024-12-31 6829/week @ 2025-01-07 7456/week @ 2025-01-14 9066/week @ 2025-01-21 13319/week @ 2025-01-28 10811/week @ 2025-02-04 13480/week @ 2025-02-11 9581/week @ 2025-02-18 13694/week @ 2025-02-25 10819/week @ 2025-03-04

48,837 downloads per month
Used in 46 crates (10 directly)

MIT/Apache

685KB
3K SLoC

rust-mp4ameta

CI Crate Documentation License LOC

A library for reading and writing iTunes style MPEG-4 audio metadata. Most commonly this kind of metadata is found inside m4a or m4b files but basically any mp4 container supports it.

Examples

The easy way

let mut tag = mp4ameta::Tag::read_from_path("music.m4a").unwrap();

println!("{}", tag.artist().unwrap());

tag.set_artist("artist");
tag.write_to_path("music.m4a").unwrap();

The hard way

use mp4ameta::{Data, Fourcc, Tag};

let mut tag = Tag::read_from_path("music.m4a").unwrap();
let artist_ident = Fourcc(*b"\xa9ART");

let artist = tag.string(&artist_ident).next().unwrap();
println!("{}", artist);

tag.set_data(artist_ident, Data::Utf8("artist".to_owned()));
tag.write_to_path("music.m4a").unwrap();

Using freeform identifiers

use mp4ameta::{Data, FreeformIdent, Tag};

let mut tag = Tag::read_from_path("music.m4a").unwrap();
let isrc_ident = FreeformIdent::new("com.apple.iTunes", "ISRC");

let isrc = tag.string(&isrc_ident).next().unwrap();
println!("{}", isrc);

tag.set_data(isrc_ident, Data::Utf8("isrc".to_owned()));
tag.write_to_path("music.m4a").unwrap();

Testing

Run all tests:
cargo test

Test this library on your collection:
cargo test -- --nocapture collection <path>

Dependencies