Invalid Camera device

I have two Raspberry Pi Cameras hooked to a Jetson Xavier board. The ribbons used to connect to the Xavier of both cameras are on the cameras and in the camera slots of the Xavier in exactly the same way.

When I include the following
camSet='nvarguscamerasrc sensor-id=0…
my program shows the image that connected to the default 0 sensor on the Xavier.
When I change sensor-id to 1
I get the following error
“invalid Camera divide 1 specified, 0 max index…”.
Does anyone know why the max index is 0 or how both cameras could yield an image?

Are both cameras correctly probed at boot ?

dmesg | grep imx219
ls -l /dev/video*

What do you mean? When I install the cameras I have to reboot ?

I don’t think that CSI cameras support hot-plug. Although it may work in some cases.

By the way…after I installed the first camera in the default 0 slot, I did not reboot and the camera worked.

Give reboot a try and compare. I cannot advise much more for now.

Rebooting did not solve the problem.

Yes I put in ls -l /dev/video* and it returned two videos. What else should I do to get the second camera recognized by my program?

The specific error I get is
execute:561 Invalid camera device specified 1 specified, 0 max index…
Cannot query video position: status 0, value-1. duration=-1
followed by Traceback

when I entered ls -l /dev/video* it returned two videos: 0 and 1.

Looking forward to your suggestions.

So after a fresh boot with both cameras connected and not later removed, check the output of:

dmesg | grep imx219

and check for any error message. If there are, post these.

If not, have v4l-utils installed in case it is not:

sudo apt install v4l-utils

Then use v4l2-ctl to query driver about available modes for each camera:

v4l2-ctl -d /dev/video0 --list-formats-ext
v4l2-ctl -d /dev/video1 --list-formats-ext

If ok, try to get your cameras streaming to V4L using one of the listed modes:

v4l2-ctl -d /dev/video0 --set-fmt-video=width=1280,height=720,pixelformat=RG10  --set-ctrl bypass_mode=0 --stream-mmap
v4l2-ctl -d /dev/video1 --set-fmt-video=width=1280,height=720,pixelformat=RG10  --set-ctrl bypass_mode=0 --stream-mmap

If both work, you should be able to capture in bayer format RG10.

You may also check :

media-ctl -p

If all is ok so fine, try (assuming you have a GUI running, otherwise replace xvimagesink with fakesink):

gst-launch-1.0 -v nvarguscamerasrc sensor=0 ! nvvidconv ! xvimagesink
gst-launch-1.0 -v nvarguscamerasrc sensor=1 ! nvvidconv ! xvimagesink

I got no error messages on
dmesg | grep imx219
sudo apt install v4l-utils
I got v4l-utils is already newest version (1,14,2-1)
On entering
v4l2-ctl -d /dev/video1 --list-formats-ext
got a long list of intervals for different sizes for both video 0 and video 1
On entering
v4l2-ctl -d /dev/video1 --set-fmt-video=width=1280,height=720,pixelformat=RG10 --set-ctrl bypass_mode=0 --stream-mmap
I get unrecognized option ‘–stream-nmap’
followed by a long list of common options

Question: how to I record a terminal session?

Seems there’s a typo here. Use --stream-mmap.

Do you see different modes for video1 as compared to video0 ?
Are both cameras the same model ?
Are you using a customized device tree ? Another carrier board than standard devkit ?

correct the typo…got unknown standard ‘et-fmt-video=1280…’

both cameras are exactly the same Raspberry Pi version 2

I don’t understand what you mean by customized device tree…another carrier board than standard devkit

Seems there are still some wrong characters in your command.
Should be:


Are you using a serial console or ssh ? There might be some errors or wrong encoding.

(Attachment terminal session 20201009 14:50.pdf is missing)

terminal session 20201009 14-50.rtf (4.61 KB)

Again, use: ‘–set-fmt-video’ (with 2 ‘-’ )
Be aware that a computer is very psychorigid and may not support approximative commands for now.

These are the lines in my program that do work for camera 0; when I switch the sensor-if to 1 then I get the Invalid Camera device specified 1 with 0 mac index.

camSet = ‘nvarguscamerasrc sensor-id=0 tnr-mode=2 tnr-strength=1 ee-mode=2 ee-strength=0 wbmode=2 ! video/x-raw(memory:NVMM), width=3264, height=2464, framerate=21/1,format=NV12 ! nvvidconv flip-method=’+str(
flip)+’ ! video/x-raw, width=’+str(width)+’, height=’+str(height)+’, format=BGRx ! videoconvert ! video/x-raw, format=BGR ! videobalance contrast=1.5 brightness=-.2 saturation=1.2 ! appsink drop=TRUE’
cam = cv2.VideoCapture(camSet)

Please go step by step, taking care to each command.
Can you run V4L API capture with /dev/video1 ?
No chance to use nvarguscamerasrc gstreamer plugin nor opencv before that.