Gstreamer-1.0 video crop

I have question regarding nvvidconv, which is similar to your answer to https://devtalk.nvidia.com/default/topic/999178/jetson-tx1/cropping-image-using-nvvidconv/

I am trying to run the following command for saving a video stream from an IMX290 sensors having fish-eye lens attached to it (cropping is necessary to cut out black pixels on the sides:

$ sudo gst-launch-1.0 -v nvcamerasrc sensor-id=0 ! ‘video/x-raw(memory:NVMM),width=1948, height=1096, framerate=60/1, format=NV12’ ! nvvidconv top=0 bottom=0 left=100 right=100 ! ‘video/x-raw(memory:NVMM), width=1748, height=1096, format=I420’ ! omxh265enc control-rate=2 bitrate=16000000 ! ‘video/x-h265, stream-format=(string)byte-stream’ ! h265parse ! matroskamux ! filesink sync=true location=/home/nvidia/Documents/Stream0.mp4

This returns the following error message:

ERROR: from element /GstPipeline:pipeline0/GstNvCameraSrc:nvcamerasrc0: Internal data flow error.
Additional debug info:
gstbasesrc.c(2948): gst_base_src_loop (): /GstPipeline:pipeline0/GstNvCameraSrc:nvcamerasrc0:
streaming task paused, reason error (-5)
Execution ended after 0:00:00.253411556
Setting pipeline to PAUSED …
/GstPipeline:pipeline0/GstMatroskaMux:matroskamux0.GstPad:src: caps = video/x-matroska
/GstPipeline:pipeline0/GstFileSink:filesink0.GstPad:sink: caps = video/x-matroska

Why does this not work?

Does nvvidvonc only accept parameters that yield a cropped video having a standard display resolution format (1920x1080, 640x480,…etc.)? Does the aspect-ratio have to be kept?

If you could provide me a command for cutting approximately 100-100 left pixels on the left and right I would be delighted. No problem if you have to cut a little from top-bottom.

1 Like

The information displayed with gst-inspect is a bit confusing. These properties are not the number of pixels margins to be cropped out, but rather the starting and ending coordinates in the original image.

So you may try instead:

gst-launch-1.0 -v nvcamerasrc ! 'video/x-raw(memory:NVMM),width=1948, height=1096, framerate=60/1, format=NV12' ! nvvidconv top=0 bottom=1095 left=100 right=1847 ! 'video/x-raw(memory:NVMM),width=1748, height=1096, framerate=60/1, format=NV12' ! omxh265enc ...
2 Likes

Thank you for your help.