Using CSI camera as a webcam, by sinking IMX 477 camera streams to linux video node

Hello,
I am working on a project with the following setup:
Jetson Nano 4GB
IMX 477 CSI Camera

I have a web application which I have to host on the jetson nano. The web application uses webRTC for capturing video feed from webcam. The CSI camera is not supported for the same.

So, I tried to enable v4l2loopback to sink the IMX 477 camera streams to a linux video node(/dev/video5), as recommended by the link - https://forums.developer.nvidia.com/t/csi-camera-not-seen-by-browser/167742

Then, I build v4l2loopback and created a v4l2loopback device at dev/video5.

Using nvarguscamerasrc, gstreamer is able to sink the output to autovideosink - gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=1920, height=1080, format=NV12, framerate=30/1' ! nvvidconv ! 'video/x-raw, format=I420' ! autovidesink

However, when I am trying to link the nvvidconv element to v4l2 sink - gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=1920, height=1080, format=NV12, framerate=30/1' ! nvvidconv ! 'video/x-raw, format=I420' ! identity drop-allocation=true ! v4l2sink device=/dev/video5

I am getting the following errors-

ERROR: from element /GstPipeline:pipeline0/GstNvArgusCameraSrc:nvarguscamerasrc0: Internal data stream error.
Additional debug info:
gstbasesrc.c(3055): gst_base_src_loop (): /GstPipeline:pipeline0/GstNvArgusCameraSrc:nvarguscamerasrc0:
streaming stopped, reason not-negotiated (-4)
Execution ended after 0:00:03.055207182

Any advice on how to pass the nvarguscamerasrc to v4l2sink?

hello user103475,

may I know which JetPack release you’re working with?
could you please refer to Topic 164994 for the simplify pipeline to feed CSI bayer video stream with v4l2sink, and access it via v4l2src.
thanks

I am using JetPack version 4.4.1.

From the Topic 164994, I tried using the code-

sudo rmmod v4l2loopback
sudo modprobe v4l2loopback exclusive_caps=1 video_nr=2
gst-launch-1.0 nvarguscamerasrc ! nvvidconv ! video/x-raw, width=1920, height=1080, framerate=30/1, format=YUY2 ! identity drop-allocation=1 ! v4l2sink device=/dev/video2

However, I am getting the same error.

hello user103475,

this server side pipeline looks incorrect. you should convert the formats as NV12 then sink to the loopback node.

Tried converting source and/or sink with NV12 format, still getting the same error.

gst-launch-1.0 nvarguscamerasrc ! video/x-raw(memory:NVMM), width=1920, height=1080, format=NV12, framerate=30/1 ! nvvidconv ! video/x-raw, width=1920, height=1080, framerate=30/1, format=YUY2 ! identity drop-allocation=1 ! v4l2sink device=/dev/video2
gst-launch-1.0 nvarguscamerasrc ! video/x-raw(memory:NVMM), width=1920, height=1080, format=NV12, framerate=30/1 ! nvvidconv ! video/x-raw, width=1920, height=1080, framerate=30/1, format=NV12 ! identity drop-allocation=1 ! v4l2sink device=/dev/video2

hello user103475,

please share all your server side and client side commands,
also, what’s the error logs.

The pipeline used

gst-launch-1.0 nvarguscamerasrc ! video/x-raw(memory:NVMM), width=1920, height=1080, format=NV12, framerate=30/1 ! nvvidconv ! video/x-raw, width=1920, height=1080, framerate=30/1, format=NV12 ! identity drop-allocation=1 ! v4l2sink device=/dev/video2

The error received

Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
GST_ARGUS: Creating output stream
CONSUMER: Waiting until producer is connected...
GST_ARGUS: Available Sensor modes :
GST_ARGUS: 4032 x 3040 FR = 29.999999 fps Duration = 33333334 ; Analog Gain range min 1.000000, max 22.250000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1920 x 1080 FR = 59.999999 fps Duration = 16666667 ; Analog Gain range min 1.000000, max 22.250000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 2592 x 1944 FR = 29.999999 fps Duration = 33333334 ; Analog Gain range min 1.000000, max 22.250000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 2560 x 1440 FR = 40.000000 fps Duration = 25000000 ; Analog Gain range min 1.000000, max 22.250000; Exposure Range min 13000, max 683709000;

GST_ARGUS: Running with following settings:
   Camera index = 0 
   Camera mode  = 1 
   Output Stream W = 1920 H = 1080 
   seconds to Run    = 0 
   Frame Rate = 59.999999 
GST_ARGUS: Setup Complete, Starting captures for 0 seconds
GST_ARGUS: Starting repeat capture requests.
CONSUMER: Producer has connected; continuing.
ERROR: from element /GstPipeline:pipeline0/GstNvArgusCameraSrc:nvarguscamerasrc0: Internal data stream error.
Additional debug info:
gstbasesrc.c(3055): gst_base_src_loop (): /GstPipeline:pipeline0/GstNvArgusCameraSrc:nvarguscamerasrc0:
streaming stopped, reason not-negotiated (-4)
Execution ended after 0:00:02.954293342
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
GST_ARGUS: Cleaning up
CONSUMER: Done Success
GST_ARGUS: Done Success
Setting pipeline to NULL ...
Freeing pipeline ...

Hi user103475,

Please follow this topic to update v4l2loopback to v0.12.5 and run below commands:

  • Server command:
$ gst-launch-1.0 -v nvarguscamerasrc sensor-id=0 ! 'video/x-raw(memory:NVMM), format=NV12, width=1920, height=1080, framerate=30/1' ! nvvidconv ! video/x-raw,format=YUY2 ! identity drop-allocation=1 ! v4l2sink device=/dev/video1
  • Client command:
$ gst-launch-1.0 v4l2src device=/dev/video1 ! videoconvert ! xvimagesink

I have installed v0.12.5,

cudnn_samples_v8
jetson_multimedia_api
linux-headers-4.15.0-166
linux-headers-4.15.0-166-generic
linux-headers-4.9.140-tegra-linux_x86_64
linux-headers-4.9.140-tegra-ubuntu18.04_aarch64
nvidia
tensorrt
v4l2loopback
v4l2loopback-0.12.5

Still getting the same errors.

Hi,
Are you able to try 0.9.1? We try 0.12.5 on Jetpack 4.6. Looks like 0.12.5 does not work on Jetpacl 4.4.1. May try 0.9.1.

Downgrading v4l2loopback to v0.9.1 worked well. Thanks for the help.

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