After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 722682 - oggmux: problems with vp8 stream
oggmux: problems with vp8 stream
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other All
: Normal normal
: 1.3.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-01-21 11:04 UTC by Christian Fredrik Kalager Schaller
Modified: 2014-03-11 16:15 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
oggmux: create vp8 header data if not provided in caps (13.89 KB, patch)
2014-03-05 20:22 UTC, Thiago Sousa Santos
committed Details | Review
oggmux: implement vp8 granulepos function (7.31 KB, patch)
2014-03-06 16:36 UTC, Thiago Sousa Santos
committed Details | Review
Dotfile graph from transmageddon (334.51 KB, image/png)
2014-03-11 10:47 UTC, Christian Fredrik Kalager Schaller
  Details

Description Christian Fredrik Kalager Schaller 2014-01-21 11:04:12 UTC
Trying to remux a webm file into Ogg (both audio and video):

0:00:10.474941625  2006 0x7f4a54039000 ERROR                 oggmux gstoggmux.c:982:gst_ogg_mux_queue_pads:<muxer:video_100562434> mapper didn't recognise input stream (pad caps: video/x-vp8, width=(int)640, height=(int)360, framerate=(fraction)90001/1)
0:00:14.335932799  2006 0x7f4a540390f0 ERROR                 vp8enc gstvp8enc.c:1887:gst_vp8_enc_finish:<vp8enc0> encode returned 1 error

The resulting ogg file is unplayable.
Comment 1 Thiago Sousa Santos 2014-02-13 03:18:00 UTC
This happens because there is no streamheader in caps when data comes from another demuxer. Encoding directly from vp8enc has streamheader.

Additionally, oggmux doesn't receive the expected "OVP80" as the beginning of the stream and doesn't identify it as vp8.

Can't oggmux simply fallback to trusting the input caps in this case?
Comment 2 Christian Fredrik Kalager Schaller 2014-02-13 09:10:43 UTC
<cschalle> thiagoss, hey, thanks for looking at that vp8 remuxing bug, one question though, would that mean I should get the same issue remuxing vorbis from matroska to ogg?
<slomo> cschalle: no, for vorbis/theora/others matroskademux is adding streamheader to the caps
<-- Mista_D has quit ()
<cschalle> slomo, ah ok, is there anything stopping us from doing that with vp8 too?
<slomo> cschalle: don't think so
Comment 3 Thiago Sousa Santos 2014-02-13 20:04:54 UTC
Isn't a bit too specific to go adding those stream headers in demuxers if they are only used for ogg? Shouldn't oggmux care for creating them instead of replicating this code?
Comment 4 Tim-Philipp Müller 2014-02-14 11:57:14 UTC
I agree that it should probably be oggmux creating them, since this is specific to the VP8 Ogg mapping. For Vorbis and Theora the stream headers are passed to the codecs and also need to be put into/extracted from the matroska headers in order for matroska files to be streamable with those codecs, so it's different there.

So I'd say:

 - don't make vp8enc add ogg-specific streamheaders to caps
 - make oggmux create the stream/id header from the input caps, assuming default values for pixel-aspect-ratio if not present (should probably require a framerate though?)
 - make sure not to duplicate out-of-band headers and in-stream headers when remuxing ogg (probably already does that)
Comment 5 Christian Fredrik Kalager Schaller 2014-03-05 10:06:47 UTC
Thiago are you still looking at this?
Comment 6 Thiago Sousa Santos 2014-03-05 20:22:00 UTC
Created attachment 271029 [details] [review]
oggmux: create vp8 header data if not provided in caps

This patch works, except that oggmux still requires the buffer
to have its OFFSET and OFFSET_END set to ogg specific data (granulepos)
which vp8enc does but other demuxers won't. I guess this should, too, be
moved to be handled in ogg to avoid replication of this code in all demuxers.
Apparently this is harder with vp8 because it contains invisible frames.

On another issue, removing the streamheaders generation from vp8enc also
removes the header buffer it generates for tags. Do we want to still
keep that? From oggmux's logic either we keep both stream header buffers
or none. If we decide to go for none vp8enc tagsetter interface would
be used to push the tags downstream? If there are no muxers
further downstream the tags are going to be lost, but they are anyway if
the muxer isn't oggmux.
Comment 7 Thiago Sousa Santos 2014-03-06 16:36:51 UTC
Created attachment 271118 [details] [review]
oggmux: implement vp8 granulepos function

