Opened 3 hours ago
#11454 new defect
Ogg/Theora: Bad granulepos when GOP higher than 64
Reported by: | Bernat | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | undetermined |
Version: | git-master | Keywords: | |
Cc: | Bernat | Blocked By: | |
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
When encoding Theora video streams in an Ogg container with GOP size higher than 64, granulepos is wrong. The encoding is done with the right GOP size but the granulepos reported when decoding is wrong.
Here's an example from a file encoded with the following command:
ffmpeg -i input.mp4 -c:v libtheora -c:a libvorbis -g:v 300 output.ogv
The output plays fine but when analyzing the frames we can find this:
frame 192:
granulepos: 575
key-frame: 129
offset: 63
Theora API function th_packet_iskeyframe() returns false.
frame 193:
granulepos: 33280
key-frame: 192
offset: 0
Theora API function th_packet_iskeyframe() returns false.
So in both cases the decoder thinks these aren't key-frames and it should be right.
But the granulepos of the second frame is constructed as if it was a key-frame. It should be like this instead:
frame 193:
granulepos: 576
key-frame: 129
offset: 64
It looks like the encoder knows the GOP size is 300 but the code writing the granulepos thinks that the GOP size is 64.
Anyway I could help please ask me.
Thanks for your time.
Cheers.