GstV4l2Src:v4l2src0: Failed to allocate required memory We are using i.MX 8X with analog video via ADV7280A-M MIPI CSI-2 and Yocto Linux Scarthgap and Qt 6.8.2. The following works: gst-launch-1.0 v4l2src device=/dev/video2 ! video/x-raw,width=720,height=567,framerate=25/1 ! autovideosink But the equivalent does not work from Qt (gst_parse_element_make: no element "video"). Therefore am trying: gst-launch-1.0 -vvv v4l2src device=/dev/video2 ! rawvideoparse width=720 height=576 format=yuy2 ! autovideosink However that fails with ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Failed to allocate required memory. The full output is: Setting pipeline to PAUSED ... error: XDG_RUNTIME_DIR is invalid or not set in the environment. error: XDG_RUNTIME_DIR is invalid or not set in the environment. EGL: Warning: No default display support on wayland EGL: Warning: No default display support on wayland Pipeline is live and does not need PREROLL ... /GstPipeline:pipeline0/GstAutoVideoSink:autovideosink0/GstKMSSink:autovideosink0-actual-sink-kms: display-width = 1280 /GstPipeline:pipeline0/GstAutoVideoSink:autovideosink0/GstKMSSink:autovideosink0-actual-sink-kms: display-height = 768 Pipeline is PREROLLED ... Setting pipeline to PLAYING ... New clock: GstSystemClock /GstPipeline:pipeline0/GstV4l2Src:v4l2src0.GstPad:src: caps = video/x-raw, format=(string)YUY2, width=(int)3840, height=(int)2160, framerate=(fraction)120/1, interlace-mode=(string)progressive, colorimetry=(string)1:4:5:1 /GstPipeline:pipeline0/GstRawVideoParse:rawvideoparse0.GstPad:sink: caps = video/x-raw, format=(string)YUY2, width=(int)3840, height=(int)2160, framerate=(fraction)120/1, interlace-mode=(string)progressive, colorimetry=(string)1:4:5:1 ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Failed to allocate required memory. Additional debug info: /usr/src/debug/gstreamer1.0-plugins-good/1.24.0.imx/sys/v4l2/gstv4l2src.c(955): gst_v4l2src_decide_allocation (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Buffer pool activation failed Execution ended after 0:00:00.043197264 Setting pipeline to NULL ... ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error. Additional debug info: /usr/src/debug/gstreamer1.0/1.24.0.imx/libs/gst/base/gstbasesrc.c(3175): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: streaming stopped, reason not-negotiated (-4) Freeing pipeline ... Thank you -- Peter i.MX 8 Family | i.MX 8QuadMax (8QM) | 8QuadPlus Linux Multimedia Re: GstV4l2Src:v4l2src0: Failed to allocate required memory Hi @joanxie, GST_DEBUG=3 gst-launch-1.0 -v v4l2src num-buffers=5 device=/dev/video0 ! video/x-raw,format=GRAY8,depth=8,width=1280,height=800 ! videoconvert ! jpegenc ! multifilesink location=ar0144_mono_image.jpg issue is Starting GStreamer pipeline... Setting pipeline to PAUSED ... Pipeline is live and does not need PREROLL ... Pipeline is PREROLLED ... Setting pipeline to PLAYING ... 0:00:00.244283375 784 0xffffb4000b70 WARN v4l2 gstv4l2object.c:5023:gst_v4l2_object_get_crop_rect: Failed to get default crop rectangle with VIDIOC_G_SELECTION: Invalid argumet 0:00:00.244416875 784 0xffffb4000b70 WARN v4l2 gstv4l2object.c:5230:gst_v4l2_object_probe_caps: Failed to probe pixel aspect ratio with VIDIOC_CROPCAP: Invalid argument New clock: GstSystemClock 0:00:00.246845250 784 0xffffb4000b70 WARN v4l2 gstv4l2object.c:5023:gst_v4l2_object_get_crop_rect: Failed to get default crop rectangle with VIDIOC_G_SELECTION: Invalid argumet /GstPipeline:pipeline0/GstV4l2Src:v4l2src0.GstPad:src: caps = video/x-raw, format=(string)GRAY8, depth=(int)8, width=(int)1280, height=(int)800, framerate=(fraction)120/1, interlace-mode=(string)progressive /GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = video/x-raw, format=(string)GRAY8, depth=(int)8, width=(int)1280, height=(int)800, framerate=(fraction)120/1, interlace-mode=(string)progressie /GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:src: caps = video/x-raw, format=(string)GRAY8, depth=(int)8, width=(int)1280, height=(int)800, framerate=(fraction)120/1, interlace-mode=(string)progre /GstPipeline:pipeline0/GstJpegEnc:jpegenc0.GstPad:sink: caps = video/x-raw, format=(string)GRAY8, depth=(int)8, width=(int)1280, height=(int)800, framerate=(fraction)120/1, interlace-mode=(string)progressive /GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:sink: caps = video/x-raw, format=(string)GRAY8, depth=(int)8, width=(int)1280, height=(int)800, framerate=(fraction)120/1, interlace-mode=(string)proge /GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = video/x-raw, format=(string)GRAY8, depth=(int)8, width=(int)1280, height=(int)800, framerate=(fraction)120/1, interlace-mode=(string)progresse 0:00:00.253795500 784 0xffffb4000b70 WARN v4l2 gstv4l2object.c:5023:gst_v4l2_object_get_crop_rect: Failed to get default crop rectangle with VIDIOC_G_SELECTION: Invalid argumet 0:00:00.253877250 784 0xffffb4000b70 WARN v4l2 gstv4l2object.c:5023:gst_v4l2_object_get_crop_rect: Failed to get default crop rectangle with VIDIOC_G_SELECTION: Invalid argumet 0:00:00.259326750 784 0xffffb4000b70 ERROR v4l2bufferpool gstv4l2bufferpool.c:721:gst_v4l2_buffer_pool_streamon: error with STREAMON 32 (Broken pipe) 0:00:00.259393750 784 0xffffb4000b70 ERROR bufferpool gstbufferpool.c:572:gst_buffer_pool_set_active: start failed 0:00:00.259435250 784 0xffffb4000b70 WARN v4l2src gstv4l2src.c:955:gst_v4l2src_decide_allocation: error: Failed to allocate required memory. 0:00:00.259461750 784 0xffffb4000b70 WARN v4l2src gstv4l2src.c:955:gst_v4l2src_decide_allocation: error: Buffer pool activation failed ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Failed to allocate required memory. Additional debug info: /usr/src/debug/gstreamer1.0-plugins-good/1.24.0.imx/sys/v4l2/gstv4l2src.c(955): gst_v4l2src_decide_allocation (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Buffer pool activation failed 0:00:00.259690375 784 0xffffb4000b70 WARN basesrc gstbasesrc.c:3395:gst_base_src_prepare_allocation: Subclass failed to decide allocation Execution ended after 0:00:00.015445250 Setting pipeline to NULL ... 0:00:00.259771000 784 0xffffb4000b70 WARN basesrc gstbasesrc.c:3175:gst_base_src_loop: error: Internal data stream error. 0:00:00.259796500 784 0xffffb4000b70 WARN basesrc gstbasesrc.c:3175:gst_base_src_loop: error: streaming stopped, reason not-negotiated (-4) ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error. Additional debug info: /usr/src/debug/gstreamer1.0/1.24.0.imx/libs/gst/base/gstbasesrc.c(3175): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: streaming stopped, reason not-negotiated (-4) Freeing pipeline ... GStreamer command finished. Re: GstV4l2Src:v4l2src0: Failed to allocate required memory For completeness, this thread's original issue was solved using capsfilter, rather than rawvideoparse: player.source = "gstreamer-pipeline: v4l2src device=/dev/video2 ! capsfilter caps=video/x-raw,width=720,height=480,framerate=25/1" That does then have an intermittent SIGSEGV in gst_v4l2_object_fill_format_list, when used with Qt, but guess that is another issue. Re: GstV4l2Src:v4l2src0: Failed to allocate required memory Hi @Ahmed230, your message has a very large font size, making it hard to read. This thread is about ADV7280A-M (NTSC/PAL) working ok with: "! video/x-raw...", but not with: "! rawvideoparse..." Your message is about AR0144 image sensor not working with: "! video/x-raw". Different topic. Best to start a new post, and Ctrl+Shift+V to paste just the text, without the large font. Also replace the $NUMBER_OF_PIC, $VID_DEVICE, $FRAME_SIZE with the actual values. Re: GstV4l2Src:v4l2src0: Failed to allocate required memory My issue is with nxp 6.6.36 kernel for camera ar0144 on iMX8MM board to capture image or videos GST_DEBUG=3 gst-launch-1.0 -v v4l2src num-buffers=$NUMBER_OF_PIC device=$VID_DEVICE ! video/x-raw,format=GRAY8,depth=8,$FRAME_SIZE ! videoconvert ! jpegenc ! multifilesink location=ar0144_mono_image.jpg Starting GStreamer pipeline... Setting pipeline to PAUSED ... Pipeline is live and does not need PREROLL ... Pipeline is PREROLLED ... Setting pipeline to PLAYING ... 0:00:00.244283375 784 0xffffb4000b70 WARN v4l2 gstv4l2object.c:5023:gst_v4l2_object_get_crop_rect: Failed to get default crop rectangle with VIDIOC_G_SELECTION: Invalid argumet 0:00:00.244416875 784 0xffffb4000b70 WARN v4l2 gstv4l2object.c:5230:gst_v4l2_object_probe_caps: Failed to probe pixel aspect ratio with VIDIOC_CROPCAP: Invalid argument New clock: GstSystemClock 0:00:00.246845250 784 0xffffb4000b70 WARN v4l2 gstv4l2object.c:5023:gst_v4l2_object_get_crop_rect: Failed to get default crop rectangle with VIDIOC_G_SELECTION: Invalid argumet /GstPipeline:pipeline0/GstV4l2Src:v4l2src0.GstPad:src: caps = video/x-raw, format=(string)GRAY8, depth=(int)8, width=(int)1280, height=(int)800, framerate=(fraction)120/1, interlace-mode=(string)progressive /GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = video/x-raw, format=(string)GRAY8, depth=(int)8, width=(int)1280, height=(int)800, framerate=(fraction)120/1, interlace-mode=(string)progressie /GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:src: caps = video/x-raw, format=(string)GRAY8, depth=(int)8, width=(int)1280, height=(int)800, framerate=(fraction)120/1, interlace-mode=(string)progre /GstPipeline:pipeline0/GstJpegEnc:jpegenc0.GstPad:sink: caps = video/x-raw, format=(string)GRAY8, depth=(int)8, width=(int)1280, height=(int)800, framerate=(fraction)120/1, interlace-mode=(string)progressive /GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:sink: caps = video/x-raw, format=(string)GRAY8, depth=(int)8, width=(int)1280, height=(int)800, framerate=(fraction)120/1, interlace-mode=(string)proge /GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = video/x-raw, format=(string)GRAY8, depth=(int)8, width=(int)1280, height=(int)800, framerate=(fraction)120/1, interlace-mode=(string)progresse 0:00:00.253795500 784 0xffffb4000b70 WARN v4l2 gstv4l2object.c:5023:gst_v4l2_object_get_crop_rect: Failed to get default crop rectangle with VIDIOC_G_SELECTION: Invalid argumet 0:00:00.253877250 784 0xffffb4000b70 WARN v4l2 gstv4l2object.c:5023:gst_v4l2_object_get_crop_rect: Failed to get default crop rectangle with VIDIOC_G_SELECTION: Invalid argumet 0:00:00.259326750 784 0xffffb4000b70 ERROR v4l2bufferpool gstv4l2bufferpool.c:721:gst_v4l2_buffer_pool_streamon: error with STREAMON 32 (Broken pipe) 0:00:00.259393750 784 0xffffb4000b70 ERROR bufferpool gstbufferpool.c:572:gst_buffer_pool_set_active: start failed 0:00:00.259435250 784 0xffffb4000b70 WARN v4l2src gstv4l2src.c:955:gst_v4l2src_decide_allocation: error: Failed to allocate required memory. 0:00:00.259461750 784 0xffffb4000b70 WARN v4l2src gstv4l2src.c:955:gst_v4l2src_decide_allocation: error: Buffer pool activation failed ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Failed to allocate required memory. Additional debug info: /usr/src/debug/gstreamer1.0-plugins-good/1.24.0.imx/sys/v4l2/gstv4l2src.c(955): gst_v4l2src_decide_allocation (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Buffer pool activation failed 0:00:00.259690375 784 0xffffb4000b70 WARN basesrc gstbasesrc.c:3395:gst_base_src_prepare_allocation: Subclass failed to decide allocation Execution ended after 0:00:00.015445250 Setting pipeline to NULL ... 0:00:00.259771000 784 0xffffb4000b70 WARN basesrc gstbasesrc.c:3175:gst_base_src_loop: error: Internal data stream error. 0:00:00.259796500 784 0xffffb4000b70 WARN basesrc gstbasesrc.c:3175:gst_base_src_loop: error: streaming stopped, reason not-negotiated (-4) ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error. Additional debug info: /usr/src/debug/gstreamer1.0/1.24.0.imx/libs/gst/base/gstbasesrc.c(3175): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: streaming stopped, reason not-negotiated (-4) Freeing pipeline ... GStreamer command finished. Re: GstV4l2Src:v4l2src0: Failed to allocate required memory this time, what print error information you get? I compare the bsp 6.6 with bsp 5.10, bsp 6.6 remove the code from 5.10 based this patch , did you try 5.10 bsp?
https://github.com/nxptest/linux-imx/commit/4f87610383a0f365ee0c68d9354ddcf099240144 Re: GstV4l2Src:v4l2src0: Failed to allocate required memory PS @joanxie Re: 0:00:00.518350875 427 0xffff80000b70 WARN v4l2 gstv4l2object.c:5023:gst_v4l2_object_get_crop_rect:v4l2src0:src Failed to get default crop rectangle with VIDIOC_G_SELECTION: Invalid argument this is because mxc_isi_cap_g_selection() is being called with: type 1 V4L2_BUF_TYPE_VIDEO_CAPTURE and target 1 V4L2_SEL_TGT_CROP_DEFAULT (and target 2 V4L2_SEL_TGT_CROP_BOUNDS) but is only expecting type V4L2_BUF_TYPE_VIDEO_OUTPUT or V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE https://github.com/nxp-imx/linux-imx/blob/lf-6.6.y/drivers/staging/media/imx/imx8-isi-cap.c#L1164 Adding handling for those makes the warning go away. (But then mxc_isi_cap_s_fmt_mplane is called and for some reason fmt changes from RGB565 720x480 to YUYV-16 3840x2160 anyway). Re: GstV4l2Src:v4l2src0: Failed to allocate required memory Hi @joanxie We are using Yocto Scarthgap and linux-imx uname shows 6.6.52 We forked from linux-imx after this commit: https://github.com/nxp-imx/linux-imx/commit/e0f9e2afd4cff3f02d71891244b4aa5899dfc786 If I add debug to drivers/staging/media/imx/imx8-mipi-csi2.c mxc_csi2_get_sensor_fmt(), that shows 720 x 480. Therefore am confused why v4l2-ctl --get-fmt-video -d /dev/video2 shows 3840/2160 And wondering whether to implement VIDIOC_G_SELECTION or VIDIOC_CROPCAP somewhere for more consistency. Thank you -- Peter Re: GstV4l2Src:v4l2src0: Failed to allocate required memory what bsp version do you use? it seems the scale issue, that's why I asked you to test specific resolution, otherwise need to upscale to 3840, which would cause error Re: GstV4l2Src:v4l2src0: Failed to allocate required memory Hi @joanxie, thank you for replying. v4l2-ctl -d /dev/v4l-subdev1 --set-standard PAL Using "video/x-raw, width=720, height=480" works with gst-launch-1.0. However the issue is that using video/x-raw in gstreamer-pipeline: in Qt 6.8.2 (QML MediaPlayer) fails: ERROR GST_PIPELINE grammar.y:630:gst_parse_element_make: no element "video" Under Qt (which uses playbin) video/x-raw is not recognised as an element, because it is a caps filter. That is why I was trying to get a pipeline working without needing the video/x-raw caps filter in it... Ok, just found that there is a capsfilter element, so using that explicitly instead: player.source = "gstreamer-pipeline: v4l2src device=/dev/video2 ! capsfilter caps=video/x-raw,width=720,height=480,framerate=25/1" That almost works from Qt. Shows video for a bit but then segfaults with: 1 format_cmp_func gstv4l2object.c 1276 0xffffd80668dc 2 g_slist_insert_sorted_real gslist.c 913 0xfffff604fab4 3 g_slist_insert_sorted gslist.c 964 0xfffff60504e0 4 gst_v4l2_object_fill_format_list gstv4l2object.c 1324 0xffffd8065a60 5 gst_v4l2_object_get_format_list gstv4l2object.c 1373 0xffffd8065f2c 6 gst_v4l2_object_probe_caps gstv4l2object.c 5212 0xffffd806ed34 7 gst_v4l2_object_get_caps gstv4l2object.c 5310 0xffffd806ef38 8 gst_base_src_default_query gstbasesrc.c 1373 0xffffd9219490 9 gst_pad_query gstpad.c 4228 0xffffd90ec24c 10 gst_pad_query_caps gstutils.c 3117 0xffffd913140c 11 gst_v4l2src_negotiate gstv4l2src.c 786 0xffffd8079a04 12 gst_base_src_negotiate_unlocked gstbasesrc.c 3490 0xffffd9213e9c 13 gst_base_src_loop gstbasesrc.c 2915 0xffffd9215e7c 14 gst_task_func gsttask.c 399 0xffffd9122090 15 g_thread_pool_thread_proxy gthreadpool.c 350 0xfffff605d780 16 g_thread_proxy gthread.c 831 0xfffff605cad8 17 start_thread pthread_create.c 447 0xfffff6730fc4 18 thread_start clone3.S 76 0xfffff67931cc Will see what I can figure out. Either way, am wondering: v4l2-ctl --device /dev/video2 --all gives mxc-isi-cap_v1 Width/Height: 3840/2160 ... Guess because even though the ADV is only capable of 720 wide, the MIPI CSI-2 is capable of 3840. This changes it, but only temporarily: v4l2-ctl -d /dev/video2 -vwidth=720,height=480 It reverts back to 3840 when gstreamer is run without the capsfilter. Seeing as on our i.MX 8X based board, the MIPI CSI-2 is hard wired to the ADV, and will only ever be used as 720 wide, is there any way of configuring it to stay at 720 wide, rather than 3840 wide? That would make it "just work" and simplify the gstreamer pipeline for Qt etc? Thank you -- Peter Re: GstV4l2Src:v4l2src0: Failed to allocate required memory what format do you set for the ADV7280, how about set the specific resolution in the pipeline? for example, video/x-raw, width=720, height=480, it seems the issue related to the crop, you can try to set the resolution and test again Re: GstV4l2Src:v4l2src0: Failed to allocate required memory https://github.com/GStreamer/gst-plugins-good/blob/master/sys/v4l2/gstv4l2bufferpool.c#L668 if (obj- >ioctl (pool- >video_fd, VIDIOC_STREAMON, &obj- >type) < 0) goto streamon_failed;
查看全文