I have a video player pipeline scaling: playbin3 → videoscale → glinkbin → gtk4paintablesink.
The gtk4paintable sink is set as the paintable for a Gtk Picture after I set up the pipeline.
The picture’s set_size_request sets a width and height greater than the resolution of the video I play, but with the same aspect ratio.
The scaling seems to look OK on my screen (no jaggies or funny blurring) and the CPU usage stays low.
How can I see if videoscale is doing anything or if the paintablesink is just scaling?
Hi @patknight
To check the caps that the pipeline’s elements are negotiating, including the “videoscale”, you can add the “-v” option, for example:
gst-launch-1.0 -v playbin3 ! …
You will get something like this for the videoscale element, as well as for gtk4paintablesink:
/GstPipeline:pipeline0/GstVideoScale:videoscale0.GstPad:src: caps = video/x-raw, format=(string)A444_16LE, width=(int)320, height=(int)240, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
/GstPipeline:pipeline0/GstVideoScale:videoscale0.GstPad:sink: caps = video/x-raw, format=(string)A444_16LE, width=(int)320, height=(int)240, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
If you want to force a specific resolution in the gtk4paintablesink, you need to set the caps explicitly after the videoscale element, for example:
… ! videoscale ! video/x-raw,width=1920,height=1080 ! …
Regards.
Hi @luis.merayo
Thanks for the guidance. This is what I was looking for. In my app, I set up the pipeline programmatically, but I can go and play with using parse launch to see if I can make that work. I’ll also look into doing the equivalent using the APIs.
Cheers,
Pat
To close this off in case this is useful for someone else. The thing to do is create Caps and then use link_filtered to use them.
I ended up with (in Python, assume error checking and handling)
video_bin = Gst.Bin() # make a Bin that's going to act as the sink for playbin3
video_bin.add(video_sink) # the video_sink is in every pipeline and was created earlier
if need_scale_plugin:
scale_caps = Gst.caps_from_string(f"video/x-raw, width={width}, height={height}")
scale_plugin = player_factory.make("videoscale", "videoscale")
scale_plugin.set_property("method", ScalingMethod.CATROM)
video_bin.add(scale_plugin)
if not scale_plugin.link_filtered(video_sink, scale_caps):
raise RuntimeError("Unable to link scale to video sink")
Cheers
Pat
Side note to whom it could help checking caps negociation when pipeline is programatically built (this is what gst-launch-1.0 -v does), you can connect signal deep-notify to the pipeline before running it and attach a callback function (here just logging):
C/C++:
g_signal_connect(pipeline, “deep-notify”, G_CALLBACK(gst_object_default_deep_notify), NULL);
Python:
pipeline.connect(‘deep-notify’, verbose_deep_notify_cb, None)
Thanks for adding the helpful info and making the answer more complete.