nickel110 / gstthetauvc

Gstreamer theta uvc plugin
GNU Lesser General Public License v2.1
17 stars 11 forks source link

Found 1 Theta(s), but none available. #1

Closed kjrusscher closed 2 years ago

kjrusscher commented 2 years ago

I am trying to get gstthetauvcsrc working on a NVIDIA Jetson Nano. The code compiles without any problems.

To test if the GStreamer element works I just try:

gst-launch-1.0 thetauvcsrc mode=4K ! queue ! h264parse ! nvv4l2decoder ! nvvidconv ! queue ! fakevideosink

This returns the error:

Setting pipeline to PAUSED ...
ERROR: Pipeline doesn't want to pause.
ERROR: from element /GstPipeline:pipeline0/GstThetauvcsrc:thetauvcsrc0: Found 1 Theta(s), but none available.
Additional debug info:
gstthetauvcsrc.c(495): gst_thetauvcsrc_start (): /GstPipeline:pipeline0/GstThetauvcsrc:thetauvcsrc0
Setting pipeline to NULL ...
Freeing pipeline ...

The reason that I think that this is caused by the code in the gstthetauvcsrc element is that this code https://github.com/ricohapi/libuvc-theta-sample works fine.

My question is: does someone know what is causing this problem?

kjrusscher commented 2 years ago

I'm sorry, the libuvc-theta-sample has the same problem. I think that I broke something... So, this is not a gstthetauvc problem.

nickel110 commented 2 years ago

That is a typical error when the program is loading the original libuvc.so. If libuvc package is installed on your system, uninstall it.

kjrusscher commented 2 years ago

Thank you for your reply @nickel110 ! That was indeed the problem. Uninstalling libuvc-dev solved the problem.

davzoltan commented 2 years ago

@nickel110 I got the same problem. The https://github.com/nickel110/libuvc is installed, the libuvc-dev is not installed. Before I installed the nickel110/libuvc I used the libuvc-theta

Do you have some idea what is causing the problem? ERROR: from element /GstPipeline:pipeline0/GstThetauvcsrc:thetauvcsrc0: Found 1 Theta(s), but none available.

kjrusscher commented 2 years ago

@davzoltan You could try purging libuvc-dev. My problem was solved after purge and reboot. I thought that the reboot solved the problem, but maybe it is the purge. sudo apt purge libuvc-dev

davzoltan commented 2 years ago

@kjrusscher

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package 'libuvc-dev' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.

Is it possible that the earlier installed libuvc-theta is causing the problem?

kjrusscher commented 2 years ago

@davzoltan Sorry, I read that you wrote you had installed libuvc-dev, but you wrote you had installed libuvc-theta. My bad.

I don't have enough knowledge to help you further, maybe @nickel110 can give some indications that can help you solve your problem.

davzoltan commented 2 years ago

Deleted one by one the libuvc-theta files because it don't have make uninstall.. and its working. @kjrusscher thank you for your help!

davzoltan commented 2 years ago

When I try to use the nvdec for the better performance (https://codetricity.github.io/theta-linux/optimization/) I get a similar error "Cannot open webcam". Did you tried the gsthetauvc with it, if yes, could you provide an example to use it with OpenCV?

nickel110 commented 2 years ago

Check the following links;

davzoltan commented 2 years ago

@nickel110 I checked them, its working with gst-launch-1.0 perfectly, like on the link what you sent. Do you have an nvdec gstreamer example pipeline for OpenCV (I dont have Jetson)?

nickel110 commented 2 years ago

As I don't have discrete GPU PC, I don't have any pipeline example using nvdec. But according to https://codetricity.github.io/theta-linux/optimization/#configuration-with-v4l2loopack-on-devvideo , I guess thetauvcsrc ! queue ! h264parse ! nvdec ! gldownload ! queue ! videoconvert n-threads=0 ! video/x-raw,format=BGR ! queue ! appsink may work. Of course, above example isn't optimal, so additional tuning is needed for better performance.

codetricity commented 2 years ago

@davzoltan this pipeline works for me with discrete NVIDIA GPU.

gst-launch-1.0 thetauvcsrc ! queue ! h264parse ! nvdec ! gldownload ! queue ! videoconvert n-threads=0 ! video/x-raw,format=BGR ! queue ! glimagesink

My computer may be too slow to adequately test it.

I am running Ubuntu 22.04 with X11 for the test. Do I need to recompile OpenCV with gstreamer support to test it? Also, did you compile OpenCV with CUDA support? I have not compiled OpenCV in a while and I can't remember what is on my system right now. As my system is working now with the THETA V, Z1, X, I am a bit reluctant to change OpenCV, but I am collecting information to try it with the gstreamer support with gstthetauvc.

image

Using NVIDIA 510.73 with old GTX 950

nickel110 commented 2 years ago

@codetricity thank you for testing. I believe OpenCV package for Ubuntu 22.04 has gstreamer backend, since libgstreamer packages ar listed as it's dependencies. You can check availability by calling cv::videoio_registry::hasBackend(), like

image

codetricity commented 2 years ago
 python3
Python 3.10.4 (main, Apr  2 2022, 09:04:19) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.videoio_registry.hasBackend(cv2.CAP_GSTREAMER)
True
>>> 

This works. image

# pipeline suggestion thanks to nickel110
cap = cv2.VideoCapture("thetauvcsrc \
    ! queue \
    ! h264parse \
    ! nvdec \
    ! gldownload \
    ! queue \
    ! videoconvert n-threads=0 \
    ! video/x-raw,format=BGR \
    ! queue \
    ! appsink")

image

image

nickel110 commented 1 year ago

Sorry I put a wrong link. I corrected the post, please try again.

On Jun 4, 2022, at 5:34, Craig Oda @.***> wrote:

https://gist.github.com/codetricity/d06068bee816e52eb7aba6b94eb5d119?permalink_comment_id=3774056#gistcomment-3774056 https://gist.github.com/codetricity/d06068bee816e52eb7aba6b94eb5d119?permalink_comment_id=3774056#gistcomment-3774056 The gist you posted in your comment is no longer available. Could you repost the portion about how to accept gstreamer pipeline description as video device argument?

python3 Python 3.10.4 (main, Apr 2 2022, 09:04:19) [GCC 11.2.0] on linux Type "help", "copyright", "credits" or "license" for more information.

import cv2 cv2.videoio_registry.hasBackend(cv2.CAP_GSTREAMER) True

— Reply to this email directly, view it on GitHub https://github.com/nickel110/gstthetauvc/issues/1#issuecomment-1146340180, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKGYOV64HDVY75EUOBFVLD3VNJT3VANCNFSM5TQJUB3Q. You are receiving this because you were mentioned.