#mp4 #m4a #audio #metadata #parser

mp4ameta

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

22 releases (10 breaking)

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

#8 in Audio

Download history 263/week @ 2021-05-29 228/week @ 2021-06-05 201/week @ 2021-06-12 218/week @ 2021-06-19 354/week @ 2021-06-26 591/week @ 2021-07-03 387/week @ 2021-07-10 319/week @ 2021-07-17 370/week @ 2021-07-24 421/week @ 2021-07-31 610/week @ 2021-08-07 287/week @ 2021-08-14 274/week @ 2021-08-21 167/week @ 2021-08-28 124/week @ 2021-09-04 189/week @ 2021-09-11

1,357 downloads per month
Used in 9 crates (5 directly)

MIT/Apache

695KB
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();

Useful Links

Testing

__Run all tests:__
cargo test

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

Dependencies