Opened 5 days ago
Last modified 29 hours ago
#11454 open defect
Ogg/Theora: Bad granulepos when GOP higher than 64
Reported by: | Bernat | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | avcodec |
Version: | git-master | Keywords: | oggparsetheora |
Cc: | Bernat, MasterQuestionable | Blocked By: | |
Blocking: | Reproduced by developer: | yes | |
Analyzed by developer: | yes |
Description (last modified by )
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 64:
granulepos: 575
key-frame: 1
offset: 63
Theora API function th_packet_iskeyframe() returns false.
frame 65:
granulepos: 33280
key-frame: 65
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 65:
granulepos: 576
key-frame: 1
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.
If there's any way I can help, please ask me.
Thanks for your time.
Cheers.
Change History (7)
comment:1 by , 5 days ago
Description: | modified (diff) |
---|
comment:2 by , 5 days ago
Description: | modified (diff) |
---|
comment:3 by , 4 days ago
Cc: | added |
---|---|
Component: | undetermined → avcodec |
Keywords: | theora added |
comment:4 by , 4 days ago
No impact on playback but it has an impact on seeking. Granulepos is supposed to let you know how many frames back the previous key-frame is without decoding the video stream.
comment:5 by , 4 days ago
Analyzed by developer: | set |
---|---|
Component: | avcodec → avformat |
Keywords: | oggparsetheora added; theora removed |
͏ Is it alike the native "speex" decoder problems?
͏ https://trac.ffmpeg.org/ticket/11078#comment:12
͏ (using "-c:v libtheora" before "-i" may workaround?)
[ ^
͏ Probably not, as "libtheora" decoding support seems not implemented:
͏ https://github.com/search?type=code&q=repo:FFmpeg/FFmpeg+path:/^libav(?:codec|format)%5C/.*theora/
͏ .
͏ Yet found only:
͏ ͏"libavcodec/libtheoraenc.c"
͏ ͏"libavformat/oggparsetheora.c" ]
comment:6 by , 4 days ago
Component: | avformat → avcodec |
---|---|
Reproduced by developer: | set |
Status: | new → open |
Probably not, as "libtheora" decoding support seems not implemented:
The theora decoder is in vp3.c
Patch for this issue sent to the mailing list.
comment:7 by , 29 hours ago
I've tried the patch and it seems to work well. The keyframes are where the granulepos say they should be. Thank you!
͏ Briefly, it's only some decoded frame metadata wrong:
͏ But no impact on actual playback?