We are about to switch to a new forum software. Until then we have removed the registration on this forum.
To start simple, I would like to have this sketch run on my raspberry pi:
/**
* Please note that the code for interfacing with Capture devices
* will change in future releases of this library. This is just a
* filler till something more permanent becomes available.
*
* For use with the Raspberry Pi camera, make sure the camera is
* enabled in the Raspberry Pi Configuration tool and add the line
* "bcm2835_v4l2" (without quotation marks) to the file
* /etc/modules. After a restart you should be able to see the
* camera device as /dev/video0.
*/
import gohai.glvideo.*;
GLCapture video;
void setup() {
size(320, 240, P2D);
// this will use the first recognized camera
video = new GLCapture(this, 0);
video.play();
}
void draw() {
background(0);
if (video.available()) {
video.read();
}
image(video, 0, 0, width, height);
}
It is taken directly from https://github.com/gohai/processing-glvideo/blob/master/examples/SimpleCapture/SimpleCapture.pde
I can re-install my OS to have a clean slate if needed, I am only using this for one project.
Errors I run into frequently relate to java and Gstreamer:
(java:8424): GStreamer-WARNING **: Failed to load plugin '/home/pi/sketchbook/libraries/glvideo/library/linux-armv6hf/gstreamer-1.0/libgstalsa.so': /home/pi/sketchbook/libraries/glvideo/library/linux-armv6hf/gstreamer-1.0/libgstalsa.so: symbol snd_pcm_get_chmap, version ALSA_0.9 not defined in file libasound.so.2 with link time reference
(java:8424): GStreamer-WARNING **: Failed to load plugin '/home/pi/sketchbook/libraries/glvideo/library/linux-armv6hf/gstreamer-1.0/libgstvideo4linux2.so': /lib/arm-linux-gnueabihf/libc.so.6: version `GLIBC_2.17' not found (required by /home/pi/sketchbook/libraries/glvideo/library/linux-armv6hf/gstreamer-1.0/libgstvideo4linux2.so)
(java:8424): GStreamer-WARNING **: Failed to load plugin '/home/pi/sketchbook/libraries/glvideo/library/linux-armv6hf/gstreamer-1.0/libgstlibav.so': /lib/arm-linux-gnueabihf/libc.so.6: version `GLIBC_2.17' not found (required by /home/pi/sketchbook/libraries/glvideo/library/linux-armv6hf/gstreamer-1.0/libgstlibav.so) Could not parse pipeline v4l2src device=/dev/video0 ! glupload name=glup ! glcolorconvert ! capsfilter name=filter ! fakesink name=vsink: no element "v4l2src"
The only thing I've been able to succeed at is this instruction https://raspberrypi.org/documentation/usage/webcams/README.md
I understand a decent amount, but I'm no expert at this stuff.
Thanks, Bonem
Answers
Hi @Bonem, Interesting to hear about this... what's the OS/distribution you're running on the Pi that gives those errors?
It will definitely work with the current image of Raspbian + Processing, but I'd love to figure out what's going on here.
Hey @gohai, thank you for replying!
When I turn the pi on it mentions Raspbian GNU/Linux 7.
I think my problem is there are steps I need to take to prepare my raspberry pi. Steps like updating the java and gstreamer libraries, and steps to enable my webcam. The thing is, I have tried everything I could find but it still does not work in the end.
What do you suggest?
@Bonem That's a very old version of Raspbian - I'd suggest you copy any files you want to keep of your SD card and install a current version. You could try this image that has Processing pre-installed, if you want to.
Ok, I will do that right now. Thank you
@Gohai,
I did as you suggested, updated processing, updated the GL Video library, ran the sketch, and it gave me these errors:
@Bonem (That's with a current Raspbian release, right?) What Raspberry Pi model & camera are you trying this with?
I'll try my best to reproduce this here...
I believe these two commands will update Raspbian, so I will run them now:
sudo apt-get update
sudo apt-get dist-upgrade
I'm trying not to do anything extra, only what you say to do. That way there is no mistake that I am making...
@Gohai
After updating the error is now this:
FIXED - I had the USB camera unplugged when I ran the sketch and received these errors.
@Bonem What camera are you trying this with? The Raspberry Pi camera, or a USB-attached one?
If it's the former, make sure you've enabled its v4l2 driver like explained in the example's header:
@Gohai
I am using a USB-attached, still not working :(
@Bonem
Not working as in: the same error ("No such file or directory") as you posted above? If this is the case, and you're not seeing a
video0
when you do als -l /dev
, then your camera most likely not supported by Linux.@Gohai
Here are the new errors:
@Bonem
This must be a bug in the library - please open an issue at https://github.com/gohai/processing-video with all relevant informations.