Hi avaf, thank you so much for your response!
Try to use NV12 instead of BGR, and see if you can set it to capture NV12, i think if the device > 1080p it would be possible
When I try using NV12 (or NV16 or NV24 with ! videoconvert
) I get this error:
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Device '/dev/video0' has no supported format Additional debug info: ../sys/v4l2/gstv4l2object.c(3994): gst_v4l2_object_set_format_full (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Call to TRY_FMT failed for NV12 @ 3840x2160: Invalid argument
Full output below [0]. I believe this is because the input is BGR. Full timing info below [1]. This is what the camera sends if my EDID is 4k-300mhz or 4k-600mhz; if I set the EDID to 4k-170mhz the camera will simply refuse to send 4k at all (the 4k HDMI option in menu is greyed out). So AFAICT v4l2 won’t let me use NV12 unless the input is NV12, and the camera only seems to want to send BGR.
I also tried putting videoconvert ! video/x-raw,format=NV12 !
between the capture and encoding, but this only produced a few frames in the 30 seconds I let it run.
Output the image to video without the encoding process and see if it is smooth
I assume you mean to the screen (since the raw data is ~8gbps and far exceeds the write capabilities of any available media) - I’ve tried that with ximagesink
, xvimagesinx
, and glimagesink
.
I’m using the Debian image, and the former two create windows that are visible on the task bar and that draw large but empty frames; no video is visible. The latter - glimagesink
- was giving an error about a missing library, but now (after updating last night) gives:
arm_release_ver of this libmali is 'g6p0-01eac0', rk_so_ver is '5'. ERROR: from element /GstPipeline:pipeline0/GstGLImageSinkBin:glimagesinkbin0/GstGLImageSink:sink: Failed to bind OpenGL API: EGL_BAD_PARAMETER Additional debug info: ../ext/gl/gstglimagesink.c(1095): _ensure_gl_setup (): /GstPipeline:pipeline0/GstGLImageSinkBin:glimagesinkbin0/GstGLImageSink:sink
I can try to run this new error down.
Add io-mode=dmabuf
The issue still occurs with io-mode=dmabuf. io-mode 2 and 4 work (1, 3, and 5 result in ‘not negotiated’) but both show the issue.
Thanks again for your help! Let me know if you have any other ideas, otherwise I’ll see if I can get glimagesink
working when I find some free time.
[0] Full output of Gstreamer with NV12
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Device '/dev/video0' has no supported format
Additional debug info:
../sys/v4l2/gstv4l2object.c(3994): gst_v4l2_object_set_format_full (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
Call to TRY_FMT failed for NV12 @ 3840x2160: Invalid argument
Execution ended after 0:00:00.001284167
Setting pipeline to NULL ...
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error.
Additional debug info:
../libs/gst/base/gstbasesrc.c(3127): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming stopped, reason not-negotiated (-4)
Freeing pipeline ...
[1] Full timing info
#! /bin/bash
v4l2-ctl -d /dev/video0 --get-fmt-video
v4l2-ctl -d /dev/video0 --get-dv-timings
rock@rock-5b:~$ ./check_hdmi.sh
Format Video Capture Multiplanar:
Width/Height : 3840/2160
Pixel Format : 'BGR3' (24-bit BGR 8-8-8)
Field : None
Number of planes : 1
Flags : premultiplied-alpha, 0x000000fe
Colorspace : Unknown (0x433dab80)
Transfer Function : Default
YCbCr/HSV Encoding: Unknown (0x000000ff)
Quantization : Default
Plane 0 :
Bytes per Line : 11520
Size Image : 24883200
DV timings:
Active width: 3840
Active height: 2160
Total width: 4400
Total height: 2250
Frame format: progressive
Polarities: -vsync -hsync
Pixelclock: 296696000 Hz (29.97 frames per second)
Horizontal frontporch: 176
Horizontal sync: 88
Horizontal backporch: 296
Vertical frontporch: 8
Vertical sync: 10
Vertical backporch: 72
Standards:
Flags: