Skip to content

v4l2src add image source crop support

Add source cropping options to the v4l2src element. This allows for using the hardware to crop the camera / sensor / image data in hardware before the buffers are received by GStreamer. On V4L2 devices that support scaling, this also allows the crop to be performed before the buffers are scaled and composed to match the negotiated Gstreamer buffer size.

This MR is a reimplementation of !503, which is now out of date and causes merge conflicts with the main branch.

Steps to test with vivid driver.

Use the HDMI input type capture device (default webcam device does not support crop / selection API)

modprobe vivid n_devs=1 input_types=0x3

Set checkerboard pattern on vivid (just to help visualize top/bottom crops)

v4l2-ctl -d /dev/videoX -c test_pattern=10

Set crop values on v4l2src

gst-launch-1.0 v4l2src device=/dev/videoX crop-left=100 ! ximagesink

Merge request reports

Loading