PbUtils with GStreamer 1.0 in Python

Thibault Saunier tsaunier at gnome.org
Thu Jun 11 02:02:19 PDT 2015


Hello,

You are tring to but raw audio in a x-wav container, that does not
make muuch sense. For that particular case you should just have 1
audio profile as audio/x-wav I think (no container).

To add verbosity you should do GST_DEBUG=X --  Read the docs :)

Regards,

Thibault

On Thu, Jun 11, 2015 at 10:45 AM, Sébastien FENET
<sebastien.fenet at yahoo.fr> wrote:
> Great! I can now create the Profiles.
> Thanks also for pointing the documentation, it'll be more than helpful.
>
> I however still have a problem with *encodebin*. I would like to use it to
> encode audio files. So, let's say I want to create a WAV file. As far I
> understood, I have to create an AudioProfile and then a ContainerProfile to
> which I add the audio profile. I finally assign this container profile to
> the *encodebin*. Below is some example code.
>
> For some reason, it does not work (it creates an empty file). Funny thing
> is, it works if I remove the ContainerProfile and assign directly the
> AudioProfile to *encodebin*. But, of course, the resulting file has no
> header... So, am I doing something wrong with the container?
>
> While I'm here, is there a way to increase Gstreamer verbose level when
> using it in Python (I'm using Windows)? Sorry for the beginner's
> questions... could not find that many tutos about Gstreamer in Python...
>
> import gi
> gi.require_version('Gst', '1.0')
> from gi.repository import Gst
> from gi.repository import GstPbutils
> import time
> Gst.init(None)
>
> pipeline = Gst.parse_launch('''
> audiotestsrc is-live=1 !
> decodebin !
> encodebin name=encodebin !
> filesink location=./output/test0611.wav
> ''')
>
> encodebin = pipeline.get_by_name("encodebin")
>
> audioprofile = GstPbutils.EncodingAudioProfile(Gst.Caps("audio/x-raw"),
> None, None, 0)
> containerprofile = GstPbutils.EncodingContainerProfile(None, None ,
> Gst.Caps("audio/x-wav"), None)
> containerprofile.add_profile(audioprofile)
>
> encodebin.set_property("profile", containerprofile)
>
> pipeline.set_state(Gst.State.PLAYING)
> time.sleep(2)
> pipeline.set_state(Gst.State.NULL)
>
>
>
>
> ________________________________
> De : Thibault Saunier <tsaunier at gnome.org>
> À : Sébastien FENET <sebastien.fenet at yahoo.fr>; Discussion of the
> development of and with GStreamer <gstreamer-devel at lists.freedesktop.org>
> Envoyé le : Jeudi 11 juin 2015 10h20
> Objet : Re: PbUtils with GStreamer 1.0 in Python
>
> Hello seb,
>
> You can do:
>
>   In [7]: from gi.repository import Gst
>   In [8]: Gst.init(None)
>   In [9]: from gi.repository import GstPbutils
>   In [10]: GstPbutils.EncodingContainerProfile ("ogg", None ,
> Gst.Caps("application/ogg"), None)
>   Out[10]: <EncodingContainerProfile object at 0x7f576bd4cea0
> (GstEncodingContainerProfile at 0x7f577d30e760)>
>
> You should have a look at the documentation:
> https://lazka.github.io/pgi-docs/#Gst-1.0
>
> Regards,
>
> Thibault Saunier
>
>
> On Thu, Jun 11, 2015 at 9:57 AM, Sébastien FENET
> <sebastien.fenet at yahoo.fr> wrote:
>> Hi,
>>
>> I'm trying to port some Python code from Gstreamer 0.10 to Gstreamer 1.0.
>>
>> In this code, I was using an "encodebin" element. To this end, I had to
>> create some EncodingProfiles. They were created with something like that:
>>
>> [...]
>> import gst.pbutils
>> [...]
>> profile = gst.pbutils.EncodingContainerProfile ("ogg", None ,
>> gst.Caps("application/ogg"), None)
>>
>> I can't find a way to reconduct this with Gstreamer 1.0. In fact, I didn't
>> find Pbutils... Could anyone help with that?
>>
>> Thanks!
>> Seb.
>>
>> _______________________________________________
>> gstreamer-devel mailing list
>> gstreamer-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
>
>>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>


More information about the gstreamer-devel mailing list