I have followed a lot of guides and finally made it so that I could get the gst_loopback working using the following. (I am using an x86 with Ubuntu 20.04.4 LTS)
My goal is to do frame capture in OpenCV and tracking persons. In order to get VideoCapture to work with OpenCV in Python I have to use this in gst_loopback
Yes, the project you are referring to is the same I am using to feed the USB video stream into the v4l2loopback device. When I use the settings
video/x-raw,format=I420
I get this error.
$ ./gst_loopback
start, hit any key to stop
Error: Internal data stream error.
stop
I am using an older Fujitsu laptop with an Nvidia Quadro K1100M/PCIe/SSE2 graphics chip. It has an I7 CPU and it is the 64-bit version of Ubuntu 20.04.4 LTS.
import cv2
cap = cv2.VideoCapture(0)
# Check if the webcam is opened correctly
if not cap.isOpened():
raise IOError("Cannot open webcam")
while True:
ret, frame = cap.read()
frame = cv2.resize(frame, None, fx=0.25, fy=0.25, interpolation=cv2.INTER_AREA)
cv2.imshow('frame', frame)
c = cv2.waitKey(1)
if c == 27:
break
cap.release()
cv2.destroyAllWindows()
Can you disable the discrete NVIDIA Quadro K1100M graphics card on your system using the BIOS on your laptop as a test and use the onboard GPU of the i7 CPU as a test? Or, does your i7 CPU not have an integrated GPU?
What NVIDIA driver are you using on Ubuntu 20.04? Are you running Wayland or X11?
The libuvc driver works for me on both Wayland and X11, but I think most people use it on X11.
Thank you for you support! So, today I tried doing this on a Windows machine. Using the Theta UVC driver I got it to work. So at least I know that the camera is fine.
The BIOS on the laptop is locked so I cannot disable it in the BIOS but I could switch to the Intel graphics chip using the Nvidia X Server Settings app in Ubuntu and PRIME Profiles settings.
Following your second last post, I got stuck on ./gst_loopback because it seemed to just hang and “start, hit any key to stop” was never displayed.
I could not try $ theta --info
Where can I find that command?
Maybe I should try to install Ubuntu again? Is version 18 better than 20 for trying to get this to work? You clearly got it to work with 20…
theta --info is the same as ptpcam --info if you have that installed. I just wanted to show the firmware version. Can you post the firmware version you are using on the Z1?
You can use the desktop app on windows to upgrade the firmware of the Z1 if you haven’t done that already.
I do not think that you will benefit from reinstalling Ubuntu 18.04.
I think the majority of the people are running 20.04 unless you are running a ROS variant and need to run an older version of ROS due to existing programs from prior researchers.
I am likely going to upgrade to Ubuntu 22.04 Jammy Jellyfish now that it is released.
instead of reinstalling Ubuntu, my recommendation is to look into:
Does v4l2loopback work on the Fujitsu laptop on Ubuntu 20.04 (what you have installed now) with a normal USB webcam running H.264 (like a normal logitech webcam, not a THETA Z1)
verify that you are running the newest firmware in the Z1 (you can use the Windows desktop app Download | RICOH THETA)
if you are still stuck after the firmware upgrade, consider running ubuntu on a separate disk drive using a different computer with a non-Quadro GPU. The Quadro is a high-end GPU, but as it is less common, we have less tests with it. Other people have posted about problems with v4l2loopback and Quadro graphics cards. I am suggesting a separate USB drive so that you don’t mess up a “work” Windows machine by re-partitioning the drive
Alternately, if someone in your lab has a Linux machine with a different hardware configuration, maybe you can borrow it so that you can try and isolate if the problem is with the Fujitstu hardware configuration with v4l2loopback?
Sorry to hear about all your problems. You’re not alone. If you search on this forum, you’ll see that certain hardware/software configurations have been problematic for other researchers, primarily with v4l2loopback.
Success at last! I gave it a go again on the Fujitsu with the new Ubuntu 22.04 LTS version (full install). I then installed libuvc-theta, libuvc-theta-sample, gstthetauvc, v4l2loopback and all necessary prerequisites. No changes other than that the v4l2loopback uses /dev/video2 on the Fujitsu.
I could not get VLC to work and the log didn’t reveal anything more:
Your input can't be opened:
VLC is unable to open the MRL 'v4l2:///dev/video2'. Check the log for details.
So, I moved on to test if the gst-launch-1.0 might work and it did! I also got the OpenCV Python test script to work, as well as your canny-edge.py script.
The Ubuntu installed Nvidia drivers are active and works.