GStreamer MP4 to Matroska

classic Classic list List threaded Threaded
1 message Options
MTy
Reply | Threaded
Open this post in threaded view
|

GStreamer MP4 to Matroska

MTy
Hi im quite new to GStreamer and have a few questions.

I'm using the java-wrapper for GStreamer in order to transcode different media streams in to a Matroska video stream. The main goal that I'm trying to achieve is live on the fly transcoding, i.e.
                             
                             GStreamer
-------video/x----->||||||||||||||||||||||||-----Matroska----->

As soon as you write video data on the inputstream GStreamer will transcode it and put it on the outputstream as Matroska video data. I have gotten it to somewhat work with "AVI to Matroska" in this manner, here is the code that i used:

String def = "decodebin name=DecodeBin ! ffenc_mpeg4 ! ffmux_matroska name=MediaMux";
Pipeline pipe = Pipeline.launch(def);
InputStreamSrc streamSrc = new InputStreamSrc(inStream, "Input Stream");
OutputStreamSink streamSink = new OutputStreamSink(outStream, "Output Stream");
pipe.addMany(streamSrc, streamSink);
streamSrc.link(pipe.getElementByName("DecodeBin"));
pipe.getElementByName("MediaMux").link(streamSink));
pipe.setState(State.PLAYING);
Gst.main();
pipe.setState(State.NULL);

With this code I can write AVI data to the inputstream and then GStreamer will start writing Matroska data to the outputstream in the same phase as the video normally plays. HOWEVER when I send MP4 data to the inputstream GStreamer won't start writing Matroska data to the outputstream until the end of the MP4 data has been written. Why is this? Is there a workaround to get the same data flow with MP4?


Thanks alot / Rikard