No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2025-02-21 18:31:25 +01:00
.github/workflows cosmetic changes 2021-12-07 13:03:29 +01:00
examples documentation and some api changes 2021-06-03 20:10:44 +02:00
files add tests for multiple data atoms 2021-05-01 15:25:00 +02:00
proc chore: fix clippy warning 2022-08-15 19:11:23 +02:00
src Fix track number parsing bug in Apple Music (#28) 2025-02-21 18:31:25 +01:00
tests Fix track number parsing bug in Apple Music (#28) 2025-02-21 18:31:25 +01:00
.gitignore chore: add bacon.toml to .gitignore 2021-12-27 22:55:19 +01:00
.rustfmt.toml make adding multiple values easier 2021-05-03 16:04:50 +02:00
Cargo.toml chore: update Cargo.toml categories 2022-04-30 14:01:14 +02:00
LICENSE-APACHE Create LICENSE-APACHE 2020-09-29 19:16:09 +02:00
LICENSE-MIT Create LICENSE-MIT 2020-09-29 19:11:58 +02:00
README.md docs: update readme 2022-09-12 15:49:41 +02:00

mp4ameta

Build Style 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.strings_of(&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.strings_of(&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>