Loading...
Logo
Processing Forum
Hi,

I am trying to find a solution for playing back 3 videoclips at the same time in processing. But it seems to be a VERY difficult thing to do. Nevertheless, I couldn't find too much about this in the forums what suprise me a bit or is it that everbody knows already that this is impossible?

If I use the quicktime library in processing, it runs fine for about two or three minutes, then I get this OutOfMemoryError:

Copy code

  1. # java.lang.OutOfMemoryError: requested 1658880 bytes for jint in C:\BUILD_AREA\jdk6_24\hotspot\src\share\vm\prims\jni.cpp. Out of swap space?
    #
    #  Internal Error (allocation.inline.hpp:39), pid=860, tid=2620
    #  Error: jint in C:\BUILD_AREA\jdk6_24\hotspot\src\share\vm\prims\jni.cpp
    #
    # JRE version: 6.0_24-b07
    # Java VM: Java HotSpot(TM) Client VM (19.1-b02 mixed mode windows-x86 )
    # An error report file with more information is saved as:
    # E:\processing15\hs_err_pid860.log
    #
    # If you would like to submit a bug report, please visit:
    #   http://java.sun.com/webapps/bugreport/crash.jsp
    #
    java.lang.OutOfMemoryError

I did found some forum posts related to this, but the only solution I found was to allocate less memory for processing within the preferences. But the only thing which changes is the content of the error message:

Copy code
  1. # A fatal error has been detected by the Java Runtime Environment:
    #
    #  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x66809196, pid=1696, tid=2332
    #
    # JRE version: 6.0_24-b07
    # Java VM: Java HotSpot(TM) Client VM (19.1-b02 mixed mode windows-x86 )
    # Problematic frame:
    # C  [QuickTime.qts+0x9196]
    #
    # An error report file with more information is saved as:
    # E:\processing15\hs_err_pid1696.log
    #
    # If you would like to submit a bug report, please visit:
    #   http://java.sun.com/webapps/bugreport/crash.jsp
    # The crash happened outside the Java Virtual Machine in native code.
    # See problematic frame for where to report the bug.
    #
These error messages are from a Windows XP system, but I also tried on Windows 7 64-bit, which doesn't seem to make a difference. I would be also ok to make it work on a macbook. But on the macbook there seems another problem. Even the loop example from processing crashes due to some problem with the quicktime library.

So I wonder, is there anybody out there who successfully played back more than one videoclip at a time with processing?
I also tried the GSvideo library, but when loading more than one clip, simply nothing showed up on the screen.

The code I'm trying to run at the moment, is as simple as this:
Copy code

  1. import processing.video.*;


    Movie screenA, screenB, screenC; // the three movies



    // SETUP :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    void setup(){
      size(2160,480, P3D);
      frameRate(20);
      //xmlGetter = new XMLGetter( this );
     
     screenA  = new Movie(this, "clipsjpg//0002.mov");
     screenB  = new Movie(this, "clipsjpg//0003.mov");
     screenC  = new Movie(this, "clipsjpg//0004.mov");
     screenA.loop();
     screenB.loop();
     screenC.loop();
     cm = new ClipManager[3];
     cm[0] = new ClipManager( this,524 );
     cm[1] = new ClipManager( this,524 );
     cm[2] = new ClipManager( this,524 );
     xmlpro = new XMLProcessor(this, "cliplist_meta.xml");
     
     
    }// -------------------------------------------------------------------------


    void draw(){
     
      background(0);
     
       
        if(screenA.available()){
            screenA.read();
            image(screenA, 0, 0);
        }
           
        if(screenB.available()){
            screenB.read();
            image(screenB, 720, 0);
        }
      
        if(screenC.available()){
            screenC.read();
            image(screenC, 1440, 0);
        }
       
    }// -------------------------------------------



P.S.
Usually I try to avoid the video libraries, by creating JPG sequences of all videofiles and loading and displaying PImages instead (which works fine), but this time I also need the sound of the videoclips.

Replies(7)

> t he only solution I found was to allocate less memory

less memory?   not more memory?

If the three clips are always played side by side, how about combining them into a single clip, using video editing software?  this would likely be less of a strain on the system...
yes, there is some funny stuff with the heap. so in some cases it shall actually help to decrease the size rather than increasing. Maybe it's related to the garbage collector, which would start cleaning much later, if there is more space available? Not sure. However, it didn't help in my case.
The clips I'm playing are just a few MB big, so it's also not really logical that i run out of memory, when using 1.5 gb ram.

Regarding merging the clips into one, that should in fact help. I guess I should have mentioned that, what I actually want to do is a bit more than just looping three clips. I'm having a folder with 500 video clips, from which I pick three at a time based on some metadata rules combined with some random generator. Whenever one clip ends a new one will be loaded for that position.

If there wasn't that random component, editing would be in fact the best solution.
hmm ... not much response. Can at least somebody let me know, if everybody agrees that processing is not suitable for playing back several videos at a time?
What about trying to code it on Processing 2 (alpha 4, now)?
I've been getting great results on video performance with it's gsvideo library.
Were you playing back more than one video at a time with it? Please let me know, then I will try that.
I did try the GSLibrary with processing 1.5.1, but wasn't able to create more than one video object. When I did, nothing showed up.

Right now, i've found a half working solution with the JMF. It comes without memory leaks and also the playback speed seems more accurate. The only downside, that library only supports codecs from the stoneage. There are codec packs available (such as FOBS), but I couldn't get them to work so far.

However, I'm happy if there is any easier solution.
Yes, I'm playing 4 video files at once.
alexandre can you post your code on how your playing 4 videos at once using GSvideo.