Description
I wanted to use the video library outside the pde and the process to get it working was far from easy.
In this case i'm using VSCode.
I bundle the video library with the project.
From the Video.java source:
// The video library loads the GStreamer libraries according to the following
// priority:
// 1) If the VM argument "gstreamer.library.path" exists, it will use it as the
// root location of the libraries. This is typically the case when running
// the library from Eclipse.
// 2) If the environmental variable is GSTREAMER_1_0_ROOT_(MINGW/MSVC)_64 is defined then
// will try to use its contents as the root path of the system install of GStreamer.
// 3) The bundled version of GStreamer will be used, if present.
// 4) If none of the above works, then will try to use default install locations of GStreamer
// on Windows and Mac, if they exist.
// In this way, priority is given to the system installation of GStreamer only if set in the
// environmental variables, otherwise will try to load the bundled GStreamer, and if it does not
// exist it will look for GStreamer in the system-wide locations. This gives the user the option
// to remove the bundled GStreamer libs to default to the system-wide installation.
vmArgs ❌
In launch.json:
"vmArgs": [
"-Dgstreamer.library.path=${workspaceFolder}/lib/video/library/windows-amd64",
"-Dgstreamer.plugin.path=${workspaceFolder}/lib/video/library/windows-amd64/gstreamer-1.0"
]
This gives:
Seems like you are trying to use GStreamer native libraries older than 1.20, which are not supported.
Processing video library using bundled GStreamer 1.20.3
Scanning GStreamer plugins...
(Processing core video:12380): GStreamer-WARNING **: 12:12:29.229: Failed to load plugin 'C:/Users/clank/Desktop/03 - ACTIVE_PROJECTS/25 - Room-Activity/lib/video/library/windows-amd64/gstreamer-1.0\gstaccurip.dll': The specified module could not be found.
This usually means Windows was unable to find a DLL dependency of the plugin. Please check that PATH is correct.
You can run 'dumpbin -dependents' (provided by the Visual Studio developer prompt) to list the DLL deps of any DLL.
There are also some third-party GUIs to list and debug DLL dependencies recursively.
And the DLL errors keep coming. The dll's all exists. I also tried backslashes etc.
This actually seems more like a gstreamer bug to me.
In the end you get a java.lang.IllegalArgumentException: No such Gstreamer factory: playbin
(I'm not a big fan of this anyway cause it requires the user to change the vmArgs depending on the OS).
2. java.library.path
I think this is the easiest way to get the video library working outside the pde:
public void setup() {
if (PApplet.platform == MACOS) {
}
else if (PApplet.platform == LINUX) {
}
else if (PApplet.platform == WINDOWS) {
System.setProperty("java.library.path", System.getProperty("java.library.path")+";"+sketchPath()+"/lib/video/library/windows-amd64");
}
else {
throw new RuntimeException("Unsupported platform");
}
// now load a movie...
}
Then everything works. I didn't fill in the path for MACOS and LINUX yet cause I didn't test yet on those machines and I didn't want to make assumptions that it works there as well.