GNOME Bugzilla – Bug 342448
[matroska] support for muxing/demuxing Theora video
Last modified: 2006-10-14 11:50:20 UTC
Please describe the problem: I just developed a small python script to transcode a video to theora/vorbis with matroska as the muxer but the output lacks the video track. I checked it changing to ogg muxer and it works so I guess it's a bug with the matroska plugin. After some checks I noticied that I was getting the error: gstqueue.c(783): gst_queue_push_one (): /pipeline/voutq: streaming stopped, reason not-negotiated and executing gst-inspect I get: carlos@aragorn:~$ gst-inspect-0.10 matroskamux Factory Details: Long name: Matroska muxer Class: Codec/Muxer Description: Muxes video/audio/subtitle streams into a matroska stream Author(s): Ronald Bultje <rbultje@ronald.bitfreak.net> Rank: none (0) Plugin Details: Name: matroska Description: Matroska stream handling Filename: /usr/lib/gstreamer-0.10/libgstmatroska.so Version: 0.10.3 License: LGPL Source module: gst-plugins-good Binary package: GStreamer Good Plugins (Debian) Origin URL: http://packages.qa.debian.org/gst-plugins-good0.10 GObject +----GstObject +----GstElement +----GstMatroskaMux Pad Templates: SINK template: 'video_%d' Availability: On request Has request_new_pad() function: 0xb7a62696 Capabilities: video/mpeg mpegversion: { 1, 2, 4 } systemstream: false width: [ 16, 4096 ] height: [ 16, 4096 ] framerate: [ 0/1, 2147483647/1 ] video/x-h264 width: [ 16, 4096 ] height: [ 16, 4096 ] framerate: [ 0/1, 2147483647/1 ] video/x-divx width: [ 16, 4096 ] height: [ 16, 4096 ] framerate: [ 0/1, 2147483647/1 ] video/x-xvid width: [ 16, 4096 ] height: [ 16, 4096 ] framerate: [ 0/1, 2147483647/1 ] video/x-huffyuv width: [ 16, 4096 ] height: [ 16, 4096 ] framerate: [ 0/1, 2147483647/1 ] video/x-dv width: [ 16, 4096 ] height: [ 16, 4096 ] framerate: [ 0/1, 2147483647/1 ] video/x-h263 width: [ 16, 4096 ] height: [ 16, 4096 ] framerate: [ 0/1, 2147483647/1 ] video/x-msmpeg width: [ 16, 4096 ] height: [ 16, 4096 ] framerate: [ 0/1, 2147483647/1 ] image/jpeg width: [ 16, 4096 ] height: [ 16, 4096 ] framerate: [ 0/1, 2147483647/1 ] video/x-raw-yuv format: { YUY2, I420 } width: [ 16, 4096 ] height: [ 16, 4096 ] framerate: [ 0/1, 2147483647/1 ] SINK template: 'audio_%d' Availability: On request Has request_new_pad() function: 0xb7a62696 Capabilities: audio/mpeg mpegversion: 1 layer: [ 1, 3 ] channels: [ 1, 8 ] rate: [ 8000, 96000 ] audio/mpeg mpegversion: { 2, 4 } channels: [ 1, 8 ] rate: [ 8000, 96000 ] audio/x-ac3 channels: [ 1, 8 ] rate: [ 8000, 96000 ] audio/x-vorbis channels: [ 1, 8 ] rate: [ 8000, 96000 ] audio/x-raw-int width: { 8, 16, 24 } depth: { 8, 16, 24 } endianness: { 4321, 1234 } signed: { true, false } channels: [ 1, 8 ] rate: [ 8000, 96000 ] audio/x-tta width: { 8, 16, 24 } channels: { 1, 2 } rate: [ 8000, 96000 ] SINK template: 'subtitle_%d' Availability: On request Has request_new_pad() function: 0xb7a62696 Capabilities: ANY SRC template: 'src' Availability: Always Capabilities: video/x-matroska Element Flags: no flags set Element Implementation: No loopfunc(), must be chain-based or not configured yet Has change_state() function: 0xb7a64b37 Has custom save_thyself() function: gst_element_save_thyself Has custom restore_thyself() function: gst_element_restore_thyself Element has no clocking capabilities. Element has no indexing capabilities. Pads: SRC: 'src' Implementation: Has custom eventfunc(): 0xb7a61707 Pad Template: 'src' Element Properties: name : The name of the object flags: readable, writable String. Default: null Current: "matroskamux0" writing-app : The name the application that creates the matroska file. flags: readable, writable String. Default: null Current: "GStreamer Matroska muxer" version : This parameter determines what matroska features can be used. flags: readable, writable Integer. Range: 1 - 2 Default: 1 Current: 1 from where you can see that video/x-theora is not there as one of the available streams to store there. Steps to reproduce: Actual results: Expected results: Does this happen every time? Yes Other information: I'm using Ubuntu Dapper with the package gstreamer0.10-plugins-good version 0.10.3 installed.
Moved to gstreamer, I really don't understand how is that this ended in pitivi...
Well, it's not that hard to make matroskamux accept theora as well, there's only one small problem: there is no player that can play those files yet :)
I guess any gstreamer based player will be able to play them ;-) I did a couple of trivial patches to support Theora inside matroska content. The demux one is really easy, the mux is a bit more difficult because I know nothing about video codecs and I don't fully understand the header I should add. Just for your information, the package mkvtoolnix is able to create such matroska files.
Step 1: fix matroska mux/demux in -good: 2006-05-23 Tim-Philipp Müller <tim at centricular dot net> * gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream), (gst_matroska_demux_push_xiph_codec_priv_data), (gst_matroska_demux_parse_blockgroup_or_simpleblock), (gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps): * gst/matroska/matroska-ids.h: * gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init), (gst_matroska_mux_video_pad_setcaps), (xiph3_streamheader_to_codecdata), (vorbis_streamheader_to_codecdata), (theora_streamheader_to_codecdata), (gst_matroska_mux_audio_pad_setcaps), (gst_matroska_mux_write_data): Add support for muxing/demuxing theora video (#342448; too bad none of the usual linux players can actually play this). Playback in GStreamer will require additional changes to theoradec in -base. Refactor streamheaders <=> CodecPrivateData code a bit; some small cleanups. Step 2: fix theoradec in -base ... (still to do)
Step 2: fix theordec in gst-plugins-base: 2006-05-23 Tim-Philipp Müller <tim at centricular dot net> * ext/theora/theoradec.c: (theora_dec_chain): Make work with time-stamped input buffers that do not have a granulepos in BUFFER_OFFSET_END (like theora buffers coming from matroskademux). Fixes #342448.
Hmm, I just tested this. I generated a .mkv file with Vorbis audio and Theora video but I'm not able to play it later with totem. I got gstreamer from CVS and build it to get your patches. I didn't recompile totem as I guess is enough a library update, right? Is there anything I could do to help you to debug it? Cheers.
Not sure, Works For Me (tm), for a file created like this: $ gst-launch-0.10 audiotestsrc num-buffers=441 ! audioconvert ! vorbisenc ! queue ! mux. videotestsrc num-buffers=300 ! theoraenc ! queue ! mux. matroskamux name=mux ! filesink location=test.mkv You shouldn't need to update totem, only gst-plugins-good and -base. However (I'm sure you are aware of this, just making sure) if you installed GStreamer from source it might have gotten installed into a different prefix (/usr/local/) by default, which means it might or might not be picked up and whether totem uses that copy or the one from package might depend on your environment variables and how you started totem (via the applications menu or from the command line) etc. ...
I forgot: try playing it in playbin via gst-launch: $ gst-launch-0.10 -v playbin uri=file:///path/to/foo.mkv Also, in what way does it 'not work'? Do you get an error message? Does it hang? crash? do nothing?
I executed ./autogen.sh --prefix=/usr so I'm sure it's installed over my packaged version. About what's wrong with it, the encoding works, or at least, my python script is not complaining about it, but when I try to play the file, totem does nothing. With the gst-launch command it doesn't work either. I tried it with the test signals encoded as matroska/vorbis/theora with same problem, I'm only able to listen the sound but no video windows is open at all. I'm able to play other videos without problems. If it works for you, I guess I have some problem on my side... but I don't know what's wrong...
Created attachment 66270 [details] The output I get with gst-launch
> The output I get with gst-launch This looks pretty much like theoradec never outputs any buffers, because it queues them up internally until it gets a granulepos. In other words: this looks like it is not using a patched/updated theoradec for some reason. What's the output of $ ldd gst-launch-0.10 | grep gstreamer $ gst-inspect-0.10 theora | grep Version $ gst-inspect-0.10 matroska | grep Version Could you do $ export GST_DEBUG_NO_COLOR=1 $ export GST_DEBUG=*:5 $ gst-launch-0.10 playbin uri=file:///path/to/test.mkv 2>dbg.log $ bzip2 dbg.log and attach the dbg.log.bz2 file?
Marking this as RESOLVED/FIXED for now assuming the reporter still had those problems because of old plugins being dragged in somehow. No one else I asked could reproduce this either with current CVS. Carlos: please re-open if you still have problems with the upcoming -good 0.10.4 release and/or the above gst-inspect lines show that you are using GStreamer CVS or -good 0.10.4.
You were right, it was a bad installation. Thank you!!!