VIM3 cameras inquiry

This writes file. I don’t need this. And i can’t actually analyze the fps of file’s content. Looks not good at all for me. But anyway… My task is to get images for processing in opencv.
The following pipeline

"v4l2src device=/dev/video50 ! video/x-raw,format=RGB,width=1920,height=1080,framerate=30/1 ! appsink" 

gives me an error

0:00:00.096619859  6626   0x55bbaf4d20 WARN                 basesrc gstbasesrc.c:3127:gst_base_src_loop:<v4l2src0> error: Internal data stream error.
0:00:00.096653859  6626   0x55bbaf4d20 WARN                 basesrc gstbasesrc.c:3127:gst_base_src_loop:<v4l2src0> error: streaming stopped, reason not-negotiated (-4)
0:00:00.096698109  6626   0x55bbaf4d20 INFO        GST_ERROR_SYSTEM gstelement.c:2271:gst_element_message_full_with_details:<v4l2src0> posting message: Internal data stream error.
0:00:00.096764734  6626   0x55bbaf4d20 INFO        GST_ERROR_SYSTEM gstelement.c:2298:gst_element_message_full_with_details:<v4l2src0> posted error message: Internal data stream error.
[ WARN:0] global ./modules/videoio/src/cap_gstreamer.cpp (2075) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module v4l2src0 reported: Internal data stream error.

as well as following command:

