Open glanch opened 1 year ago
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.
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?
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 :)
Good day, I am trying to save meta data to an Ogg Vorbis file that currently has no . I only have problems with this file. Unfortunately, I don't know where it is from. My code to write a tag to this file:
It throws the following error (incl. stack trace)
Before and after running the code above, I ran several ´oggz` commands to help with debugging: Before running:
After running:
I tried to understand the code, but I was not able to find the mistake or bad section in my file, nor what generally happens. Maybe somebody knows what is wrong with my file.
I unfortunately cannot provide the (corrupt?) file due to copyright. Also, I don't have any other files than that. But maybe you can guide me through debugging this issue.