简体   繁体   中英

gstreamer: no output from custom pipeline (replacing playbin)

I'm trying to replace playbin in an application with my own pipeline, because I need to add filters to the video. Here is what I tried:

#     self.pipeline = gst.ElementFactory.make("playbin", None)
#     self.pipeline.set_property("uri", "appsrc://")
self.pipeline = gst.Pipeline.new("player")
source = gst.ElementFactory.make("uridecodebin", "decodebin")
source.set_property("uri", "appsrc://")
self.pipeline.add(source)

aqueue = gst.ElementFactory.make("queue", "aqueue")        
aconverter = gst.ElementFactory.make("audioconvert", "aconverter")        
asink = gst.ElementFactory.make("autoaudiosink", "audiosink")
self.pipeline.add(aqueue)
self.pipeline.add(aconverter)
self.pipeline.add(asink)
source.link(aqueue)
aqueue.link(aconverter)
aconverter.link(asink)

vqueue = gst.ElementFactory.make("queue", "vqueue")        
vconverter = gst.ElementFactory.make("videoconvert", "vconverter")
vsink = gst.ElementFactory.make("autovideosink", "videosink")
self.pipeline.add(vqueue)
self.pipeline.add(vconverter)
self.pipeline.add(vsink)
source.link(vqueue)
vqueue.link(vconverter)
vconverter.link(vsink)

Later I connect to the source's source-setup signal, and then to the need-data signal to feed it with data. This works with playbin , ie an output window opens and shows the video. With my custom pipeline nothing happens - no window is opened and of course I can't see anything.

Why is that so and how can I fix it?

I have also tried removing all the audio stuff and using only the video elements, with the same result. I don't even really need audio for this application.

Uridecodebin has dynamic pads. They are only created when streaming starts because it needs to demux/decode to get to know how many pads it needs to expose. Check https://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/chapter-pads.html#section-pads-dynamic

For debugging it is also good practice to look at the gstreamer logs or check the pipeline bus for error messages. It likely would have reported a not-linked error. Or checking the return for the link calls would tell you it was failing.

Anyway, you can just use playbin and set the video-filter property.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM