Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All M4A files are considered to be MP4 video files #408

Open
pddshk opened this issue Nov 25, 2024 · 3 comments
Open

All M4A files are considered to be MP4 video files #408

pddshk opened this issue Nov 25, 2024 · 3 comments

Comments

@pddshk
Copy link

pddshk commented Nov 25, 2024

Simple as that, FileIO has no explicitly declared m4a extension, but from my small research it infers MP4 from some bytes. However m4a files usually store only audio.

And due to this pure audio m4a file is decoded as video file

@pddshk pddshk changed the title M4A files are considered to be MP4 video files All M4A files are considered to be MP4 video files Nov 25, 2024
@stemann
Copy link
Member

stemann commented Nov 30, 2024

Which Julia package would you like to have open the M4A-files other than VideoIO?

If there is another package, then stemann:feature/m4a might help.

@pddshk
Copy link
Author

pddshk commented Dec 5, 2024

Actually m4a (should be) a container with audio data only, which is encoded in ALAC or AAC.

ALAC can be supported in LibSndFile.jl and I didn't find anything regarding reading binary AAC on the internet (maybe decode via ffmpeg on-the-go as a fallback)

We can check out if the container has only audio box (magic bytes are located at a distance of +8 from hdlr and should be soun) and then locate alac or mp4a at distance of +16 from stsd

@stemann
Copy link
Member

stemann commented Dec 5, 2024

Right.

I looked at LibSndFile.jl, but I got the impression that upstream https://github.com/libsndfile/libsndfile explicitly left out some MPEG(-3)-support ... , but I probably hit an ancient URL somewhere... as I can see that there is both MP3 - and ALAC at this point.

AAC seems to not be supported at this point: libsndfile/libsndfile#389

In (the hack) stemann:feature/m4a, I did explicitly experiment with m4a files containing AAC (and they had b"M4A ", where a video file would have b"M4V ").

But it sounds right to also check for b"soun", and codec.

Test file: /usr/local/Homebrew/Library/Homebrew/test/support/fixtures/test.m4a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants