The video library which is downloadable through the Processing Contribution Manager adds the ability to use videos and camera inputs in your Processing sketches. The wiki page about Video Processing shows how to use the library and some of its possibilities.
Why should we update?
However, the library currently published is using bindings to gstreamer 0.10 which is not longer maintained and dates back to 2015. This leads to some compatibility issues with newer operating system, as well as various bugs and memory leaks that will never be fixed without updating the gstreamer bindings. Therefore some of the Processing developers started to create a second version of the library, which adds modern bindings and improved features. This library is already working, but not yet released and that is why we have to update it manually.
How to update?
Download the latest pre-release of version 2 from the github releases (current: r6-v2.0-beta4)
Unzip the file and move the folder to your Processing library folder (overwrite existing video folder in necessary)
🎉🙌🏻 (at least on Unix & Windows)
From now on, make sure that you always provider a camera to the Capture constructor in your sketch:
String[] cameras = Capture.list(); video = new Capture(this, 640, 480, cameras[0]);
MacOS Mojave / Catalina Issues
Quarantine
Native libraries that are not notarised by Apple will be blocked by GateKeeper, Apples internal anti-virus software. To allow the native libraries of gstreamer, they have to be removed from the quarantine. To do this, open the console (terminal) Application and run following command by copy and paste it into the terminal and hit enter:
cd ~/Documents/Processing/libraries/video; xattr -r -d com.apple.quarantine *
Access
MacOS Mojave / Catalina have introduced new features regarding security and access control. This means that it is not possible anymore for any application, to just start the webcam or listen to your microphone or read what you are typing. As on your smartphone, it is now possible to control access for any application. The applications will ask you if they are allowed to use the camera:
For most modern apps, this works without any problems. But Processing is missing (currently) the correct PList entries, so MacOS will never ask you if Processing is allowed to do that. The sketch will just close and there will be an error message in the console.
The workaround for this problem is to start Processing from another application, which already contains this PList entry. For example the default MacOS terminal (console) is able to run Processing and allow it to access the camera.
Start Processing from the terminal application by copying following command into the terminal and hit enter:
/Applications/Processing.app/Contents/MacOS/Processing
Then open an example that uses the camera from the Video examples (GettingStartedCapture).
Now run the example and allow Processing to use the camera. From now on, Processing is added to the list of apps that are allowed to use the camera and you can run Processing as you are used to.
TL;DR
Install Video Library Beta Version
Disable quarantine for native library files
Allow Processing to access Webcam