Coder Social home page Coder Social logo

mp4ameta's People

Contributors

babysnakes avatar probablykasper avatar rayrrr avatar saecki avatar tianyishi2001 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mp4ameta's Issues

Not functioning as expected (broken README example etc.)

Hi @Saecki thank you for your work here! We would like to use this crate in another project, for reading existing atoms/tags on M4A files in a personal music library. See agersant/polaris#82

However, it returns None for all atoms/tags. This simplified example based on your README is panicking on the 2nd unwrap:

fn main() {
    let tag = mp4ameta::Tag::read_from_path("music.m4a").unwrap();
    println!("{}", tag.artist().unwrap());
}

Any information would be helpful.

Error parsing

With mp4ameta v0.11.0, I edited this file's artworks. I believe it ran tag.take_artworks() and then tag.set_artworks(Vec::new()), so it should just have removed the artworks.
Aero Chord - 4U copy.m4a.zip

On 0.11.0, read_from_path() works fine on the file, but on the master branch, it results in this error:

Error parsing moov: Error parsing udta: Error parsing meta: Error parsing ilst: Error constructing meta item 'covr', missing data atom

`Data already parsed` error

I'm seeing a few errors like the one below when scanning my music collection in Polaris. I attached an example file causing the issue. bad.zip

Parsing: Error reading moov: Error reading udta: Error reading meta: Error reading ilst: Error reading ©ART: Error reading data: Data already parsed

I am also getting a few of these, even though foobar2000 can show metadata for these files just fine:

NoTag: File does not contain MPEG-4 audio metadata

Updating tags corrupts audio files

I've been trying to use mp4ameta in my side project. I noticed that a simple action of setting the artist and album corrupts the file. It doesn't happen with every m4a file though.

Here's a zip file with examples (I'll delete the link later). The first two I bought from iTunes and Bandcamp, the third one is from a site with public domain sounds. Run the following code on the three of them and notice that the first two stop being playable, but the third one still works:

let examples = ["example1.m4a", "example2.m4a", "example3.m4a"];

for example in &examples {
    let mut tag = mp4ameta::Tag::read_from_path(example).unwrap();
    tag.set_artist("Foo");
    tag.set_album("Bar");
    tag.write_to_path(example).unwrap()
}

Is this a bug in the library or am I doing something wrong?

Support for work/movement

Hi,

First let me thank you for this crate. I was looking for a long time for a crate to write m4a metadata in rust (I had to write my current utility for managing work/movement in classical music in python because of that 🙁). I was really happy a couple of days ago when during my occasional searches I found this crate.

I'm trying to create a PR for supporting work / movement. This includes 5 new tags:

  • ‘\xa9wrk’ - work name (string)
  • ‘\xa9mvn’ - movement name (string)
  • ‘\xa9mvc’ - movement count (number)
  • ‘\xa9mvi’ - movement index (number)
  • shwm - show work movement flag (as integer, 1 is true)

I have zero knowledge about reading/writing binary data. I managed to make it read a couple of these tags. For example the data is printed like this in the test:

        Atom{ ©mvc, 0, Content::Atoms{ [
            Atom{ data, 0, Content::TypedData{ Reserved{ [0, 4] } } },
        ] } },
        Atom{ ©mvi, 0, Content::Atoms{ [
            Atom{ data, 0, Content::TypedData{ Reserved{ [0, 1] } } },
        ] } },
        Atom{ ©nam, 0, Content::Atoms{ [
            Atom{ data, 0, Content::TypedData{ UTF8{ "Sonata in D minor for cello and piano, op. 40: I. Allegro non troppo - Largo" } } },
        ] } },

I have no idea why movement index/count is parsed as 2 items but the value is true.

I would appreciate any pointers on how to write the set_* functions for the following data types:

  • movement count or index
  • show work movement (probably something like cpil)

my main resource for the above tags is the mutagen documentation.

Thank you very much in advance

How to set back cover?

First, thanks for making this crate!

