Simple v4l2_camera sample doesn't work

I am trying to test the v4l2_camera sample (latest release 20210609-e336b5195 at the time of writing). Sample Applications — ISAAC 2021.1 documentation

I followed the instructions on the getting started guide to deploy the application on my XavierNX. I’m running Jetpack 4.5.1 as instructed by the documentation. Getting Started — ISAAC 2021.1 documentation

I have successfully deployed the algorithm on my Jetson. Here is the terminal output:
v4l2_camera deployment (21.7 KB)

Then I SSH’ed into my Jetson and ran the algorithm. Here is the terminal output.
v4l2_camera run (9.2 KB)

As you’ll realize, there’s an error message.

2022-01-13 14:08:01.375 ERROR packages/sensors/V4L2Camera.cpp@141: [V4L2Camera] Format request failed with error: Invalid argument.

Then I started Nvidia Sight on my host machine. However, I don’t see the camera feed. It says “This channel is currently empty.” But why? There’s only one camera connected to Jetson, I can find it with “ls /dev/video*”. Shouldn’t the algorithm just find the camera automatically? How can I fix this?

P.s., I can confirm that the camera works as is. I used GUVCviewer to check it.

1 Like

The error message indicates that the request the codelet made to v4l2 via ioctl was rejected. If any of the parameters were unsupported, such as the wrong width and height or image encoding not supported, there are more specific error messages for those. Somehow, there is an invalid number altogether in the initial request. For reference, the format request the codelet sends via ioctl includes pixel width, pixel height (as set by the rows and cols parameters on the codelet), and pixel format as V4L2_PIX_FMT_YUYV.

It might be worth checking what modes your camera supports using v4l2-ctl --list-formats-ext, for example. Which camera is this and how is it connected to the NX?

The codelet has a parameter for which camera device_id you want it to connect to, defaults to 0.

Hi @hemals ,

I am using e-cam24 from econsystems. It’s a MIPI CSI camera. The specs are:
e-cam24 v4l2-ctl specs.txt (929 Bytes)

I modified the and updated cols, rows, and rate_hz parameters to 640, 480, and 120, respectively. But I still get the same error. Any ideas?

My e-cam24 camera uses UYVY pixel format instead of YUYV. Can that be the problem?

That could be the issue. We have noted previously issues with some CSI cameras over V4L2. If you’re using a CSI camera, use the ArgusCsiCamera codelet instead though which uses libArgus instead of V4L2 and is optimized for Jetson.

Is it possible to change V4L2_PIX_FMT_YUYV to V4L2_PIX_FMT_UYVY? (I don’t see it in apps/samples/v4l2_camera/

I will check out the ArgusCsiCamera nodelet. I ultimately want to use the april_tags codelet, which uses v4l2_camera to interact with the camera. Even if the camera works with ArgusCsiCamera, I won’t be able to use april_tags with e-cam24, right?

It is not a parameter, unfortunately, so not possible to change the request without recompilation.

The AprilTagDetector (which version of Isaac SDK is this, by the way?) should not be affected by the upstream camera codelet you used to acquire the image (ideally, at least).

I see. Thanks for pointing that out.

I’m using Isaac SDK (2021.1), it came in isaac-sdk-20210609-e336b5195.tar.xz. I need to clarify something. In, I see

"input_images": {
  "isaac.V4L2Camera": {
    "device_id": 0,
    "rows": 1080,
    "cols": 1920,
    "rate_hz": 30

This seems like it’s using the same V4L driver that v4l2_camera uses. I again modified the rows, cols, and rate_hz parameters and ran it. I am getting the same error as v4l2_camera.

2022-01-14 13:16:49.545 ERROR packages/sensors/V4L2Camera.cpp@141: [V4L2Camera] Format request failed with error: Invalid argument.

@hemals please see above. Your help is appreciated.

If I’m reading your v4l2-ctl list formats output correctly, the camera seems to only support 1080p resolution at 65hz in YUV pixel formats. The 30fps is not listed as a discrete resolution/frequency pair in the info. Try setting to 65hz and see if that works.

I tried this:

"input_images": {
  "isaac.V4L2Camera": {
    "device_id": 0,
    "rows": 1080,
    "cols": 1920,
    "rate_hz": 65

But the problem still persists. Can you check the terminal printouts:
april_tags-terminal-output.txt (9.8 KB)

It might be worth trying a different camera since the e-cam24 does not support YUYV. The Apriltag detector JSON is referring to the same V4L2Camera codelet as, so it is expected that they both are showing the same error. Otherwise, better to use ArgusCsiCamera.