Hi. This is Francesco from Automattic. Thanks for the work done with getID3.
Sometimes, Opus encoders (WhatsApp voice registrations and others) add a special last header with a granule duration of 0xFFFFFFFFFFFFFF. This value indicates "this is the end," but must be ignored; otherwise, it makes calculations wrong.
Hi. This is Francesco from Automattic. Thanks for the work done with getID3.
Sometimes, Opus encoders (WhatsApp voice registrations and others) add a special last header with a granule duration of
0xFFFFFFFFFFFFFF
. This value indicates "this is the end," but must be ignored; otherwise, it makes calculations wrong.You can see on this publicly available file https://ladywoodunite.com/wp-content/uploads/2024/03/whatsapp-audio-2024-02-29-at-19.47.24.ogg:
This can be solved here https://github.com/JamesHeinrich/getID3/blob/master/getid3/module.audio.ogg.php#L352 by checking if the granule position is the maximum 64-bit integer, and if it is, perform the scan again. Something like this:
See the following JSON, which shows a very long duration.