How to crop video on Android/Gstreamer with glimagesink

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

How to crop video on Android/Gstreamer with glimagesink

Grégoire Gentil
Hello,

I would like to crop the rendering of a video playback in Android which
uses glimagesink.

I can do the job by inserting a videocrop element before glimagesink but
I would like to achieve the same goal by using the "render-rectangle"
property of glimagesink - the objective is that the crop operation is
done by the GPU, not the CPU. That doesn't work.
gst_video_overlay_set_render_rectangle doesn't work either.

Am I missing something?

Thanks in advance,

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

Re: How to crop video on Android/Gstreamer with glimagesink

Nicolas Dufresne-5
Le samedi 01 février 2020 à 13:21 -0800, Gregoire Gentil a écrit :

> Hello,
>
> I would like to crop the rendering of a video playback in Android which
> uses glimagesink.
>
> I can do the job by inserting a videocrop element before glimagesink but
> I would like to achieve the same goal by using the "render-rectangle"
> property of glimagesink - the objective is that the crop operation is
> done by the GPU, not the CPU. That doesn't work.
> gst_video_overlay_set_render_rectangle doesn't work either.
>
> Am I missing something?

Unfortunatly, glimagesink does not implement crop meta. You could use
glvideomixer to simulate it, but that's not ideal.
gst_video_overlay_set_render_rectangle() is meant to position the
render rectangle within a your window, the content is expected to be
scaled.

You can also do that using your own shader and glshader element.

>
> Thanks in advance,
>
> Grégoire
> _______________________________________________
> 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
Reply | Threaded
Open this post in threaded view
|

Re: How to crop video on Android/Gstreamer with glimagesink

Nicolas Dufresne-5
In reply to this post by Grégoire Gentil
Le samedi 01 février 2020 à 20:58 -0800, Gregoire Gentil a écrit :
> Thank you very much for the hint. I don't receive individual devel email
> so I can't reply to your answer on the mailing list :-(
>
> It seems that gltransformation might do the trick for me.

You are right, I had forgotton about this one. Would be nice to add
VideoCropMeta support in that one, and integrated this into the
transformation pipeline. That would allow:

  .. ! videocrop top=100 ! glimagesink

To be gpu cropped.

>
> Are the two following pipelines "equivalent" in terms of CPU and GPU
> usage if nothing is changed in gltransformation?
>
> decodebin ! queue ! glupload ! glcolorconvert ! gltransformation !
> glimagesink
>
> decodebin ! glimagesink
>

glimagesink is a bin that contains multiple elements. The internal
pipeline should be:

  glupload ! glcolorconvert ! glcolorbalance ! glimagesinkelement

Placing gltransformation after glcolorconvert seems to be the correct
approach. Again sorry for having forgotten about this element. I have
CCed the mailing list to share this knowledge.

Nicolas

> Grégoire
>
>
>
> On 2/1/20 1:21 PM, Gregoire Gentil wrote:
> > Hello,
> >
> > I would like to crop the rendering of a video playback in Android which
> > uses glimagesink.
> >
> > I can do the job by inserting a videocrop element before glimagesink but
> > I would like to achieve the same goal by using the "render-rectangle"
> > property of glimagesink - the objective is that the crop operation is
> > done by the GPU, not the CPU. That doesn't work.
> > gst_video_overlay_set_render_rectangle doesn't work either.
> >
> > Am I missing something?
> >
> > Thanks in advance,
> >
> > Grégoire

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel