GSVideo 0.7   49 comments

After more than one year in the works, the version 0.6 of GSVideo finally comes out as… 0.7! (I felt that naming the final package as 0.6 after a string of things such as 0.6-pre0, pre1, pre2, pre3, pre4 and pre5 lacked a certain sense of novelty :-) ). In any case, this release has been possible by the contributions of many users and developers, who suggested numerous improvements and pointed out bugs and errors. The package is now split according to the OS platform, click on the following links to grab the version for Linux, Mac (Snow Leopard only , sorry Leopard version still not ready) and Windows.

The release notes list all of the changes that took place since the last stable version (0.6-pre5).  With regards to the Linux and Windows versions, this release can be seen mostly as incremental one, with a number of small fixes (such as working speed() method in GSMovie) and improvements (more codecs and automatic video format detection in the GSMovieMaker).

The major “breakthrough” happened on the Mac front, where I was finally able to find a way to bundle the gstreamer binaries with the gsvideo library in such a way that there is no need of any additional installs or messing around with system environmental variables. The process I followed to compile gstreamer binaries that can be accommodated inside any OSX application is a complex one, and since it could be of help for other people out there trying to achieve a similar goal, I’ll describe it in more detail in another post.

GSVideo-ExportedApp

Figure above: GSVideo exported application working!

The downside of the Mac version is that the current package works only for Snow Leopard. I’m compiling GStreamer on a Snow Leopard machine and the resulting binaries are incompatible with older versions of OSX. This will be solved as soon as I find a way to compile GStreamer on Snow Leopard in some sort of “compatibility” mode with Leopard (but I don’t know if this exists at all), or just find a spare OSX 10.5 machine (donations are welcome :-) ).

