GNOME Bugzilla – Bug 563133
oggmux outputs a broken ogg when input contains discont buffers
Last modified: 2011-05-19 09:18:12 UTC
Since http://webcvs.freedesktop.org/gstreamer/gst-plugins-base/ext/theora/theoraenc.c?r1=1.67&r2=1.68 has been applied, recording an ogg with pitivi produces a broken file. The problem seems to be here http://webcvs.freedesktop.org/gstreamer/gst-plugins-base/ext/ogg/gstoggmux.c?view=diff&r1=1.85&r2=1.86 changing the code from: if (GST_BUFFER_IS_DISCONT (buf)) { packet.packetno++; /* No public API for this; hack things in */ pad->stream.pageno++; force_flush = TRUE; } to: if (GST_BUFFER_IS_DISCONT (buf)) force_flush = TRUE; fixes the bug. It's not clear to me why oggmux is incrementing packetno and pageno there. It also works if I revert the theoraenc change, as the if is never executed.
Created attachment 123878 [details] output file without the patch
Created attachment 123879 [details] output file with the patch applied
Can you be more specific than "a broken ogg"? The intent of that if() is to retain the information about there being a discontinuity here; this may be useful in some cases but is probably wrong in others.
Created attachment 123896 [details] log Here's the output of gst-launch filesrc location=~/Desktop/broken.ogg ! decodebin ! fakesink sync=true -v --gst-debug=basesink:5 >broken.log 2>&1 as you can see there are gaps in the timestamps
Created attachment 123897 [details] log Output of the same pipeline decoding working.ogg The timestamps are continuous here and playback is normal.
So this is because theoradec drops all buffers after a discont until a keyframe. The actual ogg file seems fine. So I guess another reasonable question would be: why are you getting theora frames with DISCONT set on non-keyframes in the muxer?
The disconts in my case were due to http://bugzilla.gnome.org/show_bug.cgi?id=563143. With the fix applied everything works fine. theoraenc still marks as discont two buffers if their timestamps are too far apart. I tested that case though and the result is playable with totem and vlc, while mplayer spits warnings on stdout (Ogg : bad packet in stream 0) If you say that it's fine in ogg to have pageno and packetno non continuous and given that mplayer is probably just broken, i think this bug can be closed as invalid.
I think it's fine to have discontinous page/packet numbers in Ogg, please reopen if this is wrong ;)