Issue with GStreamer Setup for Camera Capture on Jetson Nano 2GB with YOLO Real-Time Inference

Hello NVIDIA Community,

I’m currently working on a project using my NVIDIA Jetson Nano 2GB board and a Raspberry Pi Camera Module V2 to perform real-time object detection using YOLO. I’ve been able to successfully use YOLOv8 for object detection on a static image, but I’ve encountered an issue when trying to use it with a live camera feed.

System Details:

  • Jetson Nano 2GB (Running JetPack 4.6.2)
  • Raspberry Pi Camera Module V2
  • Python Version: 3.11.2 (installed within a virtual environment)
  • Ultralytics YOLO Version: 8.3.111
  • Torch Version: 2.5.1
  • OpenCV Version: 4.7.0
  • GStreamer Version: Installed from system packages (via apt-get)

The Problem:

I am trying to capture video from the camera in real-time and run object detection on the video feed using the YOLOv8 model. For camera capture, I am using GStreamer pipelines, but I am facing issues with GStreamer not being able to open the camera stream through OpenCV’s cv2.VideoCapture().

The Code:

The Issue:

When running the code, I encounter the following error:

Error: Unable to open camera

### Troubleshooting Steps Taken:

1. **Camera Test**: I confirmed that the camera is working perfectly by testing it using commands such as:
  * `nvgstcapture-1.0`
  * `gst-launch-1.0 nvarguscamerasrc ! nvoverlaysink`
  * `gst-launch-1.0 nvarguscamerasrc ! videoconvert ! autovideosink`
These commands work fine, and the camera produces a video feed.
2. **GStreamer Version**: I’ve verified the installed GStreamer version using:

gst-launch-1.0 --version


The version is 1.14.5

4. **OpenCV with GStreamer**: I've tested using OpenCV with the GStreamer pipeline, but I still get the error `Unable to open camera`.

### My Setup:

* **Jetson Nano 2GB** with JetPack 4.6
* **Raspberry Pi Camera Module V2** connected via the CSI interface.
* **GStreamer** installed
* **OpenCV** version: 4.11
* **YOLOv8** model for object detection.

### Questions:

1. Has anyone encountered a similar issue with using GStreamer for camera capture on the Jetson Nano? What could be causing the `Unable to open camera` error?
2. Are there any other approaches or libraries I can use for capturing video from the camera on Jetson Nano (besides GStreamer)?
3. Is there any configuration or setup step I may have missed regarding GStreamer or OpenCV for real-time video capture on Jetson Nano?

I would appreciate any help or suggestions to resolve this issue. Thank you in advance!

Best regards,
Anis

There is no update from you for a period, assuming this is not an issue anymore.
Hence, we are closing this topic. If need further support, please open a new one.
Thanks
~0521

Hi,

Sorry for the late update.
Have you found a way to solve your issue already?

Thanks.