I’m learning Processing and currently having problem with displaying video from webcam using Processing Video library. the console shows this:
Processing video library using bundled GStreamer 1.20.3
Scanning GStreamer plugins... Done.
(Processing core video:23010): GStreamer-CRITICAL **: 16:48:23.550: gst_bin_add_many: assertion 'GST_IS_ELEMENT (element_1)' failed
(Processing core video:23010): GStreamer-CRITICAL **: 16:48:23.558: gst_element_link_pads_full: assertion 'GST_IS_ELEMENT (dest)' failed
and the display window is black.
Can anyone help with this? I’m running Processing 4.0.1 Apple Silicon version.
Hello @thinh.pham I have noticed the same issue and reported it on Github (see link below). It seems like the video library is currently broken on Apple Silicon.
You could also see if this example works for you - gst1-java-examples/SwingCamera at master · gstreamer-java/gst1-java-examples · GitHub
Might help narrow down whether this is a bug in Processing Video or lower down the stack.
Just saw the following workaround suggested on the Github issue.
cam = new Capture(this, 640, 480, "pipeline:avfvideosrc device-index=0 ! video/x-raw, width=640, height=480, framerate=30/1");
This worked for me on macOS 12.5.1 (Monterey) on an M1 Macbook Pro.
"pipeline:autovideosrc". If it works, that is at least cross-platform.
Thanks for the tip! The following worked for me:
cam = new Capture(this, 640, 480, "pipeline:autovideosrc ! video/x-raw, width=640, height=480, framerate=30/1");
What about without the caps bit too? eg. just
"pipeline:autovideosrc". If that works it would exclude one possible problem. I need to do more testing of the GStreamer bindings on native Apple Silicon (currently still doing most stuff with x86_64 JVM via Rosetta). Might be something awry going on in device discovery, or the way that Processing Video is using that.
Thanks for the suggestion However, I’m not sure I understand what you mean. Could you share your version of the line of code in question?
cam = new Capture(this, 640, 480, "pipeline:autovideosrc");
Thanks! It technically works but the image gets stretched.