Git Product home page Git Product logo

Comments (3)

phw avatar phw commented on July 18, 2024

Without a file to look into it's not really possible to say much about this. mutagen fails reading an ogg page header inside the file, so it looks like there is at least some corrupted data structure inside the file.

from mutagen.

niclimcy avatar niclimcy commented on July 18, 2024

Without a file to look into it's not really possible to say much about this. mutagen fails reading an ogg page header inside the file, so it looks like there is at least some corrupted data structure inside the file.

I have the same issue and have a file I can share. How can I share you the file privately?

from mutagen.

JanGross avatar JanGross commented on July 18, 2024

Ran into the same issue.
As a quick workaround you can disable metadata padding during save:

mutagen_file.save(padding=lambda info: 0)

Ref.: https://mutagen.readthedocs.io/en/latest/user/padding.html

Attached below is a test file and a minimal example to reproduce the issue
Sinewave_Sweep.zip

import mutagen

file_path = "Sinewave_Sweep.ogg"
mutagen_handle = mutagen.File(file_path)

mutagen_handle["artist"] = u'AAAAAAAAAAAAAAAABBBBBBBBBBBBBBBB'
mutagen_handle["title"] = u'CCCCCCCCCCCCCCCCDDDDDDDDDDDDDDDD'
mutagen_handle["album"] = u'EEEEEEEEEEEEEEEEFFFFFFFFFFFFFFFF'
mutagen_handle["comment"] = u'GGGGGGGGGGGGGGGGHHHHHHHHHHHHHHHH'  

mutagen_handle.save()

From my example
Header at offset 2899534
b'OggS\x00\x04\xac\xaak\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa6\x02\x00\x00\x87\xb8\x86\xa7\x10'
oggs b'OggS', version 0, type flags 4, position 7056044, serial 0, sequence 678, crc -1484343161, segments 16
Header at offset 2902121
b'\x00\x00' -> throws in ogg.py line 91 trying to struct.unpack("<4sBBqIIiB", ..) these bytes.

It always throws at the last Ogg page, trying to interpret the last couple null bytes as a header.
The file still gets saved and once ran, the same ogg file will no longer cause the issue.

However, the offsets also wildly change. On the file that errored previously the last two segments are now
Header at offset 27
b'OggS\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00#SN\xcb\x01'
oggs b'OggS', version 0, type flags 2, position 0, serial 0, sequence 0, crc -884059357, segments 1
Header at offset 85
b'OggS\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\xe6\xe6(\x8e\x11'
oggs b'OggS', version 0, type flags 0, position 0, serial 0, sequence 1, crc -1909922074, segments 17

The same error will return once if you massively increase the size of the metadata (say * 100 for each tag).
(also if the metadata is being reduced a lot)
Maybe there's something in the file messing up the padding calculation when resizing the metadata section.

Couldn't tell what about my file is corrupt though. I hope someone more familiar with the format can spot the problem :)

from mutagen.

Related Issues (20)

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.