A couple of GSVideo tips   13 comments

GSVideo is a Processing library I have been working on for almost four years now (!). It improves video support in Processing by using GStreamer as the underlying multimedia toolkit. The latest release is 1.0.0 and it should be used exclusively with Processing 1.x (the alpha releases of Processing 2.0 already include a simplified version of GSVideo as the built-in video library). Two problems users typically face with GSVideo and about which I receive emails from time to time, are (1) using GSVideo in Eclipse, and (2) exporting GSVideo applications from the Processing environment. So I put together in this post a couple of tips that might be useful in these situations.

GSVideo in Eclipse

The main difficult here is to tell GSVideo where to look for the GStreamer native library files. This is an issue only on Windows and OSX, since GStreamer often comes pre-installed in Linux and can be easily accessed by any application. The recommended thing to do in this case is to copy the gsvideo jar files and the gstreamer library files into a folder inside the Eclipse project, which is libs in the example below:

These files are included in the GSVideo zip package, in the library subfolder. Once copied inside the Eclipse project, the jars need to be added into the build path, along with the core.jar and any other jars used by the application. A sample Eclipse project configured in this way is available here as a zip file, and already comes with the gstreamer native libraries for OSX.

Exporting GSVideo applications

When exporting from the PDE sketches that use GSVideo, the resulting applications won’t work because Processing (1.5) won’t copy the required GStreamer native libraries into the application folder. Again, this is a problem only on Windows and OSX, since on Linux the exported application will be able to use the system copy of GStreamer. The solution is to copy the GStreamer files manually, from the library location into the application folder.

For Windows:

On OSX, the package contents needs to be opened first with Finder, and the navigate to Contents/Resources/Java, where the gstreamer folder from GSVideo/library should be copied into:

Copying data files

If the GSVideo application uses video files for playback, then they need to be manually copied to a new data folder inside the exported application folder. The reason for this is that GSVideo cannot load the video files that are automatically placed by Processing inside the application’s jar file in the lib folder.

Some further discussion about these issue in the Processing forum.

About these ads

Posted February 23, 2012 by ac in Programming

Tagged with , , ,

13 responses to “A couple of GSVideo tips

