GstVideoOverlay SetRenderRectangle question

classic Classic list List threaded Threaded
4 messages Options
tom
Reply | Threaded
Open this post in threaded view
|

GstVideoOverlay SetRenderRectangle question

tom
Hello

I don't quite understand how VideoOverlayAdapter.SetRenderRectangle (from
gstreamer-sharp) and gst_video_overlay_set_render_rectangle works.

I have modified
https://github.com/GStreamer/gstreamer-sharp/blob/master/samples/BasicTutorial5.cs
to set the render rectangle, like this:

            VideoOverlayAdapter adapter = new
VideoOverlayAdapter(overlay.Handle);
            adapter.WindowHandle = windowHandle;
            adapter.SetRenderRectangle(50, 50, 427, 240);
            adapter.HandleEvents(true);

I expected that the video will be rendered in the 427x240 rectangle, at the
position 50,50, but there is a correct rectangle at the position, and video
is moved to the 50,50 inside this rectangle. The same happens in the
WinForms version of the sample.

See the image
<http://gstreamer-devel.966125.n4.nabble.com/file/t378393/renderrect.jpg>

Is this the correct behavior or a bug ?

I'm using GStreamer 1.14.1 32bit on Windows 10.

Thanks,
Tom



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: GstVideoOverlay SetRenderRectangle question

Nicolas Dufresne-5


Le mar. 10 juil. 2018 17:56, tom <[hidden email]> a écrit :
Hello

I don't quite understand how VideoOverlayAdapter.SetRenderRectangle (from
gstreamer-sharp) and gst_video_overlay_set_render_rectangle works.

I have modified
https://github.com/GStreamer/gstreamer-sharp/blob/master/samples/BasicTutorial5.cs
to set the render rectangle, like this:

            VideoOverlayAdapter adapter = new
VideoOverlayAdapter(overlay.Handle);
            adapter.WindowHandle = windowHandle;
            adapter.SetRenderRectangle(50, 50, 427, 240);
            adapter.HandleEvents(true);

I expected that the video will be rendered in the 427x240 rectangle, at the
position 50,50, but there is a correct rectangle at the position, and video
is moved to the 50,50 inside this rectangle. The same happens in the
WinForms version of the sample.

See the image
<http://gstreamer-devel.966125.n4.nabble.com/file/t378393/renderrect.jpg>

Is this the correct behavior or a bug ?

Yes and no, if the display sink can scale, the video should be scaled to the width/height of the rectangle. If the display can crop, it should minimally crop to that rectangle. It seems that these two feature are not supported or not implemented.

To deal with non-scaling sink, you can add video scale in front. The non-scaling sink are supposed to prefix the caps with the preferred width and height so that videoscale will do the right thing. If this is not the case, then is a big in the non-scaling sink implementation.



I'm using GStreamer 1.14.1 32bit on Windows 10.

Thanks,
Tom



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
tom
Reply | Threaded
Open this post in threaded view
|

Re: GstVideoOverlay SetRenderRectangle question

tom
Nicolas Dufresne-5 wrote
> Le mar. 10 juil. 2018 17:56, tom &lt;

> ttustonic@

> &gt; a écrit :
>
>
> Yes and no, if the display sink can scale, the video should be scaled to
> the width/height of the rectangle. If the display can crop, it should
> minimally crop to that rectangle. It seems that these two feature are not
> supported or not implemented.

Thanks for the reply

Hm, from these images it seems that the video is correctly scaled and
cropped to the rectangle, but there is extra 'padding' inside the target
rectangle, the same as the 'margins' outside the target rectangle.
Here's another example, one with smaller rectangle and one without render
rectangle. The scaling and cropping looks fine.

<http://gstreamer-devel.966125.n4.nabble.com/file/t378393/renderrect2.jpg>

Thanks,
Tom



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
tom
Reply | Threaded
Open this post in threaded view
|

Re: GstVideoOverlay SetRenderRectangle question

tom
In reply to this post by Nicolas Dufresne-5
Nicolas Dufresne-5 wrote
> Le mar. 10 juil. 2018 17:56, tom &lt;

> ttustonic@

> &gt; a écrit :
>
> To deal with non-scaling sink, you can add video scale in front. The

This is from the tutorial example, which only uses playbin. I'd assume that
videoscale should already be in there.


> non-scaling sink are supposed to prefix the caps with the preferred width
> and height so that videoscale will do the right thing. If this is not the

Being on Windows, it's probably d3dvideosink. Here
https://gstreamer.freedesktop.org/documentation/tutorials/basic/platform-specific-elements.html
it says: "It supports rescaling and filtering of the scaled image"

Thanks, Tom





--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel