Nvarguscamerasrc not working (URGENT)

System: Jetson Nano B01
Camera: IMX219

Code:

// simple_camera.cpp
// MIT License
// Copyright (c) 2019-2022 JetsonHacks
// See LICENSE for OpenCV license and additional information
// Using a CSI camera (such as the Raspberry Pi Version 2) connected to a 
// NVIDIA Jetson Nano Developer Kit using OpenCV
// Drivers for the camera and OpenCV are included in the base image

#include <opencv2/opencv.hpp>
#include <iostream>

using namespace cv;
using namespace std;

string gstreamer_pipeline (int capture_width, int capture_height, int display_width, int display_height, int framerate, int flip_method) {
    
    return "nvarguscamerasrc ! video/x-raw(memory:NVMM), width=(int)" + std::to_string(capture_width) + ", height=(int)" +
           std::to_string(capture_height) + ", framerate=(fraction)" + std::to_string(framerate) +
           "/1 ! nvvidconv flip-method=" + std::to_string(flip_method) + " ! video/x-raw, width=(int)" + std::to_string(display_width) + ", height=(int)" +
           std::to_string(display_height) + ", format=(string)BGRx ! videoconvert ! video/x-raw, format=(string)BGR ! appsink";
    
}

int main()
{
    int capture_width = 1640 ;
    int capture_height = 1232 ;
    int display_width = 820 ;
    int display_height = 616 ;
    int framerate = 30 ;
    int flip_method = 0 ;

    std::string pipeline = gstreamer_pipeline(capture_width,
	capture_height,
	display_width,
	display_height,
	framerate,
	flip_method);
    std::cout << "Using pipeline: \n\t" << pipeline << "\n";
 
    cv::VideoCapture cap(pipeline, cv::CAP_GSTREAMER);

    if(!cap.isOpened()) {
	std::cout<<"Failed to open camera."<<std::endl;
	return (-1);
    }

    cv::namedWindow("CSI Camera", WINDOW_FREERATIO);
    cv::Mat img;

    while(true)
    {
    	if (!cap.read(img)) {
		std::cout<<"Capture read error"<<std::endl;
		break;
	    }
	
	    cv::imshow("CSI Camera",img);
	    int keycode = cv::waitKey(10) & 0xff ; 
        if (keycode == 'k') break ;
    }

    cap.release();
    cv::destroyAllWindows() ;
    return 0;
}


Error Report:

Using pipeline: 
        nvarguscamerasrc ! video/x-raw(memory:NVMM), width=(int)1640, height=(int)1232, framerate=(fraction)30/1 ! nvvidconv flip-method=0 ! video/x-raw, width=(int)820, height=(int)616, format=(string)BGRx ! videoconvert ! video/x-raw, format=(string)BGR ! appsink