Add an extra function to the oggstream map to inform it about
the incoming buffers. This way oggmux can keep a count on the
vp8 invisible frames and calculate the granulepos correctly.
Comment 8 Sebastian Dröge (slomo) 2014-03-06 19:50:23 UTC
Review of attachment 271029 [details] [review]:

Looks good
Comment 9 Sebastian Dröge (slomo) 2014-03-06 19:52:17 UTC
Review of attachment 271118 [details] [review]:

And this too
Comment 10 Christian Fredrik Kalager Schaller 2014-03-07 10:43:16 UTC
Tested the patches today, they fix remuxing from webm to ogg for me.
Comment 11 Christian Fredrik Kalager Schaller 2014-03-07 10:50:47 UTC
Ok, was a little quick with that comment :)

The remux seems to go fine, reming both audio and vidoe, but in the terminal I get the following message:
0:00:12.777693051 17994 0x7f433403b4f0 ERROR                 vp8enc gstvp8enc.c:1887:gst_vp8_enc_finish:<vp8enc0> encode returned 1 error


When I try to play the generated file in Totem I get a missing plugin message:
** Message: PackageKit: xid = 20971536
** Message: PackageKit: Codec nice name: application/x-unknown decoder
** Message: PackageKit: ignoring field named streamheader
** Message: PackageKit: structure: gstreamer1(decoder-application/x-unknown)()(64bit)

The file does not play. It doesn't play in mplayer either, although I don't know if mplayer is even supposed to support VP8 in Ogg.

If I try to re-encode the video in vp8 that doesn't seem to work either, so it seems putting vp8 in Ogg got general issues here.
Comment 12 Thiago Sousa Santos 2014-03-07 13:37:04 UTC
Hi Christian, it seems to be working here. 

Any particular file or configuration on generating it?
Comment 13 Christian Fredrik Kalager Schaller 2014-03-11 10:46:40 UTC
I am using the test files from here:
http://www.webmfiles.org/demo-files/

And then trying to remux them using git master transmageddon.
Comment 14 Christian Fredrik Kalager Schaller 2014-03-11 10:47:20 UTC
Created attachment 271517 [details]
Dotfile graph from transmageddon
Comment 15 Thiago Sousa Santos 2014-03-11 13:05:55 UTC
(In reply to comment #14)
> Created an attachment (id=271517) [details]
> Dotfile graph from transmageddon

This seems to be incomplete, it only shows the encodebin element and filesink, no sources or decoders anywhere. Is there any dot file with a complete graph?

Also, remuxing with gst-launch-1.0 works:

gst-launch-1.0 filesrc location=~/media/big-buck-bunny_trailer.webm ! matroskademux name=d ! queue ! oggmux name=m ! filesink location=test.ogg d. ! queue ! "audio/x-vorbis" ! m.

Is there anything special with transmageddon other than it using encodebin?
Comment 16 Thiago Sousa Santos 2014-03-11 13:25:12 UTC
I just tested with transmageddon from git and it works, too.
Comment 17 Christian Fredrik Kalager Schaller 2014-03-11 15:49:36 UTC
I re-tested with fresh checkout. Works fine, so please commit. And thank you :)
Comment 18 Thiago Sousa Santos 2014-03-11 16:14:08 UTC
commit a2633b7cf1d7dbff349649503083c0f9683d2ba8
Author: Thiago Santos <ts.santos@sisa.samsung.com>
Date:   Thu Mar 6 12:59:08 2014 -0300

    oggmux: implement vp8 granulepos function
    
    Add an extra function to the oggstream map to inform it about
    the incoming buffers. This way oggmux can keep a count on the
    vp8 invisible frames and calculate the granulepos correctly.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=722682

commit e00c30657197551ccb52d8ad83fa495b93875240
Author: Thiago Santos <ts.santos@sisa.samsung.com>
Date:   Wed Mar 5 16:34:42 2014 -0300

    oggmux: create vp8 header data if not provided in caps
    
    vp8 stream header shouldn't be assumed to be provided in caps always
    as this would repeat the same code in all demuxers/encoders. Instead,
    make oggmux generate them if they are not supplied.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=722682