[theora-dev] Theora packets with granulepos of -1

Robin Siegemund r.siegemund at digitalpublishing.de
Mon Feb 16 04:04:36 PST 2009

Thanks for your fast reply.

Well, my decoding loop is based on the sample code that comes with Theora so there are all necessary checks included. I think there is even no other way to decode video/audio properly without checking the function results because you need the feedback if more data is needed, a page is ready, packetOut is successfully, etc.
And those -1 packets have correct packet numbers (in order) and they are true content data.

I also checked out the results from oggzdump. But this tool is even more confusing because it seems not telling the truth. In the output you have packets like:
00:00:11.200: serialno 0000025769, granulepos 129|39, packetno 170: 513 bytes

But also packets like:
00:00:11.266: serialno 0000025769, calc. gpos 129|40, packetno 171: 1.013 kB

So why it shows "calc. gpos"? I think this means oggzdump has to calculate the position because it's originally not there. So I suppose it's the same issue here but the tool doesn't want to print a -1.

It should be mentioned that I still use an aged 1.0alpha7 version of libtheora but if the -1 granulepos is already in some packets of a file then this is not decoder related at all. So maybe there was a bug in the old encoder and the latest ffmpeg2theora still uses it, I don't know.

Robin Siegemund

> I'm just totally confused. In my theora streams encoded using ffmpeg2theora
> (but also when using my own encoder) I have packets with a granulepos of -1

Are you sure that there really are packets with -1 granpos ?
ogginfo or oggz info should report those if there really are.
Could it be possible that the code that pulls packets after
feeding pages doesn't properly check return codes, and
*thinks* there is a packet available when more data would
be needed for a full packet ?

More information about the theora-dev mailing list