A couple of further observations regarding the Mac version of GSVideo:

  • When running the sketches from the PDE you might get a warning message about plugins, probably something like this: (GSVideo:1026): “GStreamer-WARNING **: External plugin loader failed. This most likely means that the plugin loader helper binary was not found or could not be run.” Just ignore it, this will be hopefully removed in the next version.
  • GSVideo comes with its own gstreamer binaries (located inside <contributed libraries folder>/GSVideo/library/gstreamer/macosx, which are the ones it tries to load when gstreamer is not detected to be installed globally on the system. However, if a gstreamer distribution is found in /opt/local, then it will use it instead of the bundled one. In fact, similar thing happens in Windows.

Note that since each platform package of GSVideo only comes with the gstreamer binaries for that platform, then the exported applications will contain only one version of the gstreamer binaries. To put it in a more concrete example: say that you are using GSVideo on Mac OSX, and choose to generate an exported application for Windows. Then the exported application will contain gstreamer binaries for OSX and not for windows. So it won’t be functional on a windows machine (unless there is a global copy of gstreamer available on that machine or you manually copy the gstreamer binaries into the exported application folder).

Finally, my acknowledgment to the developers of the ossbuild, gstreamer-java, macports and gstreamer projects, which are the basis for GSVideo.

Advertisements

Posted August 22, 2010 by ac in Programming

Tagged with , , , , , ,

49 responses to “GSVideo 0.7

Subscribe to comments with RSS.

  1. hi there — thanks for your work on this project.

    i’m running/have tried 0.7 and the newer version on snow leopard (10.6.4)and getting these errors only when doing live video capture (otherwise works well):

    java[426:10603] Opening shmem segment com.allocinit.CTCtrl2
    2010-09-11 11:58:18.542 java[426:10603] Opening shmem segment com.allocinit.CTImg2.0
    2010-09-11 11:58:18.543 java[426:10603] Opening shmem segment com.allocinit.CTImg2.1
    2010-09-11 11:58:18.544 java[426:10603] *** __NSAutoreleaseNoPool(): Object 0x1f574050 of class NSCFArray autoreleased with no pool in place – just leaking
    2010-09-11 11:58:18.594 java[426:10603] *** __NSAutoreleaseNoPool(): Object 0x1f5748b0 of class NSCFNumber autoreleased with no pool in place – just leaking
    2010-09-11 11:58:18.595 java[426:10603] *** __NSAutoreleaseNoPool(): Object 0x1f5712a0 of class NSCFNumber autoreleased with no pool in place – just leaking
    2010-09-11 11:58:18.597 java[426:10603] *** __NSAutoreleaseNoPool(): Object 0xa0838810 of class NSCFBoolean autoreleased with no pool in place – just leaking

    regards,
    j

    • Hi James, what hardware are you currently using? I’m testing video capture on a macbook pro 13″ inches (also on Snow 10.6.4), and the built-in camera works fine.

      • thanks for your reply,

        i’m using a 15″ macbook pro 2.2 ghz, duo core.

        my internal isight, it turns out, is not working/recognized with any other app either since my upgrade to snow, sad to say…

        with attached external firewire camera, however, other apps (quicktime, etc.) recognize them/can use them, but processing/gsvideo returns the same ‘no pool in place – just leaking’ error.

        hmmm.

  2. For capture through a firewire camera, my guess is that you have to setup a pipeline based on the dc1394src element. Something like this:

    pipeline = new GSPipeline(this, “dc1394src port=0 ! queue ! dvdemux ! ffdec_dvvideo ! ffmpegcolorspace ! video/x-raw-yuv, width=720”);

    I do have a firewire webcam, but I’m missing the firewire 800 cable needed to plug it into the macbook, so I cannot test right now. Let me know if you have any luck with the pipeline I suggested above.

  3. gave it a try, thank you — no errors! but no image, either, just a blank canvas…

    camera is a canon hv20 that i use regularly with final cut/quicktime, etc.

  4. Sounds more encouraging. One problem in the sample code I suggested is that the dc1394src element doesn’t have a port property. You should use camera-number instead, .i.e:

    pipeline = new GSPipeline(this, “dc1394src camera-number=0 ! queue ! dvdemux ! ffdec_dvvideo ! ffmpegcolorspace ! video/x-raw-yuv, width=720″);

  5. I’ve got GSVideo 0.7 working on Snow Leopard. Unfortunately I found an earlier version (0.6) first and installed that, including the .profile mods.

    The GettingStartedCaptureMac example is working, but as soon as I uncomment the list functionality section, I get an error:

    —-

    processing.app.debug.RunnerException: IllegalArgumentException: Element does not implement interface
    at processing.app.Sketch.placeException(Sketch.java:1543)
    at processing.app.debug.Runner.findException(Runner.java:583)
    at processing.app.debug.Runner.reportException(Runner.java:558)
    at processing.app.debug.Runner.exception(Runner.java:498)
    at processing.app.debug.EventThread.exceptionEvent(EventThread.java:367)
    at processing.app.debug.EventThread.handleEvent(EventThread.java:255)
    at processing.app.debug.EventThread.run(EventThread.java:89)
    Exception in thread “Animation Thread” java.lang.IllegalArgumentException: Element does not implement interface
    at org.gstreamer.interfaces.GstInterface.(GstInterface.java:43)
    at org.gstreamer.interfaces.PropertyProbe.(PropertyProbe.java:55)
    at org.gstreamer.interfaces.PropertyProbe.wrap(PropertyProbe.java:46)
    at codeanticode.gsvideo.GSCapture.list(GSCapture.java:196)
    at codeanticode.gsvideo.GSCapture.list(GSCapture.java:189)
    at codeanticode.gsvideo.GSCapture.list(GSCapture.java:174)
    at GettingStartedCaptureMac.setup(GettingStartedCaptureMac.java:38)
    at processing.core.PApplet.handleDraw(PApplet.java:1579)
    at processing.core.PApplet.run(PApplet.java:1503)
    at java.lang.Thread.run(Thread.java:637)

    —-

    Any ideas? I’m very much interested in being able to handle multiple camera inputs in Processing, so if this worked it looks like it would be perfect.

    Thanks so much!

    • I should also mention that before installing 0.7 of GSVideo I had followed your earlier post and installed the GStreamer package from here: https://codeanticode.wordpress.com/2009/04/03/gstreamer-installer-for-macosx/. Maybe I need to uninstall this first? If so, how?

      Thanks!

      • May have found how to uninstall correctly. I removed the launchd lines as well as the /Library/GStreamer folder. Still no luck.

      • Hi, the gstreamer plugin used for capture (osxvideosrc) has a “device” parameter. However, this parameter is still not used in the GSCapture class, but you can set up a GSPipeline with the appropriate value for device:

        pipe = new GSPipeline(this, “osxvideosrc device=\”IIDC FireWire Video:0\” ! ffmpegcolorspace ! video/x-raw-rgb, width=320, height=240, bpp=32, depth=24″);
        pipe = new GSPipeline(this, “osxvideosrc device=\”USB Video Class Video:0\” ! ffmpegcolorspace ! video/x-raw-rgb, width=320, height=240, bpp=32, depth=24″);

        The device argument should indicate the Sequence Grabber input device in format sgname:input#.

  6. thanks. sorry to be dense, but what do you do with the pipe once you have it? i tried pipe.read() in draw(), as well as setting up a GSCapture var with the pipe, but neither seems to work. how to read off the pipe?

  7. Using the read() function in draw() should work. If no image is displayed, perhaps the capture device is not handing any frames… Make sure you are using the correct device strings.

  8. Marvelous work. Works just sweet and fast. Thank you very much for this fantastic contribution.

  9. While beeing successful running your library in the PDE, I have the following error inside Eclipse, my favorite IDE:

    Exception in thread “Animation Thread” java.lang.UnsatisfiedLinkError: Unable to load library ‘gstreamer-0.10’: dlopen(/pde/library/path/GSVideo/library/gstreamer/macosx/libgstreamer-0.10.dylib, 9): no suitable image found. Did find:
    /pde/library/path/GSVideo/library/gstreamer/macosx/libgstreamer-0.10.dylib: mach-o, but wrong architecture

    any idea why?

  10. In Eclipse are you using a 32 or 64 bits JDK? And what version of GSVideo are you using (32 or 64 bits)?

  11. How Do I tell? I am using the MacOS X Default JVM 1.6. (which I assume is 64bit) with Eclipse 3.6.0. And the libgstreamer-0.10.dylib the errormessage is refering to comes from the GSVideo0.7 installpackage.

  12. I got it. I didnt notice that you provided two different packages for 32 and 64bit. 64bit works now for me for eclipse.

  13. “Make sure you are using the correct device strings.”

    Do you have any way to obtain those device strings? when I use processing’s Capture.list() I get a generic list of 3 items that never changes no matter what camera I have plugged in:

    [0] “DV Video”
    [1] “IIDC FireWire Video”
    [2] “USB Video Class Video”

    I can get video from the pipe by using USB Video Class Video:0 as my sgname:input# but any other attempts I use to try and access other attached cameras result in null pointer errors.

    thx!

    • I got the names from doing gst-inspect osxvideosrc, but they seem to be the same as the ones reported by Capture.list(), with the exception of the “:0” addition.

      In your case the devices might be currently unsupported by osxvideosrc. What about if you try other indices different from 0, i.e.: “DV Video:1”, etc. Just guessing.

      BTW, I’ll try to implement the camera.list() functionality in OSX for the next version of OSX.

  14. Hi there, do recommend any HD external camera for your library?

    • Unfortunately I didn’t have the chance to test HD cameras with gsvideo yet. I guess the level of support depends on the Operating System and if the particular camera can be accessed by the firewire source plugins in gstreamer. I recommend you do some research online about gstreamer and HD capture. If you can set up a working capture pipeline from the command line using gst-launch, then it is very likely you can run this pipeline from GSVideo. This thread in the old Processing forum might be of help.

  15. Thanks for a great library.

    Is it not possible to continuosly change the playback rate of a video file in GSMovie?

    • Thanks. It seems that calling the speed method continuously (for example in the draw mode) doesn’t work well, I tried and the movie starts to stutter. You an call it from time to time ,though, for instance when you click the mouse:

      import codeanticode.gsvideo.*;
      GSMovie myMovie;

      void setup() {
      size(640, 480, P3D);
      background(0);
      myMovie = new GSMovie(this, “station.mov”);
      myMovie.loop();
      }

      void movieEvent(GSMovie myMovie) {
      myMovie.read();
      }

      void draw() {
      if (1 < myMovie.width && 1 < myMovie.height) {
      image(myMovie, 0, 0, width, height);
      }
      }

      void mousePressed() {
      myMovie.speed(map(mouseX, 0, width, 1, 4));
      }

      • Thats a real shame, because scrubbing and non-linear timeindex with noise streams etc is when controlling video from code gets interesting. Essential , I would say…

      • I agree that having this feature working properly would be good. What I can do for now is to add an entry in the bug tracker of gsvideo. I will try to fix for the next release of the library.

  16. Hi Andrés:
    Just FYI:

    I was trying to figure out versions issues:

    In Mac OSX 10.6
    Java 1.6
    processing 1.2.1
    Eclipse Helios

    + version GSVideo 32 bits

    in PDE: runs ok (ascii example)
    in Eclipse: using -d32 vm param, runs slow, otherwise, no match architecture error…(what I think is correct)

    + version GSVideo 64 bits

    in PDE: no match architecture error..
    in Eclipse: (GSVideo:830): GStreamer-WARNING **: External plugin loader failed. bla bla… (what means GStremer is found ok) but:
    Exception in thread “Animation Thread” java.lang.IllegalArgumentException: No such Gstreamer factory: osxvideosrc

    abrazo !
    DX

    • GSVideo 64 bits on OSX doesn’t have capture because the osxvideosrc plugin that gstreamer uses to access the cameras under OSX doesn’t work on 64 bits yet.

      What happens with GSVideo 32 bits in Eclipse if you switch to a 32 bits JVM?

      • It runs but extremely low frame rate.
        Weird because runs perfect launching from pde.
        ¿Witch is your point of view regarding using 32 or 64 bits versions?
        I must switch the whole platform ASAP to 64, is’n it? I mean, OS, java 1.6 + 64 bits libraries
        Or should I stuck in 32 for a while more..?
        regards !
        thx
        DX

      • Things are a little rough with the ongoing 32 to 64 bits transition (happening on Windows too). Although 64 bits CPUs were available since several years ago, only now the OS, applications, development environments, etc are really moving over.

        Not sure what to recommend at this point, maybe is good idea to take this discussion to the forum.

  17. Is there a preferred codec for GSVideo? i.e Does one compression type perform better than others?

    • It really depends on which gstreamer plugins are available under the platform you are running (Linux, Mac, Windows), since GSVideo is, ultimately, just a wrapper that internally calls gstreamer functions.

      In general, open source codecs (theora, xvid for instance) tend to work better. However, support for playback is very good at this point so you should be able to play a variety of formats without much trouble. For movie recording (i.e.: using the GSMoviemaker class) the situation is not as good, and my experience is that theora and xvid are best, followed by dirac and x264 (an open source implementation of h264).

      • Thanks for the informative response ac. I’m running Mac OS X 10.6.4 and want to play a large amount of videos (basically whatever the machine can handle), so every edge I can get would be ideal.

        On a somewhat related note — I recently tried to move this project from the PDE to Eclipse because of VM management. I get the same error as t0gg1e4u. I tried imported both the 0.7 SnowLeopard version as well as the 0.7 SnowLeopard-64. While those seemed to solve t0ggle’s problem I still get the error.

        I’m running Eclipse 3.6 with JRE System Library [JavaSE-1.6] • Any advice?

      • Sorry, when I say “I Tried both” I really mean I tried one version then deleted and tried the other one.

  18. ugh, sorry. I hate to spam, but thought I should include the error for the sake of completeness:

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

    • Ok, so this is a different problem: GSVideo doesn’t know where to look for the gstreamer library files.

      So you are forgetting to set something in the properties of your Eclipse project. Let me check my own config on OSX and will comment back on this.

      • Thanks for the quick response AC! Given what you said, I feel like I need to reference my Eclipse project with this folder “GSViedeo/library/gstreamer”. Does gstreamer-java.jar reference the files in that folder?

      • ! ! !

        That was it. I just had to include the “GSVideo/library/gstreamer” folder. Thanks for the tip

  19. Hey andres, I posted this on the Contributed Libraries Section of the Processing Forum, but didn’t get a response so I thought I’d go straight to the source.

    I noticed in the reference a method called `setEventHandlerObject`. Is this method just for interfacing with the public method `movieEvent` or can you make your own hooks? Are there any examples of how to use `setEventHandlerObject`? I’d love to be able to make events like `movieLoaded`.

  20. Can you stream / buffer a video into memory with GSVideo?

    • I don’t think is possible using the standard classes GSMovie, GSPlayer, or GSPipeline. If you go down to the level of the java bindings , I think you could extract the video frames from the pipeline and buffer them into memory… but not sure if this is what you have in mind though.

  21. hi,

    i’m trying to run the library in processing, in mac os 10.6. when i just pasted the downloaded gsvideo files in processing library folders, i got an error of a missing library, so i figured i had to install the gstreamer libs first. so i’ve installed the gstreamer through macports, and now i’m getting this in the processing output:

    processing.app.debug.RunnerException: UnsatisfiedLinkError: Unable to load library ‘gstreamer-0.10’: dlopen(/opt/local/lib/libgstreamer-0.10.dylib, 9): no suitable image found. Did find:
    /opt/local/lib/libgstreamer-0.10.dylib: mach-o, but wrong architecture
    at processing.app.Sketch.placeException(Sketch.java:1543)
    at processing.app.debug.Runner.findException(Runner.java:583)
    at processing.app.debug.Runner.reportException(Runner.java:558)
    at processing.app.debug.Runner.exception(Runner.java:498)
    at processing.app.debug.EventThread.exceptionEvent(EventThread.java:367)
    at processing.app.debug.EventThread.handleEvent(EventThread.java:255)
    at processing.app.debug.EventThread.run(EventThread.java:89)
    Exception in thread “Animation Thread” java.lang.UnsatisfiedLinkError: Unable to load library ‘gstreamer-0.10’: dlopen(/opt/local/lib/libgstreamer-0.10.dylib, 9): no suitable image found. Did find:
    /opt/local/lib/libgstreamer-0.10.dylib: mach-o, but wrong architecture
    at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:163)
    at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:236)
    at com.sun.jna.Library$Handler.(Library.java:140)
    at com.sun.jna.Native.loadLibrary(Native.java:379)
    at org.gstreamer.lowlevel.GNative.loadNativeLibrary(GNative.java:48)
    at org.gstreamer.lowlevel.GNative.loadLibrary(GNative.java:45)
    at org.gstreamer.lowlevel.GstNative.load(GstNative.java:42)
    at org.gstreamer.lowlevel.GstNative.load(GstNative.java:39)
    at org.gstreamer.Gst.(Gst.java:59)
    at codeanticode.gsvideo.GSVideo.init(GSVideo.java:98)
    at codeanticode.gsvideo.GSMovie.(GSMovie.java:88)
    at codeanticode.gsvideo.GSMovie.(GSMovie.java:65)
    at Loop.setup(Loop.java:48)
    at processing.core.PApplet.handleDraw(PApplet.java:1583)
    at processing.core.PApplet.run(PApplet.java:1503)
    at java.lang.Thread.run(Thread.java:680)

    it says something about a ‘wrong architecture’. can you help me with this? thanks!

    • There are many things to consider when you generate your own gstreamer binaries with macports. It is kind of tricky, first of all you need to make sure that you are using i386 (i.e.: 32 bits) as the cpu architecture, otherwise they won’t work from the PDE.

      In any case, I just uploaded a new (test) release of GSVideo that includes updated gstreamer libraries, 20110203:

      http://sourceforge.net/projects/gsvideo/files/gsvideo/test/

      I’d recommend you to download and install the GSVideo-20110203-snowleopard32.zip package.

  22. thanks, downloaded the latest version of the library and now the examples are working. but i still get this error:
    _____________________________

    GSVideo VERSION: 20110203

    (GSVideo:593): GStreamer-WARNING **: Failed to load plugin ‘/opt/local/lib/gstreamer-0.10/libgstcoreelements.so’: dlopen(/opt/local/lib/gstreamer-0.10/libgstcoreelements.so, 2): no suitable image found. Did find:
    /opt/local/lib/gstreamer-0.10/libgstcoreelements.so: mach-o, but wrong architecture

    (GSVideo:593): GStreamer-WARNING **: Failed to load plugin ‘/opt/local/lib/gstreamer-0.10/libgstcoreindexers.so’: dlopen(/opt/local/lib/gstreamer-0.10/libgstcoreindexers.so, 2): no suitable image found. Did find:
    /opt/local/lib/gstreamer-0.10/libgstcoreindexers.so: mach-o, but wrong architecture
    ____________________________

    it seems that i have installed the gstreamer libraries of a wrong architecture. i’ve followed the instructions in this site:

    http://gstreamer.darwinports.com/

    will i have trouble if i leave this as it is or should i try to rebuild gstreamer?

    thanks!

    • First comment: you should use macports instead of darwin ports. I think darwin ports is not updated any longer.

      Also, if you are using Snow Leopard 64 bits, you should tell macports to explicitly use i386 as the cpu architecture, otherwise the generated gstreamer libraries won’t work from the PDE.

      Please keep in mind that I included gstreamer binaries for 32 bits in this package of gsvideo. Are you able to use it from Eclipse?

  23. hello,
    I’m trying to open /dev/video2, which is a vloopback device created with webcamstudio.
    I do: cam=new GSCapture(this,width,height,”/dev/video2″);
    but I get “libv4l2: error getting capabilities: Inappropriate ioctl for device”
    how can I open this /dev/video2 ?
    (in other programs such as pd/Gem i’m able to read /dev/video2 )
    thanks,
    Tim

    • You could try to use the v4lsrc source element. By default, gsvideo relies on v4l2src, but sometimes the older v4l plugin recognizes devices that don’t work with v4l2.

      cam=new GSCapture(this,width,height,”v4lsrc”, ”/dev/video2″);

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

%d bloggers like this: