Digital zoom using GStreamer pipeline


How can I properly zoom the video using GStreamer ? I saw nvvidconv has parameters for cropping. I think the values are right for the 16:9 aspect ratio but the output result is sort of stretched.
How can I improve my result ? Is there any better method I can use for digitally zooming in the camera stream?

gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw,format=YUY2,width=1920,height=1080,framerate=30/1' ! nvvidconv top=640 left=360 right=1280 bottom=720 ! nv3dsink

The nvvidconv plugin works in fixed setting and cannot be changed dynamically. For changing the setting, need to destroy the pipeline and re-start it. This is not a working solution for the usecase. You may check if the v4l2 source supports extra controls of digital zoom. If yes, you may set the property in v4l2src for a try:

  extra-controls      : Extra v4l2 controls (CIDs) for the device
                        flags: readable, writable
                        Boxed pointer of type "GstStructure"

write an app to use gst_parse_launch get a pipeline, and then you can get the nvvidconv filter and change top, bottom, right, left in the app.