Subscribe to comments with RSS.

  1. Thanks a lot! This is great stuff, and very useful. If possible could you look at my update on StackOverflow? http://stackoverflow.com/questions/19451315/trouble-advancing-and-redrawing-mpeg2-frames-processing2-gsvideo1-0-osx10-8-5 ?

    I have a gst-launch pipeline that works on Ubuntu, but I cannot seem to get GSPipeline show anything but a gray box. Also I don’t know how to run gst-launch on OSX given it’s only installed in the local folder according to these instruction, and does not seem to have any of the plugins.

    Cheers!

  2. Hi , thanks for these great libraries . I’m new to processing and trying to do a project with GSvideo . I was trying to play a video with alpha channels which finally I succeeded! :) but the next step in my project is I want to show the webcam feed behind the video with alpha channels. the problem I’m facing now is that when I use GLGRAPHICS in my size() function the webcam feed framerate drops significantly . I researched and there was only one answer to add hint(ENABLE_OPENGL_4X_SMOOTH) after my size() function , which didn’t help. I’ll appreciate if you can help me with this.
    thanks so much

  3. Hi, I’m trying to make an application that exports a video with the help of GSVideo when you run it.
    Whenever I export a jar I get an exception when I run it though:

    “Exception in thread “Animation Thread” java.lang.UnsatisfiedLinkError: Unable to load library ‘gstreamer-0.10′: dlopen(libgstreamer-0.10.dylib, 9): image not found”

    I tried it with the method described here, I tried the preconfigured Eclipse project, but no luck.
    I am working on OS X 10.9.

    Any help would be much appreciated!

    • Hi, can you run the project from Eclipse? For the exported jar, one alternative could be to put the gstreamer libs in some hard-coded location (say /home/user/libs/gstreamer) and then set that location inside the app with the GSVideo.localGStreamerPath variable (see comment in the setup() method of the sample project).

  4. GSVIDEO GLGRAPHICS OPENGL MOVIEFILTERS ECLIPSE

    Hi,

    Thank you so much for your great work. I have used your library extensively. Recently, however, I am repeatedly running into problems (related with my transition to Eclipse). I hope you could help.

    I have reduced my problems to one simple task (demonstration). I am trying to run the MovieFilters example through Eclipse. The example works for me with Processing 1.5 (it doesnt with Processing 2.0+, but at this point I do not care).

    The code compiles in Eclipse. It loads all the shaders but then gets stuck on the gray background window (no frames get rendered). It hangs like this; no error pops up. The last console message reads “Validation successful” for the Invert.glsl shader.

    I get exactly the same console output in Processing 1.5 but the movie actually plays and the app works…

    To ascertain that I am using exactly the same build path as the Processing-engine-run version I have exported the .pde and linked the eclipse project to the resources within that folder. (both instances use 1.7.0_17 java ; I am on win 7; x64)

    I will appreciate any help or tip.

    Thank you,

    • Hello, first of all, can you run simple movie playback examples from within Eclipse?

      • Thank you for the reply,

        All in all the problem was that my GSCapture and GSMovie event handling methods were not public. Little thing but hard to find (in all the other cases eclipse warned me against such scope problems – shouldn’t have gotten used to its watchful eye)…so the problem is solved. : )

        On a more general note:

        1.
        I am using your library as a way to get to great graphics features as well as an overall accelerator in any Image processing tasks.
        I read in one of your responses to another user that because of the particular way he was using it – he would not have gotten any speed out of your objects. Could you explain, or refer me to a source that would help me judge when the acceleration would be actual? If I want to access the textures on a pixel by pixel level should I stick with simple PImage? what about in case of BlobDetection?

        2.
        Finally, do you have any tips for making the GLGraphics GSVideo work with Processing 2.x ? I know many people who stuck with 1.5 because of being frustrated by this. With the MovieFilters example I get an exception by the size(640, 480, GLConstants.GLGRAPHICS); statement.

        Thank you again.

      • Hello, that’s right, the methods need to be public otherwise they cannot be found by introspection. The PDE’s parser adds the public keyword automatically. I had this problem in the past before when porting video code to Eclipse, but forgot about it.

        About making GSVideo and GLGraphics to work with Processing 2.x: GSVideo should work, but the default video library in Processing 2.x is in fact based on GSVideo, and it includes the GL-accelerated “tricks” from GSVideo/GLGraphics when you use either the P2D or P3D renderers, which are the new OpenGL renderers in 2.x. Most of the functionality of GLGraphics (for instance shaders) was also ported into the P2D/P3D renderers, so there shouldn’t be a need for a GLGraphics library for Processing 2.x. What I could provide is a series of examples showing how to port GLGraphics-based sketches to Processing 2.x

      • Great,

        So you are saying that all (…most) of the functionality I could wish for from your libraries is now part of the 2.x package? (PImage is as good as GLTexture was? – are there new classes or the old classes got ‘stronger’ by default?) Has the scope of your documentation been incorporated into the Processing.org?

        Yes, an example of how to translate what were previously GSVideo GLGraphics calls from your examples into the 2.x syntax would be very useful (1 or 2). Your examples have not by any chance been rewritten into the 2.x and do not ship with it, right?

        Thank you again! – it’s becoming clearer.

      • That’s right, most of the functionality in GLGraphics/GSVideo is included in the core OpenGL library (with either of its renderers, P2D or P3D) and the core video library, with some important exceptions, for instance there is no class that explicitly reproduces the functionality in GLTextureFilter, but you can put together your own filter by combining PGraphics, PImage and PShader. I ported three texture examples in GLGraphics 1.0.0 to work in Processing 2.x (more specifically, with 2.2.1) as a demonstration of how you could do that, you can try the out by downloading this zip package. In order to have GL-accelerated movie playback or video capture, you don’t need to do anything special (i.e. the setPixelDest() thingy in GSVideo), as that integration happens automatically behind the scenes when you use any of the GL-based renderers. Time permitting, I will try to write a more blog post detailing how to transition from Processing 1.x/GLGraphics/GSVideo to Processing 2.x+

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 61 other followers

%d bloggers like this: