mirror of
https://github.com/bplaat/mp4ameta
synced 2026-08-27 19:40:01 +00:00
No description
- Rust 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .github/workflows | ||
| examples | ||
| files | ||
| proc | ||
| src | ||
| tests | ||
| .gitignore | ||
| .rustfmt.toml | ||
| Cargo.toml | ||
| LICENSE-APACHE | ||
| LICENSE-MIT | ||
| README.md | ||
mp4ameta
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();
Useful Links
- QuickTime spec
- MultimediaWiki QuickTime container
- AtomicParsley docs
- Mutagen docs
- Hydrogen audio tag mapping
- MusicBrainz Picard tag mapping
- Filetype list
Testing
Run all tests:
cargo test
Test this library on your collection:
cargo test -- --nocapture collection <path>