Hi,
I have an imx8qm dev kit with the ov5640 mipi camera. I've only been able to encode using the v4l2h264enc plugin when using the default source video format NV12.
I've tried both with imx-5.4.24-2.1.0 (gstreamer 1.16.1 and imx-gst1.0-plugin 4.5.5) and with imx-5.4.47-2.2.0 (gstreamer 1.16.2 and imx-gst1.0-plugin 4.5.6).
This works:
gst-launch-1.0 -e v4l2src device=/dev/video1 ! video/x-raw,width=1920,height=1080,framerate=30/1 ! v4l2h264enc ! filesink location=/tmp/working/csi0.mp4
But if I specify any other format such as YUY2 with imxvideoconvert_g2d it doesn't work:
v4l2src device=/dev/video1 ! video/x-raw,width=1920,height=1080,framerate=30/1,format=YUY2 ! imxvideoconvert_g2d ! v4l2h264enc ! filesink location=/tmp/working/csi0.mp4
It prints below error:
basetransform gstbasetransform.c:1362:gst_base_transform_setcaps:<imxvideoconvert_g2d0> transform could not transform video/x-raw, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, format=(string)YUY2, interlace-mode=(string)progressive, colorimetry=(string)bt709 in anything we support
Similar error occurs when trying any of the formats that are returned as supported for the camera (gstreamer-device-monitor-1.0, v4l2-ctl -d /dev/video1 --list-formats-ex). These include YUY2, BRGA, BGRx, BRG, RGB, NV12, RGB16.
Note that if I specify YUY2 and send to the display instead of the encoder, it does work:
gst-launch-1.0 -e v4l2src device=/dev/video1 ! video/x-raw,width=1920,height=1080,framerate=30/1,format=YUY2 ! imxvideoconvert_g2d ! waylandsink
Should the HW accelerated imxvideoconvert_g2d allow converting to NV12 given the sink/source capabilities shown by gst-inspect-1.0 are:
Pad Templates:
SINK template: 'sink'
Availability: Always
Capabilities:
video/x-raw
format: { (string)RGB16, (string)RGBx, (string)RGBA, (string)BGRA, (string)BGRx, (string)BGR16, (string)ARGB, (string)ABGR, (string)xRGB, (string)xBGR, (string)UYVY, (string)YUY2, (string)I420, (string)NV12_10LE, (string
)YV12, (string)NV16, (string)NV21, (string)NV12 }
video/x-raw(memory:SystemMemory, meta:GstVideoOverlayComposition)
format: { (string)RGB16, (string)RGBx, (string)RGBA, (string)BGRA, (string)BGRx, (string)BGR16, (string)ARGB, (string)ABGR, (string)xRGB, (string)xBGR, (string)UYVY, (string)YUY2, (string)I420, (string)NV12_10LE, (string
)YV12, (string)NV16, (string)NV21, (string)NV12 }
SRC template: 'src'
Availability: Always
Capabilities:
video/x-raw
format: { (string)RGB16, (string)RGBx, (string)RGBA, (string)BGRA, (string)BGRx, (string)BGR16, (string)ARGB, (string)ABGR, (string)xRGB, (string)xBGR, (string)UYVY, (string)YUY2, (string)NV12 }
video/x-raw(memory:SystemMemory, meta:GstVideoOverlayComposition)
format: { (string)RGB16, (string)RGBx, (string)RGBA, (string)BGRA, (string)BGRx, (string)BGR16, (string)ARGB, (string)ABGR, (string)xRGB, (string)xBGR, (string)UYVY, (string)YUY2, (string)NV12 }
Thanks,
Daryl
Hi dnebrich
for supported formats one can look at unit test
Also may be useful :
i.MX VPU API Reference Manual
sect.6.7 Video Processing Unit (VPU), sect.10.5.3 Video Processing Unit (VPU)
Best regards
igor