$ gst-launch-1.0 v4l2src device=/dev/video50 io-mode=mmap ! video/x-raw,format=RGB,width=1920,height=1080,framerate=30/1 ! autovideosink`

gives error as well. Of different type, though…

0:00:00.920992970  6694   0x5596450860 INFO          v4l2bufferpool gstv4l2bufferpool.c:610:gst_v4l2_buffer_pool_set_config:<v4l2src0:pool0:src> can't allocate, setting maximum to minimum
0:00:01.064958030  6694   0x5596450860 INFO               GST_EVENT gstevent.c:972:gst_event_new_segment: creating segment event time segment start=0:00:00.000000000, offset=0:00:00.000000000, stop=99:99:99.999999999, rate=1.000000, applied_rate=1.000000, flags=0x00, time=0:00:00.000000000, base=0:00:00.000000000, position 0:00:00.000000000, duration 99:99:99.999999999
0:00:01.065131238  6694   0x5596450860 INFO                 basesrc gstbasesrc.c:3018:gst_base_src_loop:<v4l2src0> marking pending DISCONT
0:00:01.065175947  6694   0x5596450860 INFO         GST_PERFORMANCE gstkmssink.c:1552:gst_kms_sink_get_input_buffer:<autovideosink0-actual-sink-kms> frame copy
0:00:01.095471457  6694   0x5596450860 WARN                 kmssink gstkmssink.c:1713:gst_kms_sink_show_frame:<autovideosink0-actual-sink-kms> error: drmModeSetPlane failed: Permission denied (13)
0:00:01.095588790  6694   0x5596450860 INFO        GST_ERROR_SYSTEM gstelement.c:2271:gst_element_message_full_with_details:<autovideosink0-actual-sink-kms> posting message: GStreamer encountered a general resource error.
ERROR: from element /GstPipeline:pipeline0/GstAutoVideoSink:autovideosink0/GstKMSSink:autovideosink0-actual-sink-kms: GStreamer encountered a general resource error.
Additional debug info:
../sys/kms/gstkmssink.c(1713): gst_kms_sink_show_frame (): /GstPipeline:pipeline0/GstAutoVideoSink:autovideosink0/GstKMSSink:autovideosink0-actual-sink-kms:
drmModeSetPlane failed: Permission denied (13)
0:00:01.095763373  6694   0x5596450860 INFO        GST_ERROR_SYSTEM gstelement.c:2298:gst_element_message_full_with_details:<autovideosink0-actual-sink-kms> posted error message: GStreamer encountered a general resource error.
Execution ended after 0:00:00.176480901
Setting pipeline to NULL ...
0:00:01.095800957  6694   0x5596450860 INFO              GST_STATES gstelement.c:2678:gst_element_abort_state:<autovideosink0-actual-sink-kms> aborting state from READY to PAUSED
0:00:01.095836082  6694   0x5596450860 INFO                 basesrc gstbasesrc.c:3037:gst_base_src_loop:<v4l2src0> pausing after gst_pad_push() = error
0:00:01.095842665  6694   0x55961cd400 INFO              GST_STATES gstbin.c:2479:gst_bin_element_set_state:<autovideosink0> current READY pending PAUSED, desired next READY
0:00:01.095864832  6694   0x5596450860 WARN                 basesrc gstbasesrc.c:3127:gst_base_src_loop:<v4l2src0> error: Internal data stream error.
0:00:01.095876123  6694   0x55961cd400 INFO              GST_STATES gstbin.c:2479:gst_bin_element_set_state:<autovideosink0-actual-sink-kms> current READY pending PAUSED, desired next READY
0:00:01.095919207  6694   0x55961cd400 INFO              GST_STATES gstelement.c:2806:gst_element_continue_state:<autovideosink0-actual-sink-kms> completed state change to READY
0:00:01.095881290  6694   0x5596450860 WARN                 basesrc gstbasesrc.c:3127:gst_base_src_loop:<v4l2src0> error: streaming stopped, reason error (-5)
0:00:01.095941873  6694   0x55961cd400 INFO              GST_STATES gstbin.c:2928:gst_bin_change_state_func:<autovideosink0> child 'autovideosink0-actual-sink-kms' changed state to 2(READY) successfully
0:00:01.095961748  6694   0x5596450860 INFO        GST_ERROR_SYSTEM gstelement.c:2271:gst_element_message_full_with_details:<v4l2src0> posting message: Internal data stream error.

So what pipeline should i use to get uncompressed image for opencv processing?

Come on, Guys! Let finish this up. I need to test the whole system already. What do you think about the issue?

@Alex999
The following two are both running normally

import cv2
import time

capture = f"v4l2src device=/dev/video50 ! video/x-raw,format=RGB,width=1920,height=1080,framerate=60/1 ! videoconvert ! appsink"
cap = cv2.VideoCapture(capture, cv2.CAP_GSTREAMER)
if cap.isOpened():
    while True:
        start_time = time.time()
        ret, frame = cap.read()
        end_time = time.time()
        print(end_time - start_time)
        if ret:
            if frame is None:
                    print("frame is None")
            else:
                    cv2.imwrite("frame.jpg", frame)
        else:
            print("RET is None")

    cap.release()
else:
    print("Error opening cap")
$ gst-launch-1.0 v4l2src device=/dev/video50 io-mode=mmap ! video/x-raw,format=RGB,width=1920,height=1080,framerate=30/1 ! autovideosink`

How is this implemented? I want to test it out

I’m sorry I didnt get back to you in time

FPSCounter doesn’t matter. I’ve changed your code to

    start_time = time.time()
    frame_count = 0
    while True:
        ret, frame = cap.read()
        if ret:
            if frame is None:
                    print("frame is None")
            else:
                    cv2.imwrite("frame.jpg", frame)
        else:
            print("RET is None")
        end_time = time.time()
        frame_count = frame_count + 1
        print(frame_count/(end_time - start_time))

and got 30fps RGB. Looks like final videoconvert was the missing peace in a pipeline.
However

gst-launch-1.0 v4l2src device=/dev/video50 io-mode=mmap ! video/x-raw,format=RGB,width=1920,height=1080,framerate=30/1 ! autovideosink`

still gives me the same error from above…

Anyway, i finally managed to test the whole solution: camera gives 30fps rgb, and our processing doesn’t introduce any delay in it. This is good news.

I still have one issue with amlvenc plugin for gstreamer: i can’t tune it for my needs. Are there any param spec for this? or link to documentation? Should i start a separate topic for this issue?

Please get more parameters with command gst-inspect-1.0 amlvenc.