xiph / opus-tools

A set of tools to encode, inspect, and decode audio in the Opus format.
https://opus-codec.org/
Other
218 stars 79 forks source link

[opusdec] Extra packets on initial header page; "Seems like they are using ogg_api incorrectly" #23

Closed grinapo closed 5 years ago

grinapo commented 6 years ago

This seems to be a lovely inter-repo discussion, and I am the messenger. This is about opusdec and perm-failing on header errors, or not errors.

https://gitlab.com/axet/android-call-recorder/issues/27#note_49530969

So, related to #22 I have reported the problem to the source, namely android-call-recorder, where Axet responded in the aforementioned link, saying:

Seems like they are using ogg_api incorrectly (it seems they do not skip tag data in header). But any way - they got header the data, they got all info they need, and they deliberately fail, no ogg api ask you to FAIL in this circumstances, again maybe it is a TAG section which force them to fail.

@rillian wrote that the numbers are suspicious ("In addition to the extra packets and unset pre-skip value, 60 ms packet durations probably aren't what you want.") and I'll relay this to Axet but he also provided the source creating the stream:

https://gitlab.com/axet/android-audio-library/blob/master/src/main/java/com/github/axet/audiolibrary/encoders/FormatOPUS_OGG.java

So I try somehow to connect your two sides and figure out whether the java code is wrong, or opusdec is wrong, or both are, or both is correct and we're just cursed. :-)

rillian commented 6 years ago

Thanks for reporting upstream! Looks like part of the issue was the encoder putting both header packets in the same page, contrary to spec.

Having the info header packet in an Ogg page by itself means the file can be identified quickly with a CRC check covering just a small amount of data. Extra data is allowed at the end of the tag header packet, but extra packets are not allowed between the defined headers, or between the tag header and the audio data.

grinapo commented 6 years ago

If you feel there's nothing to do on opusdec part you're welcome to close this issue. (The remuxing part runs in its separate issue.) Thanks!

mark4o commented 5 years ago

It looks like the opusdec message is correct, and also the program that was recording both header packets on the same page has been fixed, so I will close this issue.