USB camera not working via container (hello camera), Jetson nano

Hello everybody,

First time using Linux and I may missing something super simple, this is my issue:

I am trying to follow Jetson AI fundamentals tutorial, in headless mode, trying to use “hello camera” via the container, after getting the first execute fine:

crw-rw---- 1 root video 81, 0 Apr 13 13:45 /dev/video0

I get the following error:

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/jetcam-0.0.0-py3.6.egg/jetcam/usb_camera.py in __init__(self, *args, **kwargs)
     23             if not re:
---> 24                 raise RuntimeError('Could not read image from camera.')
     25 

RuntimeError: Could not read image from camera.

During handling of the above exception, another exception occurred:

RuntimeError                              Traceback (most recent call last)
<ipython-input-3-5a6744da9a88> in <module>
      2 
      3 #TODO change capture_device if incorrect for your system
----> 4 camera = USBCamera(width=224, height=224, capture_width=640, capture_height=480, capture_device=0)

/usr/local/lib/python3.6/dist-packages/jetcam-0.0.0-py3.6.egg/jetcam/usb_camera.py in __init__(self, *args, **kwargs)
     26         except:
     27             raise RuntimeError(
---> 28                 'Could not initialize camera.  Please see error trace.')
     29 
     30         atexit.register(self.cap.release)

RuntimeError: Could not initialize camera.  Please see error trace.

Looks like the program cannot start the camera but meanwhile sees that something connected to the USB (video0).

I’m successfully started the camera and captured some pics directly on Jetson using:

nvgstcapture-1.0 --orientation 2 --camsrc=0 --cap-dev-node=/dev/video0

However, also received the following output:

Encoder null, cannot set bitrate!
Encoder Profile = High
/dev/video/dev/video0 does not exist

My camera is an USB camera with 1/2.7" CMOS OV2710 processor, I did not see this type of image processor on Jetson Partner Supported Cameras, however it looks like people do use this processor with the Jetson Nano (via MIPI CSI connection).

Can I still use this camera with my Jetson Nano or the problem most likely is that my camera is not within the “Jetson Partner Supported Cameras” ?

Thanx!

Check first what formats are supported:
$ v4l2ctl --list-formats-ext

and --cap-dev-node=0, actually.

1 Like

Hello,

I get the following error (while running the command via Jetson terminal, headless or locally):

rita@Jetsy:~$ $ v4l2ctl --list-formats-ext
-bash: $: command not found

I understand it is Linux command, so I read that it may be spelled:

v4l2-ctl

tried it with the “-” same output, “command not found”, copied the command also from here.

no luck with --cap-dev-node=0 either (“command not found”).

I installed the latest image of Jetpack (4.6.1) from here. Should I install anything additional to run these commands?

Here the complete camera specifications, if it helps:

*CMOS 1080P sensor for high quality image and low power consumption.
*High speed USB 2.0 interface for high resolution PC camera interface.
*high pixel technology for sharp image and accurate color reproduction.
*low light performance – ideal for any lighting condition.
*Super small outline and thin profile for embedded applications.
*High frame rate–deliver60fps in1280X720 resolution,30fps in1920X1080 resolution.
*High quality lens, true and undistorted color image.
*Low power consumption – ideal for portable equipment.
*UVC for use in Android, Linux, Windows , MAC, SP2 or above.
*Camera with UVC

Optional models: ELP-USBFHD03AF-A100
Sensor: 1/2.7" CMOS OV2710
Lens size: 200W, 2.0megapixel, 1920(H)x1080(V)pixels
Max. Resolution: 1920X1080
Picture format: MJPEG
USB Protocal: USB2.0 HS/FS, USB1.1 FS
Support free driver: USB Video Class(UVC)1.1
Auto exposure AEC: Support
Auto white blance AEB: Support
Frame rate:
1920 (H) x 1080 (V) pixels MJPEG 30fps YUY2 6fps
1280 (H) x 1024 (V) pixels MJPEG 30fps YUY2 6fps
1280 (H) x 720 (V) pixels MJPEG 60fps YUY2 9fps
Adjustable parameters: Brightness/Contrast/Color saturation /Definition/Gamma/WB
Night vision: no
view angle: 100 degree
voltage: DC 5V
current: 150mA
work temperature: DEGREES(-20~70)
Size: 32x32mm/38*38
Support OS: WinXP/Vista/WIN7/WIN8 /Linux with UVC/Mac-OS X 10.4.8 or later Wince with UVC, Android 4.0 or above.

Thanx!!!

@rita4ka
Sorry for my misspelling!

$ sudo apt install -y v4l-utils
$ v4l2-ctl --list-formats-ext

And as it supports UVC, you may not need to install any other drivers to run it.

Dear @MtHiker,

