get_request_pad from encodebin return None
Thibault Saunier
tsaunier at gnome.org
Tue Oct 9 18:41:27 UTC 2018
Re checked quickly and you first paste should almost work but, you are
using `GstPbutils.EncodingAudioProfile(vorbis, preset, vorbis, 0)`
instead of `GstPbutils.EncodingAudioProfile.new(vorbis, preset,
vorbis, 0)` which leads to the profile not being activated:
```
In [3]: vorbis = Gst.Caps.from_string("audio/x-vorbis")
In [4]: GstPbutils.EncodingAudioProfile(vorbis, None, vorbis, 0).is_enabled()
Out[4]: False
In [5]: GstPbutils.EncodingAudioProfile.new(vorbis, None, vorbis,
0).is_enabled()
0:00:18.999681729 5975 0x55db39f95930 ERROR default
encoding-profile.c:1133:common_creation: Is enabled: 1
Out[5]: True
```
This is probably what you want (my previous paste is also correct but
depends on what you want):
```
import gi
from time import sleep
from threading import Event
gi.require_version('Gst', '1.0')
from gi.repository import Gst, GstPbutils # noqa
Gst.init(None)
preset = None
encodebin = Gst.ElementFactory.make('encodebin')
ogg = Gst.Caps.from_string("application/ogg")
cprof = GstPbutils.EncodingContainerProfile("myprofile", None, ogg, None)
vorbis = Gst.Caps.from_string("audio/x-vorbis")
cprof.add_profile(GstPbutils.EncodingAudioProfile.new(vorbis, preset,
vorbis, 0))
encodebin.set_property("profile", cprof)
print(encodebin.get_request_pad('audio_%u'))
```
On Tue, Oct 9, 2018 at 2:45 PM RiccardoCagnasso <riccardo at phascode.org> wrote:
>
> Thibault Saunier-4 wrote
> > This is how it should look like:
> >
> > ```
> > import gi
> > from time import sleep
> > from threading import Event
> >
> > gi.require_version('Gst', '1.0')
> >
> > from gi.repository import Gst, GstPbutils # noqa
> >
> > Gst.init(None)
> >
> > preset = None
> >
> > encodebin = Gst.ElementFactory.make('encodebin')
> >
> > ogg = Gst.Caps.from_string("application/ogg")
> > cprof = GstPbutils.EncodingContainerProfile("myprofile", None, ogg, None)
> >
> > vorbis = Gst.Caps.from_string("audio/x-vorbis")
> > cprof.add_profile(GstPbutils.EncodingAudioProfile(vorbis, preset, vorbis,
> > 0))
> >
> > encodebin.set_property("profile", cprof)
> >
> > print(encodebin.emit('request-pad', Gst.Caps('audio/x-vorbis')))
> > ```
> >
> > Thibault
> > On Tue, Oct 9, 2018 at 12:21 PM RiccardoCagnasso <
>
> > riccardo@
>
> > > wrote:
> >>
> >> The example is somewhat wrong because it sets up a audio encoder and then
> >> request a video pad. Buy it yields the same result with
> >>
> >> encodebin.get_request_pad('audio_%u') is None
> >>
> >>
> >>
> >> --
> >> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> >> _______________________________________________
> >> gstreamer-devel mailing list
> >>
>
> > gstreamer-devel at .freedesktop
>
> >> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> > _______________________________________________
> > gstreamer-devel mailing list
>
> > gstreamer-devel at .freedesktop
>
> > https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
> I'm sorry, I can't wrap my head around your example. It seems to me that you
> are requesting a sink to input audio/x-vorbis in an encodebin that should
> encode audio/x-vorbis.
>
> What I'm expect is to be ably to put audio/x-raw in it or eventually any
> type of audio. something like this?
>
>
> import gi
> from time import sleep
> from threading import Event
>
> gi.require_version('Gst', '1.0')
>
> from gi.repository import Gst, GstPbutils # noqa
>
> Gst.init(None)
>
> encodebin = Gst.ElementFactory.make('encodebin')
>
> ogg = Gst.Caps.from_string("video/x-matroska")
> cprof = GstPbutils.EncodingContainerProfile("myprofile", None, ogg, None)
>
> h264 = Gst.Caps.from_string("video/x-h264")
> vaapih264enc = Gst.ElementFactory.make('vaapih264enc')
> Gst.Preset.save_preset(vaapih264enc, 'vaapih264enc_preset')
> video_profile = GstPbutils.EncodingVideoProfile(
> h264, 'vaapih264enc_preset', Gst.Caps.from_string('video/x-raw'), 0)
> cprof.add_profile(video_profile)
>
> encodebin.set_property("profile", cprof)
>
> pad = encodebin.emit('request-pad', Gst.Caps('video/x-raw'))
> print(pad)
>
>
>
>
> --
> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
More information about the gstreamer-devel
mailing list