2

I am using the playbin using gst-python:

player = Gst.ElementFactory.make("playbin", None)
player.set_property("uri", "file:///tmp/big_buck_bunny_720p_30mb.mp4")

Now I add some video-filters:

videocrop = Gst.ElementFactory.make('videocrop', None)
videocrop.set_property('top', 300)

This nicely crops the video. I can also do this with videoflip. However, when I try to apply multiple filters, using a Bin, my pipeline does not work. Code I am using:

video_filters = Gst.Bin("video_filters")
videocrop = Gst.ElementFactory.make('videocrop', None)
videocrop.set_property('top', 300)
video_filters.add(videocrop)
videoflip = Gst.ElementFactory.make('videoflip', None)
videoflip.set_property('method', 'clockwise')
video_filters.add(videoflip)
videocrop.link(videoflip)
player.set_property('video-filter', video_filters)

The pipeline won't play. What am I doing wrong?

reinzor
  • 161
  • 7
  • have you tried giving a timeout between the 2 filters? please provide some more debug info of whats happening when you try to play. – gst Sep 24 '18 at 15:20

1 Answers1

0

Hey so I doubt this is the most optimal solution but something like the following worked for me.

video_filters = Gst.Bin("video_filters")
videocrop = Gst.ElementFactory.make('videocrop', None)
videocrop.set_property('top', 300)
video_filters.add(videocrop)
videoflip = Gst.ElementFactory.make('videoflip', None)
videoflip.set_property('method', 'clockwise')
video_filters.add(videoflip)
videocrop.link(videoflip)

sink_pad = videocrop.sinkpad
source_pad = videoflip.srcpad
ghostpad_sink = Gst.GhostPad.new("sink", sink_pad)
ghostpad_source = Gst.GhostPad.new("src", source_pad)
video_filters.add_pad(ghostpad_sink)
video_filters.add_pad(ghostpad_source)

player.set_property('video-filter', video_filters)

The debug log says something about the ghost pad being unnecessary

gstutils.c:1587:prepare_link_maybe_ghosting: filter-convert and video_filters in same bin, no need for ghost pads

But removing it stopped things working for me.

Peter
  • 443
  • 4
  • 9