PbUtils with GStreamer 1.0 in Python

Sébastien FENET sebastien.fenet at yahoo.fr
Thu Jun 11 01:45:30 PDT 2015


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 gigi.require_version('Gst', '1.0')from gi.repository import Gstfrom gi.repository import GstPbutilsimport timeGst.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


   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20150611/f7fb8489/attachment-0001.html>


More information about the gstreamer-devel mailing list