I installed the package, this is the full output:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  apt-clone archdetect-deb bogl-bterm busybox-static cryptsetup-bin dpkg-repack gir1.2-timezonemap-1.0 gir1.2-xkl-1.0
  grub-common kde-window-manager kinit kio kpackagetool5 kwayland-data kwin-common kwin-data kwin-x11
  libdebian-installer4 libkdecorations2-5v5 libkdecorations2private5v5 libkf5activities5 libkf5attica5
  libkf5completion-data libkf5completion5 libkf5declarative-data libkf5declarative5 libkf5doctools5
  libkf5globalaccel-data libkf5globalaccel5 libkf5globalaccelprivate5 libkf5idletime5 libkf5jobwidgets-data
  libkf5jobwidgets5 libkf5kcmutils-data libkf5kcmutils5 libkf5kiocore5 libkf5kiontlm5 libkf5kiowidgets5
  libkf5newstuff-data libkf5newstuff5 libkf5newstuffcore5 libkf5package-data libkf5package5 libkf5plasma5
  libkf5quickaddons5 libkf5solid5 libkf5solid5-data libkf5sonnet5-data libkf5sonnetcore5 libkf5sonnetui5
  libkf5textwidgets-data libkf5textwidgets5 libkf5waylandclient5 libkf5waylandserver5 libkf5xmlgui-bin
  libkf5xmlgui-data libkf5xmlgui5 libkscreenlocker5 libkwin4-effect-builtins1 libkwineffects11 libkwinglutils11
  libkwinxrenderutils11 libqgsttools-p1 libqt5designer5 libqt5help5 libqt5multimedia5 libqt5multimedia5-plugins
  libqt5multimediaquick-p5 libqt5multimediawidgets5 libqt5opengl5 libqt5quickwidgets5 libqt5sql5 libqt5test5
  libxcb-composite0 libxcb-cursor0 libxcb-damage0 os-prober python3-dbus.mainloop.pyqt5 python3-icu python3-pam
  python3-pyqt5 python3-pyqt5.qtsvg python3-pyqt5.qtwebkit qml-module-org-kde-kquickcontrolsaddons
  qml-module-qtmultimedia qml-module-qtquick2 rdate tasksel tasksel-data
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  libv4l2rds0
The following NEW packages will be installed:
  libv4l2rds0 v4l-utils
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 399 kB of archives.
After this operation, 1,553 kB of additional disk space will be used.
Get:1 http://ports.ubuntu.com/ubuntu-ports bionic/main arm64 libv4l2rds0 arm64 1.14.2-1 [14.8 kB]
Get:2 http://ports.ubuntu.com/ubuntu-ports bionic/universe arm64 v4l-utils arm64 1.14.2-1 [384 kB]
Fetched 399 kB in 2s (235 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libv4l2rds0:arm64.
(Reading database ... 178646 files and directories currently installed.)
Preparing to unpack .../libv4l2rds0_1.14.2-1_arm64.deb ...
Unpacking libv4l2rds0:arm64 (1.14.2-1) ...
Selecting previously unselected package v4l-utils.
Preparing to unpack .../v4l-utils_1.14.2-1_arm64.deb ...
Unpacking v4l-utils (1.14.2-1) ...
Setting up libv4l2rds0:arm64 (1.14.2-1) ...
Setting up v4l-utils (1.14.2-1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for libc-bin (2.27-3ubuntu1.5) ...

I am not sure what “debconf: delaying package configuration, since apt-utils is not installed” means and if it can affect in any way the installation.

Regarding the formats:

ioctl: VIDIOC_ENUM_FMT
        Index       : 0
        Type        : Video Capture
        Pixel Format: 'MJPG' (compressed)
        Name        : Motion-JPEG
                Size: Discrete 1920x1080
                        Interval: Discrete 0.032s (31.000 fps)
                Size: Discrete 640x480
                        Interval: Discrete 0.008s (120.101 fps)
                Size: Discrete 800x600
                        Interval: Discrete 0.017s (60.000 fps)
                Size: Discrete 1280x720
                        Interval: Discrete 0.017s (60.000 fps)
                Size: Discrete 1280x1024
                        Interval: Discrete 0.032s (31.000 fps)
                Size: Discrete 320x240
                        Interval: Discrete 0.008s (120.101 fps)

        Index       : 1
        Type        : Video Capture
        Pixel Format: 'YUYV'
        Name        : YUYV 4:2:2
                Size: Discrete 1920x1080
                        Interval: Discrete 0.167s (6.000 fps)
                Size: Discrete 640x480
                        Interval: Discrete 0.032s (31.000 fps)
                Size: Discrete 800x600
                        Interval: Discrete 0.048s (21.000 fps)
                Size: Discrete 1280x720
                        Interval: Discrete 0.111s (9.000 fps)
                Size: Discrete 1280x1024
                        Interval: Discrete 0.167s (6.000 fps)
                Size: Discrete 320x240
                        Interval: Discrete 0.032s (31.000 fps)

Nothing changed afterwards, same errors with the “Hello camera”.
Also still outputs “encoder null” and “video0 does not exist” while launching the camera locally (however it do starts the camera locally as was previously).

I borrowed Logitech c270 from a friend, and with it everything runs smoothly, however it would be great if I still can use my camera somehow.

Many thanks again!

You may need to trace into the python code(usb_camera.py) to check if any parameter invalidate for your sensor.

1 Like

@rita4ka

If you can find the camera device inside container,
# ls -la /dev/video0

and you can run the camera with some other tools like nvgstcapture-1.0 or guvcview

then try to use this parameters:
camera = USBCamera(width=224, height=224, capture_width=640, capture_height=480, capture_device=0, capture_fps=31)

instead of this

camera = USBCamera(width=224, height=224, capture_width=640, capture_height=480, capture_device=0)

1 Like

Update: as it seems it was something between the python + ssh and the camera. locally via the container it runs well, I run a sample with detectnet /dev/video0 and it worked good.

Thank you!!! @MtHiker @ShaneCCC

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