processing-video icon indicating copy to clipboard operation
processing-video copied to clipboard

“Could not find any devices” error on Windows

Open RaghidJ opened this issue 4 years ago • 5 comments

I'm not sure what is happening. The same code works sometimes and at others it doesn't: I can't connect to my camera. Is there any way to fix this issue? Or is it a known bug ? Thanks [ ![Processing problem](https://user-images.githubusercontent.com/55320529/98692000-13d23600-2388-11eb-8ded-81e1ca114c08.png) ](url)

Description

Expected Behavior

Current Behavior

Steps to Reproduce

Your Environment

  • Processing version:
  • Operating System and OS version:
  • Other information:

Possible Causes / Solutions

RaghidJ avatar Nov 10 '20 15:11 RaghidJ

I have the same issue ("The same code works sometimes and at others it doesn't"). Running processing-3.5.4 on a fresh Windows 10 Pro (version 20H2) PC (Intel i5-9600K 3.70 GHz 16GB 64 bits) with the default Processing Video library imported. I tried different Camera's: Logitech C920 and Kurokesu c1 pro. Both cameras work fine in the Windows Camera application but have unreliable results in Processing environment. Sometimes it works, sometimes it doesn't.

98692000-13d23600-2388-11eb-8ded-81e1ca114c08

Could not find any devices
IllegalStateException: Could not find any devices

companje avatar Dec 18 '20 18:12 companje

We have been noticing this behaviour consistently since the upgrade ~~from 3.5.3 to 3.5.4 in Windows 10. We also tried with 4a3 today: same behaviour as 3.5.4.~~ (Edit: I am thinking now that the difference is not in the Processing version, but rather in the Video Library version. I think this started to happen with one of the updates of the library itself. I will try to find out which update it was).

The issue is easy to reproduce, with two tests.

  1. Use Capture with laptop's internal camera. println(Capture.list()) gives nothing (trying to instance a Capture object crashes giving "Could not find any devices".)
  2. Plug in external camera: println(Capture.list()) gives both cameras, the previously ignored internal camera and the new one. (trying to instance a Capture object with any of the cameras works fine.)

I attach screenshots for both tests:

Before plugging external USB cam:

image

After connecting external cam:

image

lmtanco avatar Jan 25 '21 10:01 lmtanco

I have run into this problem a few different times. I think it may have to do with cameras which support both yuyv and mjpeg. Anyway, I finally found this solution. Instead of Capture.list(), use a custom gstreamer pipeline. It defaults to yuyv, which is annoying if you wanted hd video at more than 2 fps. After much trial and error, here are some pipelines that worked for me. Generic yuyv: cam = new Capture(this, "pipeline:autovideosrc"); yuyv with some parameters: cam = new Capture(this, 640, 480, "pipeline: ksvideosrc device-index=0 ! video/x-raw,width=640,height=480"); mjpeg: cam = new Capture(this, 1920,1080, "pipeline: ksvideosrc device-index=0! image/jpeg, width=1920, height=1080, framerate=30/1 ! jpegdec ! videoconvert"); Note that you should specify your resolution twice so that Processing and gstreamer are on the same page. It's not necessary in all cases, but you might save yourself a headache.

lucasfredericks avatar Apr 01 '21 18:04 lucasfredericks

I have run into this problem a few different times. I think it may have to do with cameras which support both yuyv and mjpeg. Anyway, I finally found this solution. Instead of Capture.list(), use a custom gstreamer pipeline. It defaults to yuyv, which is annoying if you wanted hd video at more than 2 fps. After much trial and error, here are some pipelines that worked for me. Generic yuyv: cam = new Capture(this, "pipeline:autovideosrc"); yuyv with some parameters: cam = new Capture(this, 640, 480, "pipeline: ksvideosrc device-index=0 ! video/x-raw,width=640,height=480"); mjpeg: cam = new Capture(this, 1920,1080, "pipeline: ksvideosrc device-index=0! image/jpeg, width=1920, height=1080, framerate=30/1 ! jpegdec ! videoconvert"); Note that you should specify your resolution twice so that Processing and gstreamer are on the same page. It's not necessary in all cases, but you might save yourself a headache.

Great! This solves my problem! Thank you so much!

ToCenTek avatar May 24 '21 19:05 ToCenTek

Yeah cool. Using Processing 4.0 beta and GStreamer 1.16.2 I get following errors:

BaseSrc: [ksvideosrc0] : No supported formats found

BaseSrc: [ksvideosrc0] : not negotiated

BaseSrc: [ksvideosrc0] : Internal data stream error.

Edit:

With ToCenTek's Solution (3) my console shows this:

(java.exe:12384): GStreamer-CRITICAL **: 16:22:23.220: gst_element_make_from_uri: assertion 'gst_uri_is_valid (uri)' failed 0:00:00.345341000 12384 0000022E9D5747E0 ERROR GST_PIPELINE grammar.y:971:priv_gst_parse_yyparse: no source element for URI "/jpeg," 0:00:00.345359800 12384 0000022E9D5747E0 ERROR GST_PIPELINE grammar.y:1061:priv_gst_parse_yyparse: syntax error 0:00:00.345370900 12384 0000022E9D5747E0 ERROR GST_PIPELINE grammar.y:1061:priv_gst_parse_yyparse: syntax error 0:00:00.345381900 12384 0000022E9D5747E0 ERROR GST_PIPELINE grammar.y:1061:priv_gst_parse_yyparse: syntax error 0:00:00.345438900 12384 0000022E9D5747E0 ERROR GST_PIPELINE grammar.y:1061:priv_gst_parse_yyparse: syntax error 0:00:00.345451200 12384 0000022E9D5747E0 ERROR GST_PIPELINE grammar.y:1061:priv_gst_parse_yyparse: syntax error Jan. 23, 2022 4:22:23 PM org.freedesktop.gstreamer.Gst parseLaunch WARNUNG: could not set property "device-index" in element "ksvideosrc0" to "0!" BaseSrc: [ksvideosrc0] : No supported formats found BaseSrc: [ksvideosrc0] : not negotiated BaseSrc: [ksvideosrc0] : Internal data stream error.

EinsMalte avatar Jan 23 '22 15:01 EinsMalte