#mp4 #m4a #audio #metadata #parser

mp4ameta

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

18 releases (8 breaking)

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

#9 in Audio

Download history 543/week @ 2020-11-07 93/week @ 2020-11-14 258/week @ 2020-11-21 441/week @ 2020-11-28 751/week @ 2020-12-05 972/week @ 2020-12-12 591/week @ 2020-12-19 1047/week @ 2020-12-26 291/week @ 2021-01-02 894/week @ 2021-01-09 460/week @ 2021-01-16 206/week @ 2021-01-23 272/week @ 2021-01-30 286/week @ 2021-02-06 517/week @ 2021-02-13 575/week @ 2021-02-20

2,201 downloads per month
Used in 6 crates (2 directly)

MIT/Apache

130KB
2.5K SLoC

rust-mp4ameta

CI Crate Documentation License LOC

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

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::{atom, 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();

Supported Filetypes

  • M4A
  • M4B
  • M4P
  • M4V

Useful Links

Testing

__Run all tests:__
cargo test

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

Dependencies