Skip to content
Alex Stamm edited this page Jul 31, 2019 · 43 revisions

Introduction

In Processing 2.0, we've made the switch to a GStreamer-based video library (excising the Apple horror show that was QuickTime for Java). There are many tales to tell of the quirky and unique beast that is GStreamer, and this document seeks to tell them.

The video library relies on the gstreamer-java bindings to talk to the native GStreamer libraries. The 1.x branch of the video library used the gstreamer-java bindings that were compatible only with the 0.10 version of GStreamer, which is no longer developed. Version 2.0 of the video library uses the new gst1-java-core bindings, derived from the original gstreamer-java bindings, but now compatible with the latest stable version of GStreamer (1.8.x or newer).

Development Environment

The source code of the video library includes an Eclipse project so the development can be carried out within that IDE, but other environments, such as IntelliJ, should work as well. Details on how to setup the development environment using Eclipse are provided in this page.

Building the library from source

The easies approach to build the library from source and use it from the PDE is to clone this repo inside the sketchbook's library folder inside the video subfolder (otherwise Processing won't pick the library up):

git clone [email protected]:processing/processing-video.git video

then edit the build.properties file so the variables core.classpath.location and compiler.classpath.location point to the right locations in your local copy of the main processing repo.

After that, you should be able to change into the library's folder and simply build the library using ant:

cd video
ant build

which will generate the video.jar file inside library. Processing should be able recognize the new build after restarting the PDE.

Bundling GStreamer with the video library

The GStreamer maintainers provide packages of the latest stable version of the 1.x branch for various platforms, including Mac and Windows. Most Linux distributions include the latest GStreamer libraries by default. These packages can be downloaded from here. This page from GStreamer's documentation includes useful, up-to-date information on how to deploy GStreamer across different platforms. Even though these deployment guidelines recommend to use a system-wide install of GStreamer, the video library bundles the GStreamer libraries for macOS and Windows. This makes the library package fairly large, but the advantage is that there is no need to install GStreamer separately.

In order to bundle the GStreamer libraries when creating a distribution package of the video library, a few utility scripts are included in the repo, that should be run before running ant on Windows and Mac separately:

MacOS

First, install the latest GStreamer runtime package for MacOS on your development machine, which can be downloaded from here. Then, change into the scripts folder and run the pack_macosx_libs.sh script:

cd scripts
./pack_macosx_libs.sh

This should generate a maxosx64 folder inside library containing all the GStreamer native libraries for Mac. The ant build script will include them into the video.zip package when running the dist target.

Windows

First, install the latest GStreamer runtime and development package for your Windows version (x32 or x64), which can be downloaded from here. Run both installs as COMPLETE. Then, change into the scripts folder and run the pack_windows_libs.bat script:

cd scripts
pack_windows_libs.bat

This should generate a windows(32/64) folder inside the library containing all the GStreamer native libraries necessary for windows development. The ant build script will include them into the video.zip package when running the dist target.

Using a system-wide install of GStreamer

As long as a recent release of GStreamer is installed on the system, and the GST environmental variables are properly set, then Processing should be able to use the system-wide GStreamer libraries, making the bundled ones unnecessary, in case you need to remove them to save space.

Versions of the video library

Video 2.x

Thanks to Gottfried Haider and the development team behind gstreamer-java, we were finally able to update the video library to use GStreamer 1.0. The 2.0-beta releases (not yet available in the Contributions Manager) are the first result of that work. There are still issues to be dealt with, see this discussion in the Pull Request that incorporated the update: https://github.com/processing/processing-video/pull/84

The 2.0 milestone lists some of the issues that should be addressed towards the stable release of the 2.0 version of the video library.

In general, the top priorities would be to ensure that camera capture is well supported by the 2.0 stable release, since that's a very important use of the library, and that direct buffer to opengl texture functionality is re-implemented in 2.0.

Video 1.x

The 1.x branch of the video library is no longer maintained. We are currently working to make the 2.0 beta branch the new default release of the library through the Contributions Manager in the PDE. Some old notes regarding the 1.x are available here as an archived reference.

Clone this wiki locally