I can set the artwork(s) using the various set_artwork functions, but there doesn't appear to be any way to identify whether I'm setting a front cover, back cover, etc? Am I missing something here? Can it be done?

Sample rate: Use u32 instead of usize

The type of the sample rate depends on the range of possible values, but neither on the platform nor the CPU architecture. The return type usize for SampleRate::hz() is not a good match. Using u32 with a known size would be a better choice.

Sort order tag implementation?

Hi,

I love this library, fantastic for my music player I'm building at the moment. One feature I wish it were missing were implementations of the sort order tags, more specifically artist sort ("soar") and album artist sort ("soal").

Thank you for reading :)

Allow filetype signature that starts with `mp4`

Thank you for the development of this crate which is very helpful to me!

Music downloaded from mora (one of the major music stores in Japan) usually have .m4a extensions, but its filetype signature within the file data is not recognised by rust-mp4ameta.

When calling mp4ameta::Tag::read_from_path("foo.m4a").unwrap();:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: InvalidFiletype("mp42\u{0}\u{0}\u{0}\u{1}isommp423gp5"): Invalid filetype.'

However, they really contain valid m4a tags, and I was able to parse them by changing core::atom::VALID_FILETYPES to [&str; 6] = ["M4A ", "M4B ", "M4P ", "M4V ", "isom", "mp4"] (appeded "mp4"). I am not sure whether this is a standard fieltype signature. If it is, could it be added to VALID_FILETYPES? If not, is there any possibility for having a function for "force-parsing" the tags regardless of the file type?

Read/write custom "----:<mean>" atoms

How could I access atoms that all have the same Ident "----" and are distinguished by the string in the nested mean atom? Many commonly used fields are encoded using these kind of atoms.

http://atomicparsley.sourceforge.net/mpeg-4files.html

There is also another form of tagging that iTunes uses internally by a few inaccessible tags. Called the reverse DNS style (or something along that line), this form is pictured below:

Atom ---- @ 39852 of size: 72, ends @ 39924
Atom mean @ 39860 of size: 28, ends @ 39888
Atom name @ 39888 of size: 16, ends @ 39904
Atom data @ 39904 of size: 20, ends @ 39924

where the mean atom carries the reverse DNS domain (com.apple.iTunes) & the name atom carries the descriptor for the contents of the data atom.

Btw, thanks for your work! Exactly what I need for tag synchronization including support for multi-valued fields. I just started to use this crate.

Q: Can `©day` only include year?

Hey, got a question about the ©day tag. Feel free to close if you don't know or want to answer.

In most places, it looks like ©day is just mentioned as being for the year. However, it's of course named ©day and the Movie Atoms specification describes ©day as Date the movie content was created.

Is it valid to enter info like month/date/time in ©day, and if so, what format?

ID3v2.4's TDRC tag lets you optionally include month, date and time in the format yyyy-MM-ddTHH:mm:ss.

`Parsing: Read length of mdat which is less than 8 bytes: 1`

Hi, I'm getting this error from Tag::read_from_path(): Parsing: Read length of mdat which is less than 8 bytes: 1. iTunes, QuickTime, VLC and music-metadata are able to handle the file just fine.

I tested mp4ameta on 4 of the m4as I have, and this issue turned up, so not sure how common this error would be for the other 4000 m4as I've got.

Can send over the m4a privately if you need it.

Great library

Hi, thank you for creating this library. It's a joy to use, and lets me add MP4 support to my music player extremely fast. And it was consistently recommended by GPT-4, while I was researching my options.

OOM when reading tag from fuzzed file

Reproduction code

fn main() {
    let data = [0, 0, 0, 1, 102, 116, 121, 112, 0, 132, 255, 255, 255, 255, 0, 132];
    let mut data = std::io::Cursor::new(data);
    let tag = mp4ameta::Tag::read_from(&mut data);
}

Results in

memory allocation of 37436171902451828 bytes failed
zsh: abort (core dumped)  cargo run

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.