dynamic scaling at videomixer

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

dynamic scaling at videomixer

wolfvr
Dear developers,

I am using the videomixer element to show a mosaic of multiple video channels.
Now I want adapt the mosaic in case new channels appear. I tried to set new caps at the capsfilter I have in front of each videomixer input pad.

I am using python to create and control the gstreamer pipeline. See code snippets below.

The pipeline is running fine, but nothing happens when I trigger the code to shrink the size of the video channels.

What am I doing wrong? Is there a better way to achieve this (= resizing dynamicaly the video input on a gstreamer video mixer)

Thanks in advance.
Regards,
Wolfgang.

# the caps
VIDEO_I420_CAPS='video/x-raw-yuv, format=(fourcc)I420, width=(int)640, height=(int)480, framerate=(fraction)24/1, interlaced=(boolean)false, pixel-aspect-ratio=(fraction)1/1'

VIDEO_I420_SMALL_CAPS='video/x-raw-yuv, format=(fourcc)I420, width=(int)320, height=(int)240, framerate=(fraction)24/1, interlaced=(boolean)false, pixel-aspect-ratio=(fraction)1/1'


# the videomixer + first channel as background
self.mixer = gst.element_factory_make('videomixer')
#background channel
bg = self.pipeline.add_element('videotestsrc')
caps = self.pipeline.add_element('capsfilter')
caps.set_property('caps', gst.Caps(VIDEO_I420_CAPS))
c3 = self.pipeline.add_element('ffmpegcolorspace')

pipeline.add_many(mixer, bg, caps,c3)
gst.element_link_many(bg, c3, caps, self.mixer)
...

# adding a channel
# elements per channel
q = gst.element_factory_make('queue')
cs = gst.element_factory_make('ffmpegcolorspace')
caps = gst.element_factory_make('capsfilter')
caps.set_property('caps', gst.Caps(VIDEO_I420_CAPS))
rate = gst.element_factory_make('videorate')
scale = gst.element_factory_make('videoscale')

pipeline.add_many(q, cs, caps, rate, scale)
#video = video source
gst.element_link_many(video, q, cs, scale, rate, caps, self.mixer)

self.controllers.append(caps)
...

# afterwards. changing the size of channel 1
caps = self.controllers[1]
caps.set_property('caps', gst.Caps( VIDEO_I420_SMALL_CAPS ))