[RFC] better ogg seeking, keyframes only
Hello, I admit this is a rather ugly patch, but it improves things a lot, so maybe you can have a look and get it committable. There are several issues with seeking: for audio, PKT_FLAG_KEY is never set, so the patch ignores it there, the data_offset set by the code in util.c is wrong, so this code overrides it, and the most annoying thing: a keyframe most likely is split over multiple ogg pages, so this code just returns the start of the last page read by the last get_packet as start offset for the keyframe - this means we might actually end up a few frames before the key frame (in theory up to 255), if the encoded frames are very small. Greetings, Reimar D?ffinger
On Wed, Mar 19, 2008 at 01:16:16PM +0100, Reimar D?ffinger wrote:
I admit this is a rather ugly patch, but it improves things a lot, so maybe you can have a look and get it committable. There are several issues with seeking: for audio, PKT_FLAG_KEY is never set, so the patch ignores it there, the data_offset set by the code in util.c is wrong, so this code overrides it, and the most annoying thing: a keyframe most likely is split over multiple ogg pages, so this code just returns the start of the last page read by the last get_packet as start offset for the keyframe - this means we might actually end up a few frames before the key frame (in theory up to 255), if the encoded frames are very small.
Hmm, I still get artifacts when seeking in Theora video, for example with the samples from mphq... Diego
On Sun, Mar 23, 2008 at 04:37:05PM +0100, Diego Biurrun wrote:
On Wed, Mar 19, 2008 at 01:16:16PM +0100, Reimar D?ffinger wrote:
I admit this is a rather ugly patch, but it improves things a lot, so maybe you can have a look and get it committable. There are several issues with seeking: for audio, PKT_FLAG_KEY is never set, so the patch ignores it there, the data_offset set by the code in util.c is wrong, so this code overrides it, and the most annoying thing: a keyframe most likely is split over multiple ogg pages, so this code just returns the start of the last page read by the last get_packet as start offset for the keyframe - this means we might actually end up a few frames before the key frame (in theory up to 255), if the encoded frames are very small.
Hmm, I still get artifacts when seeking in Theora video, for example with the samples from mphq...
I can confirm this, it doesnt work here either [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Republics decline into democracies and democracies degenerate into despotisms. -- Aristotle
On Thu, Jun 26, 2008 at 12:35:45PM +0200, Michael Niedermayer wrote:
On Sun, Mar 23, 2008 at 04:37:05PM +0100, Diego Biurrun wrote:
On Wed, Mar 19, 2008 at 01:16:16PM +0100, Reimar D?ffinger wrote:
I admit this is a rather ugly patch, but it improves things a lot, so maybe you can have a look and get it committable. There are several issues with seeking: for audio, PKT_FLAG_KEY is never set, so the patch ignores it there, the data_offset set by the code in util.c is wrong, so this code overrides it, and the most annoying thing: a keyframe most likely is split over multiple ogg pages, so this code just returns the start of the last page read by the last get_packet as start offset for the keyframe - this means we might actually end up a few frames before the key frame (in theory up to 255), if the encoded frames are very small.
Hmm, I still get artifacts when seeking in Theora video, for example with the samples from mphq...
I can confirm this, it doesnt work here either
So who knows how to fix this? :) Diego
Diego Biurrun <diego at biurrun.de> writes:
On Thu, Jun 26, 2008 at 12:35:45PM +0200, Michael Niedermayer wrote:
On Sun, Mar 23, 2008 at 04:37:05PM +0100, Diego Biurrun wrote:
On Wed, Mar 19, 2008 at 01:16:16PM +0100, Reimar D?ffinger wrote:
I admit this is a rather ugly patch, but it improves things a lot, so maybe you can have a look and get it committable. There are several issues with seeking: for audio, PKT_FLAG_KEY is never set, so the patch ignores it there, the data_offset set by the code in util.c is wrong, so this code overrides it, and the most annoying thing: a keyframe most likely is split over multiple ogg pages, so this code just returns the start of the last page read by the last get_packet as start offset for the keyframe - this means we might actually end up a few frames before the key frame (in theory up to 255), if the encoded frames are very small.
Hmm, I still get artifacts when seeking in Theora video, for example with the samples from mphq...
I can confirm this, it doesnt work here either
So who knows how to fix this? :)
I do. Can you please look up the home addresses of the Xiph devs, while I fetch the shotgun? -- M?ns Rullg?rd mans at mansr.com
On Sun, Jul 06, 2008 at 01:37:53PM +0100, M?ns Rullg?rd wrote:
Diego Biurrun <diego at biurrun.de> writes:
On Thu, Jun 26, 2008 at 12:35:45PM +0200, Michael Niedermayer wrote:
On Sun, Mar 23, 2008 at 04:37:05PM +0100, Diego Biurrun wrote:
On Wed, Mar 19, 2008 at 01:16:16PM +0100, Reimar D?ffinger wrote:
I admit this is a rather ugly patch, but it improves things a lot, so maybe you can have a look and get it committable. There are several issues with seeking: for audio, PKT_FLAG_KEY is never set, so the patch ignores it there, the data_offset set by the code in util.c is wrong, so this code overrides it, and the most annoying thing: a keyframe most likely is split over multiple ogg pages, so this code just returns the start of the last page read by the last get_packet as start offset for the keyframe - this means we might actually end up a few frames before the key frame (in theory up to 255), if the encoded frames are very small.
Hmm, I still get artifacts when seeking in Theora video, for example with the samples from mphq...
I can confirm this, it doesnt work here either
So who knows how to fix this? :)
I do. Can you please look up the home addresses of the Xiph devs, while I fetch the shotgun?
Sure. But do you also have a code fix? :) Diego
On Sun, Mar 23, 2008 at 04:37:05PM +0100, Diego Biurrun wrote:
On Wed, Mar 19, 2008 at 01:16:16PM +0100, Reimar D?ffinger wrote:
I admit this is a rather ugly patch, but it improves things a lot, so maybe you can have a look and get it committable. There are several issues with seeking: for audio, PKT_FLAG_KEY is never set, so the patch ignores it there, the data_offset set by the code in util.c is wrong, so this code overrides it, and the most annoying thing: a keyframe most likely is split over multiple ogg pages, so this code just returns the start of the last page read by the last get_packet as start offset for the keyframe - this means we might actually end up a few frames before the key frame (in theory up to 255), if the encoded frames are very small.
Hmm, I still get artifacts when seeking in Theora video, for example with the samples from mphq...
Update: While this does not help when seeking Theora video, OGM files show improved seeking behavior. Reimar, are you still working on this issue? Diego
Hello, On Thu, Nov 06, 2008 at 01:04:16AM +0100, Diego Biurrun wrote:
On Sun, Mar 23, 2008 at 04:37:05PM +0100, Diego Biurrun wrote:
On Wed, Mar 19, 2008 at 01:16:16PM +0100, Reimar D?ffinger wrote:
I admit this is a rather ugly patch, but it improves things a lot, so maybe you can have a look and get it committable. There are several issues with seeking: for audio, PKT_FLAG_KEY is never set, so the patch ignores it there, the data_offset set by the code in util.c is wrong, so this code overrides it, and the most annoying thing: a keyframe most likely is split over multiple ogg pages, so this code just returns the start of the last page read by the last get_packet as start offset for the keyframe - this means we might actually end up a few frames before the key frame (in theory up to 255), if the encoded frames are very small.
Hmm, I still get artifacts when seeking in Theora video, for example with the samples from mphq...
Update: While this does not help when seeking Theora video, OGM files show improved seeking behavior.
Reimar, are you still working on this issue?
For me this perfectly fixes seeking for http://mirror.bigbuckbunny.de/peach/bigbuckbunny_movies/big_buck_bunny_1080p... , at least when using "mplayer -demuxer lavf -vc fftheora" (it is very slow though). Please be specific about the files that do not work and how you tested them. Greetings, Reimar D?ffinger
On Mon, Dec 01, 2008 at 10:17:20AM +0100, Reimar D?ffinger wrote:
For me this perfectly fixes seeking for http://mirror.bigbuckbunny.de/peach/bigbuckbunny_movies/big_buck_bunny_1080p... , at least when using "mplayer -demuxer lavf -vc fftheora" (it is very slow though).
Except for one part of the file near the end it also fixes seeking with http://samples.mplayerhq.hu/ogg/bgc.sub.dub.ogm (maybe a frame was incorrectly marked as keyframe by the muxer?), and http://samples.mplayerhq.hu/ogg/basicinstinct.ogm seems to work just fine, too. Those are not using theora though... Of the files in http://samples.mplayerhq.hu/ogg/Theora/ only http://samples.mplayerhq.hu/ogg/Theora/theora-a4_v6-k250-s0_2.ogg plays at all, and indeed it does not work there. On the other hand, e.g. http://samples.mplayerhq.hu/V-codecs/Theora/WobblyWindowsIntro.ogg clearly has errors in both cases but never prints a "first frame is not keyframe" warning. Seriously, how tf is one supposed to fix anything if things are obviously broken in every possible way everywhere already... Greetings, Reimar D?ffinger
On Mon, Dec 01, 2008 at 10:17:20AM +0100, Reimar D?ffinger wrote:
Hello, On Thu, Nov 06, 2008 at 01:04:16AM +0100, Diego Biurrun wrote:
On Sun, Mar 23, 2008 at 04:37:05PM +0100, Diego Biurrun wrote:
On Wed, Mar 19, 2008 at 01:16:16PM +0100, Reimar D?ffinger wrote:
I admit this is a rather ugly patch, but it improves things a lot, so maybe you can have a look and get it committable. There are several issues with seeking: for audio, PKT_FLAG_KEY is never set, so the patch ignores it there, the data_offset set by the code in util.c is wrong, so this code overrides it, and the most annoying thing: a keyframe most likely is split over multiple ogg pages, so this code just returns the start of the last page read by the last get_packet as start offset for the keyframe - this means we might actually end up a few frames before the key frame (in theory up to 255), if the encoded frames are very small.
Hmm, I still get artifacts when seeking in Theora video, for example with the samples from mphq...
Update: While this does not help when seeking Theora video, OGM files show improved seeking behavior.
Reimar, are you still working on this issue?
For me this perfectly fixes seeking for http://mirror.bigbuckbunny.de/peach/bigbuckbunny_movies/big_buck_bunny_1080p... , at least when using "mplayer -demuxer lavf -vc fftheora" (it is very slow though). Please be specific about the files that do not work and how you tested them.
I used the samples from http://samples.mplayerhq.hu/V-codecs/Theora/ I tested by applying your patch to MPlayer and seeking with the arrow keys, nothing special... Diego
On Mon, Dec 01, 2008 at 10:43:33AM +0100, Diego Biurrun wrote:
I used the samples from
I feared so. Problem is, those in http://samples.mplayerhq.hu/V-codecs/Theora/theora_testsuite/ seem to have no problem any way. E.g. http://samples.mplayerhq.hu/V-codecs/Theora/WobblyWindowsIntro.ogg is definitly broken anyway, it has artefacts even without seeking, so that it does not work does not really tell you much. http://samples.mplayerhq.hu/V-codecs/Theora/ED-small-sample-file.ogg does not work either, but again even the decoder does not print a warning, so not even the decoder notices that it is not a keyframe?!?!?! So far my best theory is "99.9999% of all ogg files are broken beyond repair and can only be played when the decoder is directly messed into the demuxer". Which of course means trying to fix our demuxer is pointless. Greetings, Reimar D?ffinger
participants (4)
-
diego@biurrun.de -
mans@mansr.com -
michaelni@gmx.at -
Reimar.Doeffinger@stud.uni-karlsruhe.de