TX2 onboard camera in Chromium

I’m trying to get to work my Jetson TX2s CSI camera module in Chromium browser.
So far I have done this:

  1. using Nvidia guidance on building v4l2loopback module (version 0.12.5) from GitHub - umlaeute/v4l2loopback: v4l2-loopback device

  2. configured v4l2loopback to provide with /dev/video2
    2.1 launching module with insmod v4l2loopback.ko devices=1 video_nr=2 exclusive_caps=1 was not working, Firefox did not recognize device
    2.2 launching module with insmod v4l2loopback.ko devices=1 video_nr=2 exclusive_caps=0got Firefox to see device, but I’m not sure why after this exclusive_caps=0 or exclusive_caps=1 works

  3. started streaming using
    gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=1280, height=720,framerate=30/1' ! nvvidconv ! 'video/x-raw(memory:NVMM), width=1280, height=720, framerate=30/1, format=I420' ! nvvidconv ! 'video/x-raw, width=1280, height=720, framerate=30/1, format=UYVY' ! identity drop-allocation=true ! v4l2sink device=/dev/video2

  4. VLC is happy to display camera output captured from /dev/video2

  5. cheese app is not seeing device

  6. tested with Mozilla Firefox browser and website Webcam Check | Webcam Test

Problem is with getting even Webcam Check | Webcam Test to work with setup above.

I have tried test streams like
gst-launch-1.0 videotestsrc is-live=true ! 'video/x-raw, format=BGR, framerate=30/1' ! tee ! v4l2sink device=/dev/video2
gst-launch-1.0 videotestsrc is-live=true ! 'video/x-raw, format=UVUY, framerate=30/1' ! tee ! v4l2sink device=/dev/video2

Same outcome: Firefox works and Chromium doesn’t using Webcam Check | Webcam Test to verify

I’m using # R32 (release), REVISION: 4.4, GCID: 23942405, BOARD: t186ref, EABI: aarch64, DATE: Fri Oct 16 19:37:08 UTC 2020

Chromium version: 87.0.4280.66 (Official Build) Built on Ubuntu , running on Ubuntu 18.04 (64-bit)

tested on two TX2 boards with same consistent result. Kind of ran out of ideas to try, I’d appreciate some advise, website I’m planning to use needs Chromium or Edge, it doesn’t support Firefox :/

hello nickppv2000,

since you’re able to preview the stream with VLC via v4l2loopback nodes. this seems like application level issue.

Jerry, I’m inclining to think it is something about Chromium and/or CSI camera over V4L2 and/or argus library.
I have tested USB camera and it has no issue connecting through Chromium on website I mentioned.

hello nickppv2000,

please refer to Camera Architecture Stack, you cannot access CSI bayer sensor via v4l2src directly.

may I know what’s your actual use-case?
you may have a try to encode the stream and save the video to /dev/video2, then access it with v4l2src for the usage.
thanks

this is what I’m trying to achieve: /dev/video0 (CSI camera) is being passed to /dev/video2 through v4l2loopback.
Use case is to have CSI camera accessible in web app.

hello nickppv2000,

could you please refer to Topic 67258 as see-also.
thanks

Jerry, thanks for reference, but what Topic 67258 has to do with my case? Correct me if I am wrong, but it will create arguscamera->encode->rtsp->decode->v4l2loopback->/dev/video1 all on local host. I’ll give it a try but I see encoding and rtsp streaming performance andpower consumption penalties.
I’m trying to achieve in-memory conversion with pipeline I asked about in my original post.

hello nickppv2000,

there’s an example pipeline for your reference,
you may also check below for a simplify pipeline to feed CSI bayer video stream with v4l2sink, and access it via v4l2src
for example,

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

this worked if I’m starting client from console, but even Firefox wasn’t able to show video stream on website Webcam Check | Webcam Test

hello nickppv2000,

we may confirm v4l2loopback works if you’re able to access the stream locally.
that should be an issue with the web browser, I don’t know the detail protocol of Webcam Check | Webcam Test is using.
do you have any other application for testing?

I tried with pipeline configuration I posted in starter message:

htps://zoom.us
Firefox has no issues with it, Chromium doesn’t show camera feed.

Configuration proposed by you doesn’t work neither with Chromium nor Firefox:

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

Thank you for your support. I hope it won’t end up with dead end on Chromium side :(

hello nickppv2000,

I’ve try google it around and it seems there’s solution by adding --enable-feature flags.
for example, --enable-features=RunVideoCaptureServiceInBrowserProcess

please give it a try, finger crossed.
https://support.google.com/chrome/thread/2062037?hl=en&msgid=15445715

BTW,
had you also try some chrome’s extension plugins to activate your webcam?
thanks

I tried this setting, and it didn’t work for me, but I think we are onto something here. Thank you for your help

Some formats are supported by Firefox such as YUYV, some others by Chromium such as I420.
My best advice would be using YUY2 that is supported by both.
Chromium would only work with exclusive_caps=1, but Firefox can work with or without.

Try:

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

Yes, this worked!!! Thank you.
Where did you find this kind of information?

Hello.

thanks to you,all,finally I’ve been able to see what my camera (model waveshare ; IMX219-77IR) sees using nomachine and the v4l2loopback device,using these commands :

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

I have also tested the cam with the browsers firefox and chromium on these websites :

With Firefox,both the websites are not able able to work,but chromium does. That it works with the v4l2loopback device,but it’s not enough for me. Can some one explain to me how can I see what the cam sees while I’m using Windows ? that’s because in the project that I’m working on,the camera will be mounted on top of a drone and I would like to use Windows or Linux outside of nomachine,to display what the camera sees when the drone is flying. Keep in consideration that I will attach to the nano the “huawei e3372 4g” dongle to provide to the drone a mobile connection,instead of a wi-fi connection and this may have an impact to the performance of the encoder used.