paxdiablo
paxdiablo

Reputation: 881283

Post-process GStreamer playbin pipeline

The playbin pipeline in GStreamer is a wonderful thing in that I don't need to have any real knowledge about the individual elements needed to process the stream.

However, if I wanted to rotate the video 90 degrees (or flip it, or anything else), it appears I have to manually code up the pipeline. At the moment, I'm doing this with:

rtspsrc location=X
    ! rtph264depay
    ! h264parse
    ! decodebin
    ! videoflip method=Y
    ! videoconvert
    ! autovideosink

However, because I'm binding the video to a specific Gtk widget, I capture the message asking for the widget ID and provide that back to GStreamer so it can correctly bind.

Unfortunately, according to gst-inspect-1.0, none of those elements in the pipeline above appear to actually provide the GstVideoOverlay interface so that, when I query for one that can receive the widget identifier, I get null followed very quickly by a null pointer error. Or, if I do nothing when the null is returned, no binding occurs and GStreamer opens up a separate window to stream the video.

It turns out that playbin itself provides the required interface.

I also tried replacing autovideosink with ximagesink, and then with xvimagesink, both of which claim to support the interface but, in both cases, no element was found that supported the interface.

So my question s are basically this:

1/ Can I insert something into the above pipeline that will provide the interface?

2/ Failing that, is there a way to use playbin to analyse the stream correctly but then capture its output and pass that through more filters? The sort of thing I'm thinking of is:

playbin location=X
    ! videoflip method=Y
    ! autovideosink

In other words, can I use something like the video-sink property of playbin to stop it creating its own sink and instead pass its data through to the videoflip?

I'd prefer something that could be implemented with Gst.Parse.Launch() since I don't really want to have to mess about creating every single pipeline element manually if I can avoid it.

Upvotes: 0

Views: 2012

Answers (1)

thiagoss
thiagoss

Reputation: 2094

I'd say the way you are requesting the GstVideoOverlay is not correct or there is a bug in GStreamer, xvimagesink and ximagesink both support GstVideoOverlay interface. autovideosink doesn't but it is likely that the videosink inside it will support.

Anyway, you want to have a custom bin set to the video-sink property. You can create your bin and put the elements you want inside it, create a sink ghostpad and then set it as the video-sink of your playbin.

It is also possible to do it using parse-launch syntax:

gst-launch-1.0 playbin video-sink="videoconvert ! videoscale ! aasink" uri=file://<path/to/some/file>

Just replace the bin elements with whatever you need.

Upvotes: 1

Related Questions