How to crop video on Android/Gstreamer with glimagesink

Nicolas Dufresne nicolas at ndufresne.ca
Sun Feb 2 14:28:47 UTC 2020


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



More information about the gstreamer-devel mailing list