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

Skip leading ID3v2 data in MP3 files to allow processing #314

Merged
merged 2 commits into from
Jan 30, 2022

Conversation

jbraendle
Copy link

@jbraendle jbraendle commented Jan 11, 2022

Fixes #285

Hi,
I took a look at the issue and found, that the sample file has ID3V2 tags at the start of the file.
I added support for this form of a mp3 file by skipping the ID3V2 tag before reading the meta data.
I also changed the MpegAudioTypeChecker class to recognize the ID3V2 tags as mp3 file.
I've shortend the sample file to create a unit test case.

Kind regards
Jürgen Brändle

jbraendle and others added 2 commits January 31, 2022 09:54
This allows processing to continue. Ideally we would extract the ID3 data too, but we can add that in future.
These are still useful as documentation.
Copy link
Owner

@drewnoakes drewnoakes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Jürgen,

Thanks very much for this PR.

We avoid adding data files to this source repo, as it can get out of hand very quickly. Instead we use a large corpus of test data, which works well in practice. Please read https://github.com/drewnoakes/metadata-extractor/wiki/Working-with-test-images for more information.

I modified your PR to remove those files, and tweaked the constants and comments a little. I also ran this across the test data and found it fixed a file there.

Thanks again!

Comment on lines +36 to +38
// MP3-File with "ID3" at start
if (bytes[0] == 0x49 && bytes[1] == 0x44 && bytes[2] == 0x33)
return Util.FileType.Mp3;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think other types of file can start with ID3 too, though this is an improvement over what we had before.

@drewnoakes drewnoakes merged commit b7863e1 into drewnoakes:master Jan 30, 2022
@drewnoakes drewnoakes changed the title Issue#285 Skip leading ID3v2 data in MP3 files to allow processing Mar 17, 2022
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

Successfully merging this pull request may close these issues.

MPEG-2.5 not supported with mp3 files
2 participants