Ricoh Theta V in Jetson Xavier: can't open camera by index & Internal data stream error

Dear all,

I am having a very strange problem, where I’m getting the following errors:

  • ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error.

  • [ WARN:0] global /tmp/pip-req-build-rd4x2fty/opencv/modules/videoio/src/cap_v4l.cpp (890)
    open VIDEOIO(V4L2:/dev/video3): can’t open camera by index

Environment

  • Ricoh Theta V
  • Jetson Xavier
  • LXDE 0.99.2

v4l2-ctl --list-devices

The thing is that I am able to run gst_loopback without a problem. When I run v4l2-ctl --list-devices, the Ricoh Theta V appears as a dummy video in /dev/video3 which is the index that when I run in my program and cannot open the camera.

$ v4l2-ctl --list-devices
Dummy video device (0x0000) (platform:v4l2loopback-000):
/dev/video3

Allow reading, writing and execution on the camera by all users

I thought that maybe it was a problem with the camera not allowing the user to execute it. I gave it all the reading, writing, and executing permissions to all users, but still no luck.

ls -l /dev/video3
crwxrwxrwx+ 1 root video 81, 3 oct. 19 14:55 /dev/video3

Canny.py

Finally, I also tried running the Canny.py program, and although you can see that the video index selection is the right one, I am still getting the same Error. Does anyone know how to solve this?

$ python3 canny.py --video_device 3
Called with args:
Namespace(video_device='3')
OpenCV version: 4.5.3
Device Number: 3
[ WARN:0] global /tmp/pip-req-build-rd4x2fty/opencv/modules/videoio/src/cap_v4l.cpp (890)
open VIDEOIO(V4L2:/dev/video3): can't open camera by index
camera open failed

We got the following information from the driver developer.

begin section from driver developer

Although I made an example using v4l2loopback, I don’t recommend it for practical use.

Instead, try gstreamer plugin ( GitHub - nickel110/gstthetauvc: Gstreamer theta uvc plugin ).

To use with the OpenCV,

Canny Demo for RICOH THETA using libuvc-theta · GitHub

and

Add initial support for theta live stream source using gstreamer thet… · nickel110/jetson-utils@16594f1 · GitHub

would be good examples.

I also made modification to ROS libuvc driver(libuvc_ros) so that it can use H264 webcamera.

(GitHub - nickel110/libuvc_ros)

This would be good example if you don’t use OpenCV.

end section from driver developer

Updated readme

GitHub - nickel110/gstthetauvc: Gstreamer theta uvc plugin

gstthetauvc - Gstreamer THETA UVC plugin

Build and Install

Prerequisites

Gstreamer development package (on Ubuntu, libgstreamer1.0-dev) and libuvc with UVC1.5/H.264 support
are required.

  • If libuvc is installed to non-standard directory, you may need to set location of the libuvc.pc file to PKG_CONFIG_PATH environment variable.

Build

Just run make at gsttehtauvc/thetauvc.

Install

Copy gstthetauvc.so into the gstreamer plugin directory or wherever you like.

  • If you copied into directory other than the gstreamer plugin directory, you need to set the directory path to the GST_PLUGIN_PATH environment variable.

Plugin properties

mode   : Video mode to playback
         flags: readable, writable
         Enum "GstThetauvcMode" Default: 0, "2K"
            (0): 2K               - 1920x960(THETA V/Z1)/1920x1080(THETA S)
            (1): 4K               - 3840x1920(THETA V/Z1)
serial : The serial number of the THETA to use.
         Useful if multiple THETAs are connected to the system.

For other properties, run gst-inspect-1.0 thetauvcsrc.

Example

View 4K streaming on the display

$ gst-launch-1.0 thetauvcsrc mode=4K ! queue ! h264parse ! decodebin ! queue ! autovideosink sync=false

Read into OpenCV

VideoCapture cap("thetauvcsrc ! decodebin ! autovideoconvert ! video/x-raw,format=BGRx ! queue ! videoconvert ! video/x-raw,format=BGR ! queue ! appsink");
  • Note:
    • OpenCV should be build with gstreamer backend enabled.
    • You may need to replace autoplugins (e.g. deocdebin/autovideoconvert/autovideosink) with platform specific plugins.
      • On Jetson platform, nvv4l2decoder/nvvidconv/nv3dsink respectively.
1 Like