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

OggOpus returned a negative audio length #308

Closed
nasief opened this issue May 31, 2017 · 10 comments
Closed

OggOpus returned a negative audio length #308

nasief opened this issue May 31, 2017 · 10 comments
Labels
bug

Comments

@nasief
Copy link

@nasief nasief commented May 31, 2017

When I tried to get the length of an .ogg audio file, the attribute returned a negative value!
The audio is 58 seconds long and it is playing normally without any issue.
What could be a reason for such a behavior?

@nasief

This comment has been minimized.

Copy link
Author

@nasief nasief commented May 31, 2017

I did some investigation within the library, I found that when trying to execute self.info._post_tags(fileobj) on the file, it tries to get the last page OggPage.find_last(fileobj, self.serial), within this call, there is an initialization page = OggPage(bytesobj), this tries to read the header and unpack it, the result is that self.position attribute is returned as -1 and then (page.position - self.__pre_skip) / float(48000) yields a negative value for the length.

I am wondering, in such a case, could this be caused due to a problem in the header of the file or something else?

@lazka

This comment has been minimized.

Copy link
Member

@lazka lazka commented May 31, 2017

Can you send me the file to reiter.christoph@gmail.com?

@nasief

This comment has been minimized.

Copy link
Author

@nasief nasief commented May 31, 2017

@lazka should be in your inbox now

@lazka

This comment has been minimized.

Copy link
Member

@lazka lazka commented May 31, 2017

thanks

@lazka

This comment has been minimized.

Copy link
Member

@lazka lazka commented May 31, 2017

It's a mutagen bug. We don't handle the case of the last ogg page being empty. I don't know why the file contains one but it's not against the spec..

@lazka lazka added the bug label May 31, 2017
@nasief

This comment has been minimized.

Copy link
Author

@nasief nasief commented May 31, 2017

@lazka Thanks for taking the time to investigate the issue.
I don't know actually what caused such a case, we recorded it normally like other audio files we record (~100 files).
How long do you think it will take for a fix to be released?

@lazka

This comment has been minimized.

Copy link
Member

@lazka lazka commented Jun 1, 2017

I don't know actually what caused such a case, we recorded it normally like other audio files we record (~100 files).

If you are using the official opus encoder, I suspect that this edge case is unlikely, because this is the first time it has come up and the code hasn't changed in years.

How long do you think it will take for a fix to be released?

No promises, maybe this week. Feel free to ping me if not.

lazka added a commit to lazka/mutagen that referenced this issue Jun 1, 2017
…st abolsute granule position. Fixes quodlibet#308

This fixes cases where the length of the ogg stream was reported as some small negative value.
@lazka lazka closed this in f2a1bd2 Jun 1, 2017
@lazka

This comment has been minimized.

Copy link
Member

@lazka lazka commented Jun 1, 2017

$ mutagen-inspect 308.ogg
-- 308.ogg
- Ogg Opus, 55.62 seconds (audio/ogg)

Thanks for the report!

@nasief

This comment has been minimized.

Copy link
Author

@nasief nasief commented Jun 1, 2017

@lazka Thanks for the update.
I did test it and it is working fine :)

@lazka

This comment has been minimized.

Copy link
Member

@lazka lazka commented Jun 1, 2017

New release is out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.