[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (711) open OpenCV | GStreamer warning: Error opening bin: no element "nvarguscamerasrc"
[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
Failed to open camera.

Blacklisted Files:

Blacklisted files:
  libgstnvjpeg.so
  libgstnvarguscamerasrc.so

Total count: 2 blacklisted files

Please provide solutions within a few hours/days. I am within an upcoming deadline and there are no room for scheduling a response later.

Thank you.

Also, the system showed that Nvargus failed to load while the system was shutting off.

Hello @altamimisajad0

I would like to do some debugging first.

Could you please check if you see any message by filtering by imx219?

sudo dmesg | grep -i imx219

If you run the following command, do you see a video device like /dev/video0?

ls /dev/video*

Regards!
Eduardo Salazar
Embedded SW Engineer at RidgeRun

Contact us: support@ridgerun.com
Developers wiki: https://developer.ridgerun.com/
Website: www.ridgerun.com

I do not think that there is a problem with the camera as the errors and blacklisting suggesting it may be a Nvargus issue but I will go through with these commands once I am able to get back to the Jetson I am currently developing.

Here is what I currently am getting with those 2 commands:

jetson@ubuntu:~$ sudo dmesg | grep -i imx219
[sudo] password for jetson: 
[    1.345122] imx219 7-0010: tegracam sensor driver:imx219_v2.0.6
[    1.369961] imx219 8-0010: tegracam sensor driver:imx219_v2.0.6
[    1.393309] imx219 8-0010: imx219_board_setup: error during i2c read probe (-121)
[    1.393376] imx219 8-0010: board setup failed
[    1.393426] imx219: probe of 8-0010 failed with error -121
[    1.549913] vi 54080000.vi: subdev imx219 7-0010 bound
jetson@ubuntu:~$ ls /dev/video*
/dev/video0
jetson@ubuntu:~$ 

Hello @altamimisajad0

I just want to confirm that you can dequeue buffers from the sensor before continuing to debug the GStreamer issue.

Could you please run the following commands?

 sudo apt install v4l-utils

and then

v4l2-ctl --set-fmt-video=width=1920,height=1080,pixelformat=RG10 --stream-mmap --stream-count=300 -d /dev/video0

This command will start streaming from camera port 0 (cam0). If you want to check the camera port 1 (cam1), change the video device to video1. After running the command you must see the next output in your terminal window:

<<<<<<<<<<<<<<<<<<<<<<< 21.19 fps
<<<<<<<<<<<<<<<<<<<<< 21.19 fps
<<<<<<<<<<<<<<<<<<<<< 21.19 fps

If the above command works, please run the following commands:

Remove the GStreamer registry:

rm -rf ~/.cache/gstreamer-1.0/registry.x86_64.bin

I try the following standalone simple pipeline as:

GST_DEBUG=2 gst-launch-1.0 nvarguscamerasrc ! nvvidconv ! fakesink silent=false -v

If the pipeline works, you should see messages in the terminal similar to (I actually have a Orin Nano devkit with an IMX219 connected locally):

/GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = chain   ******* (fakesink0:sink) (64 bytes, dts: 0:00:01.199904278, pts: 0:00:01.199904278, duration: none, offset: -1, offset_end: -1, flags: 00000000 , meta: none) 0xaaaae722a6c0

If not, please attach the output of the GStreamer pipeline here.

Regards!

I am still getting an error, nvarguscamerasrc is still not connected. Here is the output of all the actions done as you said.

jetson@ubuntu:~$ v4l2-ctl --set-fmt-video=width=1920,height=1080,pixelformat=RG10 --stream-mmap --stream-count=300 -d /dev/video0
<<<<<<<<<<<<<<<<<<<<<<< 21.35 fps
<<<<<<<<<<<<<<<<<<<<< 21.28 fps
<<<<<<<<<<<<<<<<<<<<< 21.26 fps
<<<<<<<<<<<<<<<<<<<<< 21.19 fps
<<<<<<<<<<<<<<<<<<<<< 21.20 fps
<<<<<<<<<<<<<<<<<<<<<< 21.19 fps
<<<<<<<<<<<<<<<<<<<<< 21.19 fps
<<<<<<<<<<<<<<<<<<<<< 21.19 fps
<<<<<<<<<<<<<<<<<<<<< 21.19 fps
<<<<<<<<<<<<<<<<<<<<< 21.20 fps
<<<<<<<<<<<<<<<<<<<<<< 21.19 fps
<<<<<<<<<<<<<<<<<<<<< 21.19 fps
<<<<<<<<<<<<<<<<<<<<< 21.19 fps
<<<<<<<<<<<<<<<<<<<<< 21.19 fps
<<
jetson@ubuntu:~$ rm -rf ~/.cache/gstreamer-1.0/registry.x86_64.bin
jetson@ubuntu:~$ GST_DEBUG=2 gst-launch-1.0 nvarguscamerasrc ! nvvidconv ! fakesink silent=false -v
0:00:00.059898427  7893   0x5588886010 WARN     GST_ELEMENT_FACTORY gstelementfactory.c:456:gst_element_factory_make: no such element factory "nvarguscamerasrc"!
0:00:00.059973981  7893   0x5588886010 ERROR           GST_PIPELINE grammar.y:816:priv_gst_parse_yyparse: no element "nvarguscamerasrc"
0:00:00.227233224  7893   0x5588886010 ERROR           GST_PIPELINE grammar.y:901:priv_gst_parse_yyparse: link has no source [sink=@0x55886fa460]
WARNING: erroneous pipeline: no element "nvarguscamerasrc"

Also look at my other post regarding how those files are blacklisted for more information, thanks.

Check by gst-inspect-1.0 for the nvarguscamerasrc like below.
If there’s this element you may need to flash the device by sdkmanager to try.

nvidia@tegra-ubuntu:~$ gst-inspect-1.0 nvarguscamerasrc
Factory Details:
  Rank                     primary (256)
  Long-name                NvArgusCameraSrc
  Klass                    Video/Capture
  Description              nVidia ARGUS Camera Source
  Author                   Viranjan Pagar <vpagar@nvidia.com>, Amit Pandya <apandya@nvidia.com>

Plugin Details:
  Name                     nvarguscamerasrc
  Description              nVidia ARGUS Source Component
  Filename                 /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvarguscamerasrc.so
  Version                  1.0.0
  License                  Proprietary
  Source module            nvarguscamerasrc
  Binary package           NvARGUSCameraSrc
  Origin URL               http://nvidia.com/

GObject
 +----GInitiallyUnowned
       +----GstObject
             +----GstElement
                   +----GstBaseSrc
                         +----GstNvArgusCameraSrc

Pad Templates:
  SRC template: 'src'
    Availability: Always
    Capabilities:
      video/x-raw(memory:NVMM)
                  width: [ 1, 2147483647 ]
                 height: [ 1, 2147483647 ]
                 format: { (string)NV12 }
              framerate: [ 0/1, 2147483647/1 ]

Element has no clocking capabilities.
Element has no URI handling capabilities.

No such element is found.

jetson@ubuntu:~$ gst-inspect-1.0 nvarguscamerasrc
No such element or plugin 'nvarguscamerasrc'

The libgst file for nvarguscamerasrc also seems to be blacklisted.

jetson@ubuntu:~$ gst-inspect-1.0 -b
Blacklisted files:
  libgstnvjpeg.so
  libgstnvarguscamerasrc.so

Total count: 2 blacklisted files

Looks like your system image lost lots of things.
You may try to flash by sdkmanager.

please try running $ sudo apt-get install nvidia-l4t-gstreamer to install nvarguscamerasrc plugin,
you may also install MMAPI with… $ sudo apt install nvidia-l4t-jetson-multimedia-api

1 Like

I might do a reinstallation iteration of that command since I have all of the other files and I don’t need duplicates.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.