I need help with "interleave"

Michael Gruner michael.gruner at ridgerun.com
Mon Jan 4 22:12:26 PST 2016


Hi Gontzal

There are a lot of details to consider when manually building a pipeline,
specially when linking elements together. I recommend you using the
available parser wrappers, which are way more convenient. Take a look at
the following snippet, it does exactly the same as yours, but takes care of
the details internally (and looks cleaner to me)

Good Luck!
Gruner


uses Gst

pipeline: private Pipeline
gst_launch: private string

init
    Gst.init (ref args);

    gst_launch = "interleave name=i ! audioconvert ! wavenc ! filesink
location=file.wav filesrc location=file1.wav ! decodebin ! audioconvert !
'audio/x-raw-int,channels=1' ! queue ! i.   filesrc location=file2.wav !
decodebin ! audioconvert ! 'audio/x-raw-int,channels=1' ! queue ! i."

    pipeline = Gst.parse_launch(gst_launch) as Pipeline;

    pipeline.set_state(Gst.State.PLAYING)

    new MainLoop().run();

On Mon, Jan 4, 2016 at 5:31 PM, gontzal <txasatonga at gmail.com> wrote:

> Hi to all.
>
> I would to ask you how can I traslate this gst-launch code to a pyhton or
> Vala or Genie code.
>
> gst-launch-0.10 interleave name=i ! audioconvert ! wavenc ! filesink
> location=file.wav \
> filesrc location=file1.wav ! decodebin ! audioconvert !
> "audio/x-raw-int,channels=1" ! queue ! i. \
>   filesrc location=file2.wav ! decodebin ! audioconvert !
> "audio/x-raw-int,channels=1" ! queue ! i.
>
> I have tryied with this code without success.
>
> uses Gst
>
> pipeline: private Pipeline
> interleave: private Element
> audioconvert: private Element
> audioconvert2: private Element
> audioconvert3: private Element
> wavenc: private Element
> decodebin2: private Element
> decodebin3: private Element
> capsfilter2: private Element
> capsfilter3: private Element
> filesink: private Element
> src3:private Element
> src2:private Element
> queue2:private Element
> queue3:private Element
> capsfilter2a:private Element
> capsfilter3a:private Element
>
> init
>     Gst.init (ref args);
>     pipeline = new Pipeline ("mypipeline");
>
>     interleave=ElementFactory.make ("interleave","inter")
>     interleave.set ("name","i")
>     audioconvert=ElementFactory.make ("audioconvert","audioconvert")
>     wavenc=ElementFactory.make ("wavenc","wavenc")
>     filesink=ElementFactory.make ("filesink","filesink")
>     filesink.set("location","totalfinal.wav")
>
>     // primer archivo
>     src2= ElementFactory.make ("filesrc", "filesrc2")
>     src2.set ("location","file1.wav")
>     decodebin2= ElementFactory.make ("decodebin", "decodebin2")
>     audioconvert2= ElementFactory.make ("audioconvert", "audioconvert2")
>     capsfilter2= ElementFactory.make ("capsfilter","capsfileter2")
>     capsfilter2.set("caps",
> Gst.Caps.from_string("audio/x-raw-int,channels=1"))
>     queue2= ElementFactory.make ("queue","queue2")
>     capsfilter2a= ElementFactory.make ("capsfilter","capsfileter2a")
>     capsfilter2a.set("caps", Gst.Caps.from_string("i.sink_0"))
>
>     // segundo archivo
>     src3= ElementFactory.make ("filesrc", "filesrc3")
>     src3.set ("location","file2.wav")
>     decodebin3= ElementFactory.make ("decodebin", "decodebin3")
>     audioconvert3= ElementFactory.make ("audioconvert", "audioconvert3")
>     capsfilter3= ElementFactory.make ("capsfilter","capsfileter3")
>     capsfilter3.set("caps",
> Gst.Caps.from_string("audio/x-raw-int,channels=1"))
>     queue3= ElementFactory.make ("queue","queue3")
>     capsfilter3a= ElementFactory.make ("capsfilter","capsfileter3a")
>     capsfilter3a.set("caps", Gst.Caps.from_string("i.sink_1"))
>
>
>     pipeline.add_many(interleave,wavenc,filesink,audioconvert);
>
> pipeline.add_many(src2,src3,decodebin2,decodebin3,audioconvert2,audioconvert3,capsfilter2,capsfilter2a,capsfilter3,capsfilter3a);
>     pipeline.add_many(queue2,queue3);
>
>     // basic line
>     interleave.link(audioconvert)
>     audioconvert.link(wavenc)
>     wavenc.link(filesink)
>
>     // first src
>     src2.link(decodebin2)
>     decodebin2.link(audioconvert2)
>     audioconvert2.link(capsfilter2)
>     capsfilter2.link(queue2)
>     queue2.link(capsfilter2a)
>
>     // second src
>     src3.link(decodebin3)
>     decodebin3.link(audioconvert3)
>     audioconvert3.link(capsfilter3)
>     capsfilter3.link(queue3)
>     queue3.link(capsfilter3a)
>
>
>     pipeline.set_state(Gst.State.PLAYING)
>
>     new MainLoop().run();
>
> I have published the same question in stackoverflow. I you want you can
> answer there.
>
> http://stackoverflow.com/questions/34520717/i-need-help-about-of-audio-interleave-on-gstreamer-0-10/34523133?noredirect=1#comment56821434_34523133
> Thanks.
> Gontzal
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20160105/db3df400/attachment.html>


More information about the gstreamer-devel mailing list