#mp4 #m4a #audio #metadata #parser

mp4ameta

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

21 releases (9 breaking)

0.10.2 May 1, 2021
0.9.1 Feb 14, 2021
0.7.3 Dec 13, 2020
0.7.1 Nov 24, 2020
0.1.0 Mar 26, 2020

#16 in Audio

Download history 244/week @ 2021-01-21 230/week @ 2021-01-28 275/week @ 2021-02-04 556/week @ 2021-02-11 563/week @ 2021-02-18 201/week @ 2021-02-25 248/week @ 2021-03-04 374/week @ 2021-03-11 112/week @ 2021-03-18 300/week @ 2021-03-25 261/week @ 2021-04-01 235/week @ 2021-04-08 274/week @ 2021-04-15 202/week @ 2021-04-22 283/week @ 2021-04-29 536/week @ 2021-05-06

1,291 downloads per month
Used in 7 crates (3 directly)

MIT/Apache

685KB
2.5K 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