<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
      <title>Tagged with movieevent() - Processing 2.x and 3.x Forum</title>
      <link>https://forum.processing.org/two/discussions/tagged/p3/feed.rss?Tag=movieevent%28%29</link>
      <pubDate>Sun, 08 Aug 2021 19:09:05 +0000</pubDate>
         <description>Tagged with movieevent() - Processing 2.x and 3.x Forum</description>
   <language>en-CA</language>
   <atom:link href="/two/discussions/taggedmovieevent%28%29/feed.rss" rel="self" type="application/rss+xml" />
   <item>
      <title>Video 1.0.1 - Read a frame from a paused video?</title>
      <link>https://forum.processing.org/two/discussion/20383/video-1-0-1-read-a-frame-from-a-paused-video</link>
      <pubDate>Fri, 20 Jan 2017 20:37:56 +0000</pubDate>
      <dc:creator>Krystman</dc:creator>
      <guid isPermaLink="false">20383@/two/discussions</guid>
      <description><![CDATA[<p>I'm using Processing to make a small app. I want to display and edit text overlays on top of a video file - similar to subtitles. For that, I want to be able to jump a paused video to a specific timecode and display the video frame at that time. Unfortunately, this doesn't seem to work.</p>

<p>So if I make something like this:</p>

<p><code>movie.pause();
movie.jump(30);
movie.read();</code></p>

<p>The video will NOT show the frame at second 30, but whatever frame was on the screen before the jump. If I jump around in the video the same frame keeps being displayed until I hit play.</p>

<p>Is there a workaround for this?</p>
]]></description>
   </item>
   <item>
      <title>Triggering multiple videos / stuttering / poor performance</title>
      <link>https://forum.processing.org/two/discussion/20512/triggering-multiple-videos-stuttering-poor-performance</link>
      <pubDate>Sat, 28 Jan 2017 13:51:23 +0000</pubDate>
      <dc:creator>jules11</dc:creator>
      <guid isPermaLink="false">20512@/two/discussions</guid>
      <description><![CDATA[<p>Bonjour lovely knowledgeable people,</p>

<p>I have a little problem with playing back videos in processing. The aim is to trigger the videos via an serial port input which works fine. The problem is that the videos are played back very laggy. I assume its because they are somehow all played back in the background. The videos are very short 2-5 seconds, but are in HD (1920x1080) and .H264 coded. They are supposed to be played back as long as the input signal is there, and fade to black when its gone.  Can you please help me figure out how to avoid this problem and achieve fluid playback of the videos? That would be superb! I Have been hammering over this code for a while and I cant figure it out. Annnd, do you have any idea how to implement fading in and fading out of the videos? Tried it with tint, but can not manage it to do it fast enough. You would be a life saver! Merci, merci bien — any help is appreciated!</p>

<p>Love ❤️ jules</p>

<pre><code>import processing.video.*;
import processing.serial.*;

Movie[]  movie = new Movie[10]; 
float[] myArray = new float[10];
short videoSpeed= 0 ; 
PImage bg;
PImage logo;
short videoID = 9; 

String[] video ={ "modellblinker1.mp4", 
          "modellblinker2.mp4",
          "modellhood.mp4",
          "modellside2.mp4",
          "modellside1.mp4",
          "modellwindshieldsback.mp4",
          "modellTrunk.mp4",
          "modellwindshieldsback.mp4",
          "modellroof.mp4"};



void setup() {
  fullScreen();
  iniMovies();
  imageMode(CENTER);
  frameRate(25);
  bg = loadImage("1.jpg");
  logo = loadImage("m.png");
  println(Serial.list()[0]);
  myPort = new Serial(this, Serial.list()[0], 19200);
  myPort.bufferUntil('\n');


}
void draw() {
  background(0);
  iniMovies();
  mngMovie();

 if( videoID ==9 ){


    image(logo,-57,-57);//, displayWidth/2, displayHeight/2);

  }else{
    image(movie[videoID], displayWidth / 2, displayHeight / 2);
    if (videoID != 9)
       movie[videoID].loop();
  }
}
void movieEvent(Movie m) {
  m.read();
}
void iniMovies(){
   for (int i = 0 ; i&lt; 9;i++){
       movie[i] =  new Movie(this,video[i]);
   }
}  
void mngMovie(){
 // print(myArray);

 if(  myArray[0] &gt;2000.0 ) {  /// blinker link 
   if ( videoID != 0  &amp;&amp; videoID!=9 )      
     movie[videoID].stop();
    movie[0].play();
    videoID = 0; 
 }
 else if(  myArray[1]&gt;-4000.0 ) {  // blinker recht 
   if ( videoID != 1 &amp;&amp; videoID!=9 )      
     movie[videoID].stop();
    movie[1].play();
    videoID = 1; 
 }

 else if(  myArray[2] &lt;-25000.0  || myArray[2] &gt;17000.0  ) {  //  motor 
   if ( videoID != 2  &amp;&amp; videoID!=9)      
     movie[videoID].stop();
    movie[2].play();
    videoID = 2; 
 }

 else if(  myArray[3] &gt;5000.0 ) {  // Tür recht 
   if ( videoID != 3 &amp;&amp; videoID!=9)      
     movie[videoID].stop();
    movie[3].play();
    videoID = 3; 
 }

 else if(  myArray[4] &gt;20000.0 ) {  // Tür links 
   if ( videoID != 4 &amp;&amp; videoID!=9 )      
     movie[videoID].stop();
    movie[4].play();
    videoID = 4; 
 }

 else if(  myArray[5]&gt;20000.0 || myArray[5]&lt;-25000.0) {   // Windschutz 
   if ( videoID != 5 &amp;&amp; videoID!=9 )      
     movie[videoID].stop();
    movie[5].play();
    videoID = 5; 
 }

 else if(  myArray[6] &gt;3000.0 ) { // coffer
   if ( videoID != 6  &amp;&amp; videoID!=9)      
     movie[videoID].stop();
    movie[6].play();
    videoID = 6; 
 }
 else if(  myArray[7] &gt;22000.0|| myArray[7]&lt;-22000.0 ) {  // Fenester hinten
   if ( videoID != 7 &amp;&amp; videoID!=9)      
     movie[videoID].stop();
    movie[7].play();
    videoID = 7; 
 }
 else if(  myArray[8]&lt;-22000.0 ) {  // Dach 
   if ( videoID != 8 &amp;&amp; videoID!=9  )      
     movie[videoID].stop();
    movie[8].play();
    videoID = 8; 
 }

 else {
   if( videoID != 9) 
       movie[videoID].stop();
  videoID=9;
 }
}
void serialEvent(Serial myPort) {
 // get the ASCII string:
 String inString = myPort.readStringUntil('\n');
 if (inString != null) {
 // trim off any whitespace:
 inString = trim(inString);
 // split the string on the commas and convert the
 // resulting substrings into an integer array:
 try{
  myArray =  float(split(inString, ";"));
  mngMovie();
   for (int i = 0 ; i&lt; 9 ; i++){
     print(myArray[i]); 
     print(";");
   }
  println(videoID);
 }
 catch(Exception e){
       // println("Error parsing:");
     //      for (int i = 0 ; i&lt; 9 ; i++){
  //   print(myArray[i]); 
  //  print(";");
  // }
   println();
  //println(videoID);
   //     e.printStackTrace();
    }
 }
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>manipulate consecutive videos</title>
      <link>https://forum.processing.org/two/discussion/20237/manipulate-consecutive-videos</link>
      <pubDate>Fri, 13 Jan 2017 16:35:41 +0000</pubDate>
      <dc:creator>iLegendX</dc:creator>
      <guid isPermaLink="false">20237@/two/discussions</guid>
      <description><![CDATA[<p>Hi. I am trying to write a sketch that manipulates two consecutive videos. When the value of val is equal to 0, video “0a.mp4” starts to play and stops at the  last scene, and when val is equal to 1, video “0b.mp4” starts to play and stops at the last scene. When the value of val becomes 0 again, video “0a.mp4” starts again.</p>

<p>Val takes the value 0 when the mouse is on the left side of the window and 0 when it is on the right. I will change that when I will send some data from Arduino through serial port.</p>

<p>My problem is that when the value of val becomes again 0, I want the program to pick a random video from the String moviesa (like “5a.mp4”) and play this instead of “0a.mp4” (and then  if the value of val becames 1, play “5b.mp4”).</p>

<p>I tried to put the command  : 
<code>index=int(random(num));</code>
between lines 43 and 44 but the program got stuck.</p>

<p>Thank you.</p>

<p>Script</p>

<pre><code>import processing.video.*;
int index=0; 
int num=3; 

Movie[] moviesa=new Movie[num]; 
Movie[] moviesb=new Movie[num];

int val;  

void setup() {
size(1280,720,P2D); 

for (int i=0; i&lt;num; i++)
{
moviesa[i]=new Movie(this,i+"a"+".mp4");
}
for(int k=0; k&lt;num; k++)
{
moviesb[k]=new Movie(this,k+"b"+".mp4");
}

}

void movieEvent(Movie movie) {
for (int i=0; i&lt;num; i++)
{
moviesa[i].read();
}
for (int k=0; k&lt;num; k++)
{
moviesb[k].read();
}
}

void draw() {
if (mouseX&gt;width/2)
{val=0;}
else 
{val=1;}

if(val==0) {
moviesb[index].stop();  
moviesa[index].play();
image(moviesa[index], 0, 0);
}
else {
moviesa[index].stop();
moviesb[index].play();
image(moviesb[index], 0, 0);
}
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Problems playing video on Raspberry Pi</title>
      <link>https://forum.processing.org/two/discussion/19797/problems-playing-video-on-raspberry-pi</link>
      <pubDate>Sat, 17 Dec 2016 13:35:05 +0000</pubDate>
      <dc:creator>Mancatman</dc:creator>
      <guid isPermaLink="false">19797@/two/discussions</guid>
      <description><![CDATA[<p>Im running Processing v3.1.1 on a Raspberry Pi.  Im really happy with it apart from one thing, playing video.  I know this is possible in other software but Id really like to get it working.</p>

<p>Progress so far:</p>

<p>Added the video library and tried:</p>

<pre><code>import processing.video.*;

Movie test;

void setup() {
  size(1000,1000);
  background(0);
  test = new Movie(this, "launch1.mp4");
  test.loop();
  test.volume(0);
}

void movieEvent(Movie m) {
  m.read();
}

void draw() {
  image(test, 0, 0, width, height);
}
</code></pre>

<p>All I get is a blank screen.  Also tried adding the GL video tool.  Then tried the examples that come with it but every time, I get the following error message:</p>

<pre><code>libEGL warning: DRI2: failed to authenticate
java.lang.RuntimeException: java.lang.ClassNotFoundException: Failed to find NEWT Display Class &lt;.bcm.vc.iv.DisplayDriver&gt;
    at jogamp.newt.DisplayImpl.create(DisplayImpl.java:314)
    at com.jogamp.newt.NewtFactory.createDisplay(NewtFactory.java:167)
    at com.jogamp.newt.NewtFactory.createDisplay(NewtFactory.java:149)
    at processing.opengl.PSurfaceJOGL.initDisplay(PSurfaceJOGL.java:150)
    at processing.opengl.PSurfaceJOGL.initFrame(PSurfaceJOGL.java:136)
    at processing.core.PApplet.initSurface(PApplet.java:10402)
    at processing.core.PApplet.runSketch(PApplet.java:10289)
    at processing.core.PApplet.main(PApplet.java:10024)
Caused by: java.lang.ClassNotFoundException: Failed to find NEWT Display Class &lt;.bcm.vc.iv.DisplayDriver&gt;
    at jogamp.newt.DisplayImpl.getDisplayClass(DisplayImpl.java:277)
    at jogamp.newt.DisplayImpl.create(DisplayImpl.java:285)
    ... 7 more
</code></pre>

<p>Im a bit lost now and would really appreciate it if someone could help!  Many thanks!</p>
]]></description>
   </item>
   <item>
      <title>Getting audio and video in sync</title>
      <link>https://forum.processing.org/two/discussion/19233/getting-audio-and-video-in-sync</link>
      <pubDate>Wed, 23 Nov 2016 10:06:59 +0000</pubDate>
      <dc:creator>alisdt</dc:creator>
      <guid isPermaLink="false">19233@/two/discussions</guid>
      <description><![CDATA[<p>Hi,</p>

<p>I have some code to play a video with different soundtracks (or sometimes no sound) and I can't seem to get them in sync. The sound plays noticeably behind the video, maybe by about a third to a half of a second. Any ideas?</p>

<pre><code>import processing.video.*;
import processing.sound.*;

Movie video;
SoundFile audio;

void setup() {
  size(640, 360);
  background(0);
  video = new Movie(this, "test.mp4");
  audio = new SoundFile(this, "test.mp3");

  video.play();
  audio.play();

}

void movieEvent(Movie m) {
  m.read();
}

void draw() {
  image(video, 0, 0, width, height);
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Processing - random video array + webcam (to make security camera-type visuals)</title>
      <link>https://forum.processing.org/two/discussion/19253/processing-random-video-array-webcam-to-make-security-camera-type-visuals</link>
      <pubDate>Wed, 23 Nov 2016 18:39:31 +0000</pubDate>
      <dc:creator>carocgm</dc:creator>
      <guid isPermaLink="false">19253@/two/discussions</guid>
      <description><![CDATA[<p>I'm attempting to make the visuals for an art installation I'm working on, and I'm not quite sure how to go about it in Processing. Here's what I would like to do (I'll be using an old CCTV monitor):</p>

<ul>
<li><p>Divide the screen into four quadrants (as if it were displaying feed from security cameras, but I'd be using videos, for the most part)</p></li>
<li><p>Have videos load randomly to those quadrants (from a total of 8 videos) and have the videos change after a certain number of seconds (they don't all have to change at once, but whatever's easiest)</p></li>
<li><p>Have a webcam send its feed into one of the quadrants as if it were another video
(I can always fix the webcam to one of the fourths of the screen and load random videos onto the other 3 available quadrants, if it simplifies things.)</p></li>
</ul>

<p>My Processing skills are quite basic; so far I've managed to split the screen in 4 and load 4 videos, but I honestly don't know how to work with a video array, which sounds like the more reasonable way for the program to do what I would like it to.</p>

<p>Here is the basic code:</p>

<p>import processing.video.*;</p>

<pre><code>Movie mov, mov1, mov2, mov3;

void setup() {
  size(1280, 640);
  frameRate(30);
  mov = new Movie(this,"0.mov");
  mov1 = new Movie(this,"1.mov");
  mov2 = new Movie(this,"2.mov");
  mov3 = new Movie(this,"3.mov");

  mov.play();
  mov1.play();
  mov2.play();
  mov3.play();

  mov.volume(0);
  mov1.volume(0);
  mov2.volume(0);
  mov3.volume(0);
}

void movieEvent(Movie mov) {
  mov.read();
}

void draw() {
  image(mov, 0, 0, 640, 320);
  image(mov1, 640, 0, 640, 320);
  image(mov2, 0, 320, 640, 320);
  image(mov3, 640, 320, 640, 320);
}
</code></pre>

<p>I started out with the above and then tried working with an array of videos, but only got so far:</p>

<p>import processing.video.*;</p>

<pre><code>Capture cam;

int maxmyMovies = 8;
int myMoviesIndex = 0;
Movie[] myMovies = new Movie[maxmyMovies];

void setup() {

size(640,480);

cam = new Capture(this, 640, 480, 12);
cam.start();
smooth();

   for (int i = 0; i &lt; myMovies.length; i ++ ) {
    myMovies[i] = new Movie(this, i + ".mov");

   }
}

void draw() {
 image(myMovies[myMoviesIndex], 0, 0);

  if (key == 'r') myMoviesIndex = int(random(0,8));

}

void movieEvent(Movie myMovies) {
  myMovies.read();
}
</code></pre>

<p>(The above is just copy/paste from other codes, I don't really want it to randomize when pressing the letter "r" but rather after a set time.) So, you can see I'm at a loss here... I would really appreciate any help.</p>

<p>Thanks!!</p>
]]></description>
   </item>
   <item>
      <title>composition/mix videos</title>
      <link>https://forum.processing.org/two/discussion/19071/composition-mix-videos</link>
      <pubDate>Wed, 16 Nov 2016 17:27:45 +0000</pubDate>
      <dc:creator>diramazioni</dc:creator>
      <guid isPermaLink="false">19071@/two/discussions</guid>
      <description><![CDATA[<p>Hello, I'm wondering if is possible to make a player that is able to mix/fade from one video to another.</p>
]]></description>
   </item>
   <item>
      <title>EGLDisplayUtil error – Processing on Raspberry</title>
      <link>https://forum.processing.org/two/discussion/18530/egldisplayutil-error-processing-on-raspberry</link>
      <pubDate>Thu, 13 Oct 2016 14:03:45 +0000</pubDate>
      <dc:creator>lxnr_p</dc:creator>
      <guid isPermaLink="false">18530@/two/discussions</guid>
      <description><![CDATA[<p>Hello everyone,</p>

<p>I'm working on a raspberry and when I run it, I everytime have this error in the console: (but the sketch run even though)</p>

<pre><code>EGLDisplayUtil.EGLDisplays: Shutdown (open: 1)
EGLDisplayUtil: Open EGL Display Connections: 1
EGLDisplayUtil: Open[0]: 0x1: EGLDisplayRef[0x1: refCnt 2]
</code></pre>

<p>Do you know what does it mean and how I can solve it?
The sketch read the values of the arduino (plugged on the raspberry)  where a proximity sensor is plugged and when we put an object above the sensor the first video change and another one is launched.
I also have another problem: When the sketch is running, the videos are slow down. And I remove everything that relate to the arduino and the sensor in processing, the videos are fine.</p>

<p>So is somebody can help me for this, it drives me crazy, and I didn't found a thing on our friend Google...
Thanks so much :)</p>

<p>Here my code:</p>

<pre><code>    ////////////////////////////////////////////
    ////////////////////////////////// LIBRARIES
    ////////////////////////////////////////////

    import processing.serial.*;
    import processing.video.*;





    /////////////////////////////////////////////////
    ////////////////////////////////// INITIALIZATION
    /////////////////////////////////////////////////

    Movie mymovie;
    Movie mymovie2;





    ////////////////////////////////////////////
    ////////////////////////////////// VARIABLES
    ////////////////////////////////////////////

    int lf = 10;    // Linefeed in ASCII
    String myString = null;
    Serial myPort;  // The serial port
    int sensorValue = 0; //value of the sensore
    int x = 100; //the sensor will be triggered when this value is reached. Modify it to change when the videos will switch




    /////////////////////////////////////////////
    ////////////////////////////////// VOID SETUP
    /////////////////////////////////////////////

    void setup() {
      //frameRate(50);
      fullScreen();
      //size(1280, 1024, P3D);
      // List all the available serial ports
      printArray(Serial.list());
      // Open the port you are using at the rate you want:
      myPort = new Serial(this, Serial.list()[1], 9600);
      myPort.clear();
      // Throw out the first reading, in case we started reading 
      // in the middle of a string from the sender.
      myString = myPort.readStringUntil(lf);
      myString = null;
      //load the video
      mymovie = new Movie(this, "VIDEO_1_v06bis.mov"); //Modify the line in quotation marks to change the videos. (put it inside the "data" folder
      mymovie2 = new Movie(this, "VIDEO_2_v02.mov");
      //set the videos for a continuous loop
      mymovie.loop();
      mymovie2.loop();
    }




    ////////////////////////////////////////////
    ////////////////////////////////// VOID DRAW
    ////////////////////////////////////////////

    void draw() {
      //image(mymovie, 0, 0); //display the video in a continuous loop
      // to trigger the sensor
      // check if there is something new on the serial port
      while (myPort.available() &gt; 0) {
        // store the data in myString 
        myString = myPort.readStringUntil(lf);
        // check if we really have something
        if (myString != null) {
          myString = myString.trim(); // let's remove whitespace characters
          // if we have at least one character...
          if (myString.length() &gt; 0) {
            println(myString); // print out the data we just received
            // if we received a number (e.g. 123) store it in sensorValue, we sill use this to change the background color. 
            try {
              sensorValue = Integer.parseInt(myString);
            } 
            catch(Exception e) {
            }
          }
        }
      }


      ///////////SENSOR TRIGGERED
      ///////////////////////////

      if (x &lt; sensorValue) {
        mymovie.jump(0);
        //background(mymovie2);
        image(mymovie2, mouseX, mouseY);
        //mymovie2.pause();
      } else {
        //mymovie2.play();
        //mymovie.jump(0);
      }


      ///////////SENSOR NOT TRIGGERED
      ///////////////////////////////

      if (x &gt; sensorValue) {
        mymovie2.jump(0);
        //background(mymovie);
        image(mymovie, mouseX, mouseY);
        //mymovie.pause();
      } else {
        //mymovie.play();
      }
    }



    //////////////////////////////////////////////
    ////////////////////////////////// VOID CUSTOM
    //////////////////////////////////////////////

    void movieEvent(Movie mymovie) {
      mymovie.read(); //read the video
      mymovie2.read();
    }
</code></pre>
]]></description>
   </item>
   <item>
      <title>opencv problem with bootcamp</title>
      <link>https://forum.processing.org/two/discussion/18536/opencv-problem-with-bootcamp</link>
      <pubDate>Thu, 13 Oct 2016 22:27:38 +0000</pubDate>
      <dc:creator>jayson</dc:creator>
      <guid isPermaLink="false">18536@/two/discussions</guid>
      <description><![CDATA[<p>I'm trying to do face detection on a video with opencv on bootcamp (windows 10) and processing 2.2.1</p>

<blockquote class="Quote">
  <p>import processing.video.*;</p>
  
  <p>Movie video;
  import gab.opencv.*;
  import java.awt.Rectangle;</p>
  
  <p>OpenCV opencv;
  Rectangle[] faces;</p>
  
  <p>void setup()
  {
    size(640,360);</p>
  
  <p>video = new Movie(this, "people.mp4");
    video.play();
    video.loop();
  <br />
     opencv = new OpenCV(this, video.width, video.height);
     opencv.loadCascade(OpenCV.CASCADE_FRONTALFACE);
  }</p>
  
  <p>void draw()
  {
    background(0);
    fill(255);
  <br />
    image(video,0,0);
  <br />
    opencv.loadImage(video);
    faces = opencv.detect();
  <br />
  }</p>
  
  <p>void movieEvent(Movie m)
  {
      m.read();
  <br />
  }</p>
</blockquote>

<p>It crashes at the line: 
  opencv.loadImage(video);</p>

<p>With the message: IndexOutOfBoundsException: Index 3: Size 0</p>

<p>Any ideas? This works fine on mac osx with the same version of processing.</p>
]]></description>
   </item>
   <item>
      <title>Clicking an Image to change it to another image</title>
      <link>https://forum.processing.org/two/discussion/18590/clicking-an-image-to-change-it-to-another-image</link>
      <pubDate>Mon, 17 Oct 2016 10:13:35 +0000</pubDate>
      <dc:creator>lakejoshua</dc:creator>
      <guid isPermaLink="false">18590@/two/discussions</guid>
      <description><![CDATA[<p>I'm very new to processing and have been trying to figure this out for awhile and I'm sure it is easy but I need help.</p>

<p>All I'm trying to do is turn the jellyfish image to the plastic bag image when it is clicked. I have a couple of jellyfish spread out through the sketch but wanted them to only changed when they are clicked indivdually. 
Here is the code that I have been working with, I'm very confused on what to put into the void mousePressed()</p>

<p>PImage ocean;
PImage jellyfish;
PImage bag;</p>

<p>void setup(){
  size(1280, 520);
 //background image
  PImage ocean;
  ocean = loadImage("ocean.jpg");
  background(ocean);</p>

<p>jellyfish = loadImage("jellyfish.png");
  bag = loadImage("plastic_bag.png");</p>

<p>}</p>

<p>void draw(){
  image(jellyfish, 500, 120);
  image(jellyfish, 600, 320);
  image(jellyfish, 100, 20);
  image(jellyfish, 1000, 50);
}</p>

<p>void mousePressed(){</p>

<p>}</p>

<p>}</p>
]]></description>
   </item>
   <item>
      <title>Video file formats?</title>
      <link>https://forum.processing.org/two/discussion/18547/video-file-formats</link>
      <pubDate>Fri, 14 Oct 2016 19:40:56 +0000</pubDate>
      <dc:creator>LizzyB</dc:creator>
      <guid isPermaLink="false">18547@/two/discussions</guid>
      <description><![CDATA[<p>Can anyone recommend preferred file formats for the Processing 3 Video library? I am running some tests in H264 and playback is choppy. I know that format makes a huge difference. Does anyone have experience or knowledge in this area? Which formats play smoothly?</p>

<p>I'm just messing with this very simple code from one of the examples right now:</p>

<pre><code>  import processing.video.*;
    Movie myMovie;

    void setup() {
      size(1920, 1080);
      background(0);
      myMovie = new Movie(this, "temporaldraft.mp4");
      myMovie.loop();
    }

    void draw() {
      image(myMovie, 0, 0, 1920, 1080);
    }

    // Called every time a new frame is available to read
    void movieEvent(Movie m) {
      m.read();
    }
</code></pre>

<p>Thanks!!</p>
]]></description>
   </item>
   <item>
      <title>Capturing movement in recorded video</title>
      <link>https://forum.processing.org/two/discussion/18502/capturing-movement-in-recorded-video</link>
      <pubDate>Tue, 11 Oct 2016 14:24:56 +0000</pubDate>
      <dc:creator>mtkostecki</dc:creator>
      <guid isPermaLink="false">18502@/two/discussions</guid>
      <description><![CDATA[<p>Hi!</p>

<p>I would like to capture movement in a recorded (not captured) video. I tried to transform a code from Learning Processing site as to match it to the recorded video - but it doesnt work, I have some strange erros. The code is as follows:</p>

<pre><code>import processing.video.*;
Movie kot;
PImage prevFrame;
float threshold = 50;

void setup() {
  size(2000, 2000);
  kot = new Movie(this, "breathing.mp4");
  kot.loop();

  prevFrame = createImage(kot.width, kot.height, RGB);
}

void movieEvent(Movie kot) {

  prevFrame.copy(kot, 0, 0, kot.width, kot.height, 0, 0, kot.width, kot.height); // Before we read the new frame, we always save the previous frame for comparison!
  prevFrame.updatePixels();  // Read image from the camera
  kot.read();
}

void draw() {

  loadPixels();
  kot.loadPixels();
  prevFrame.loadPixels();


  for (int x = 0; x &lt; kot.width; x ++ ) {
    for (int y = 0; y &lt; kot.height; y ++ ) {

      int loc = x + y*kot.width;            // Step 1, what is the 1D pixel location
      color current = kot.pixels[loc];      // Step 2, what is the current color
      color previous = prevFrame.pixels[loc]; // Step 3, what is the previous color

      // Step 4, compare colors (previous vs. current)
      float r1 = red(current); 
      float g1 = green(current); 
      float b1 = blue(current);
      float r2 = red(previous); 
      float g2 = green(previous); 
      float b2 = blue(previous);
      float diff = dist(r1, g1, b1, r2, g2, b2);

      // Step 5, How different are the colors?
      // If the color at that pixel has changed, then there is motion at that pixel.
      if (diff &gt; threshold) { 
        // If motion, display black
        pixels[loc] = color(0);
      } else {
        // If not, display white
        pixels[loc] = color(255);
      }
    }
  }
  updatePixels();
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>No image using video library in netbeans</title>
      <link>https://forum.processing.org/two/discussion/18357/no-image-using-video-library-in-netbeans</link>
      <pubDate>Fri, 30 Sep 2016 23:50:35 +0000</pubDate>
      <dc:creator>gordano</dc:creator>
      <guid isPermaLink="false">18357@/two/discussions</guid>
      <description><![CDATA[<p>I am trying to use the processing video library in netbeans. I have added the processing core and video jars as libries in netbeans and can get a sketch running with no errors, but I can only hear the video and don't see anything.</p>

<p>When I print "myMovie.width" I get 0...</p>

<p>Here is my code:</p>

<pre><code>package processingvideotest;

import processing.core.PApplet;
import processing.video.*;


public class ProcessingVideoTest extends PApplet{

    Movie myMovie;


    public void setup() {
    myMovie = new Movie(this,  "C:/Users/ollie/Documents/NetBeansProjects/ProcessingVideoTest/src/data/Evangelion.mp4");
    myMovie.play();
    myMovie.speed(1);
    myMovie.loop();

    }

    public void settings() {
      size(400, 400);

    }

    public void draw() {
    image(myMovie, 0, 0);
    }

    void movieEvent(Movie m) {
    m.read();
    }

    public static void main(String[] args) {
        PApplet.main(new String[] { "processingvideotest.ProcessingVideoTest" });
    }

}
</code></pre>
]]></description>
   </item>
   <item>
      <title>How to change position of "Contour" OpenCV</title>
      <link>https://forum.processing.org/two/discussion/18103/how-to-change-position-of-contour-opencv</link>
      <pubDate>Wed, 07 Sep 2016 14:38:14 +0000</pubDate>
      <dc:creator>lxnr_p</dc:creator>
      <guid isPermaLink="false">18103@/two/discussions</guid>
      <description><![CDATA[<p>Hi everybody, 
I'm using the opencv findcontour library that I modified to use with the webcam, that works great, but I would the webcam be in the center of my window. When I change the values of : image(video, x, y); it only move the video of the webcam, and not the contours. It stay on the top left. Here my code :</p>

<p>Thanks for your help :)</p>

<pre><code>////////////////////////////////////////////
////////////////////////////////// LIBRARIES
////////////////////////////////////////////

import processing.serial.*;
import gab.opencv.*;
import processing.video.*;




/////////////////////////////////////////////////
////////////////////////////////// INITIALIZATION
/////////////////////////////////////////////////

Movie mymovie;
Capture video;
OpenCV opencv;
Contour contour;




////////////////////////////////////////////
////////////////////////////////// VARIABLES
////////////////////////////////////////////

int lf = 10;    // Linefeed in ASCII
String myString = null;
Serial myPort;  // The serial port
int sensorValue = 0;
int x = 300;




/////////////////////////////////////////////
////////////////////////////////// VOID SETUP
/////////////////////////////////////////////


void setup() {
  size(1280, 1024);
  // List all the available serial ports
  printArray(Serial.list());
  // Open the port you are using at the rate you want:
  myPort = new Serial(this, Serial.list()[1], 9600);
  myPort.clear();
  // Throw out the first reading, in case we started reading 
  // in the middle of a string from the sender.
  myString = myPort.readStringUntil(lf);
  myString = null;
  opencv = new OpenCV(this, 720, 480);
  video = new Capture(this, 720, 480);
  mymovie = new Movie(this, "visage.mov");
  opencv.startBackgroundSubtraction(5, 3, 0.5);
  mymovie.loop();
}




////////////////////////////////////////////
////////////////////////////////// VOID DRAW
////////////////////////////////////////////


void draw() { 
  image(mymovie, 0, 0);
  image(video, 20, 20);
  //tint(150, 20);
  noFill();
  stroke(255, 0, 0);
  strokeWeight(1);



  // check if there is something new on the serial port
  while (myPort.available() &gt; 0) {
    // store the data in myString 
    myString = myPort.readStringUntil(lf);
    // check if we really have something
    if (myString != null) {
      myString = myString.trim(); // let's remove whitespace characters
      // if we have at least one character...
      if (myString.length() &gt; 0) {
        println(myString); // print out the data we just received
        // if we received a number (e.g. 123) store it in sensorValue, we sill use this to change the background color. 
        try {
          sensorValue = Integer.parseInt(myString);
        } 
        catch(Exception e) {
        }
      }
    }
  }
  if (x &lt; sensorValue) {
    video.start();
    opencv.loadImage(video);

  }

  if (x &gt; sensorValue) {
    image(mymovie, 0, 0);
  }

  opencv.updateBackground();
  opencv.dilate();
  opencv.erode();

  for (Contour contour : opencv.findContours()) {
    contour.draw();
  }

}




//////////////////////////////////////////////
////////////////////////////////// VOID CUSTOM
//////////////////////////////////////////////


void captureEvent(Capture video) {
  video.read(); // affiche l'image de la webcam
}

void movieEvent(Movie myMovie) {
  myMovie.read();
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Can I set a video as my background();</title>
      <link>https://forum.processing.org/two/discussion/18070/can-i-set-a-video-as-my-background</link>
      <pubDate>Sun, 04 Sep 2016 22:24:35 +0000</pubDate>
      <dc:creator>Brendan_Wilson</dc:creator>
      <guid isPermaLink="false">18070@/two/discussions</guid>
      <description><![CDATA[<p>Hello,</p>

<p>Here is what I;m trying to do. I would like to set a looping video as my background() image in my processing sketch. Then I want to import an OBJ and be able to rotate it in 3D space with my mouse. What I have so far is the video and the OBJ in the sketch but both acting as one piece. Here is my code so far. Any ideas?</p>

<p>import peasy.*;
import processing.video.*;</p>

<p>PShape s;</p>

<p>String PATH = "/Users/brendanwilson/Desktop/Vidoe_Processing/video/data/comp.mov";
Movie mov;</p>

<p>PeasyCam cam;</p>

<p>void setup() {
  size(800, 800, P3D);
  smooth();
  s = loadShape("rise.obj");
  frameRate(30);
  mov = new Movie(this, PATH);
  mov.loop();</p>

<p>//CAMERA Click &amp; Drag for rotation - Command &amp; Drag for panning
  cam = new PeasyCam(this, 0, 0, 0, 50);
  cam.setMinimumDistance(0);
  cam.setMaximumDistance(1800);</p>

<p>}</p>

<p>void movieEvent(Movie m) {
  m.read();</p>

<p>}</p>

<p>void draw() {</p>

<p>directionalLight(126, 126, 126, 0, 0, -1);
  ambientLight(102, 102, 102); 
  background(0);
  pushMatrix();
  shape(s, 10, 10, 80, 80);
  popMatrix();
  image(mov, 0, 0, width, height);
}</p>
]]></description>
   </item>
   <item>
      <title>Help add array</title>
      <link>https://forum.processing.org/two/discussion/17713/help-add-array</link>
      <pubDate>Mon, 01 Aug 2016 04:57:36 +0000</pubDate>
      <dc:creator>triple0</dc:creator>
      <guid isPermaLink="false">17713@/two/discussions</guid>
      <description><![CDATA[<p>Can someone help me incorporate a video array of up to 6 videos into this code provided? Including a void mousePressed function to click through to the next video. The way this code is written is so the video doesn't play naturally from start to finish~ so it can't be a timer function that simply plays all the videos after one another. The end result should be a basic video slideshow loop ONLY when clicked to view the next video.</p>

<pre><code>import processing.video.*;

Movie mov;
int newFrame = 0;

void setup() {
  size(640, 360);
  background(0);
  // Load and set the video to play. Setting the video 
  // in play mode is needed so at least one frame is read
  // and we can get duration, size and other information from
  // the video stream. 
  mov = new Movie(this, "transit.mov");  

  // Pausing the video at the first frame. 
  mov.play();
  mov.jump(0);
  mov.pause();
}

void movieEvent(Movie m) {
  m.read();
}

void draw() {
  background(0);
  image(mov, 0, 0, width, height);
  fill(255);
  text(getFrame() + " / " + (getLength() - 1), 10, 30);
  int f=ceil (map(mouseX,0,width,1,getLength()));
  setFrame(f);
}

//void keyPressed() {
//  if (key == CODED) {
//    if (keyCode == LEFT) {
//      if (0 &lt; newFrame) newFrame--; 
//    } else if (keyCode == RIGHT) {
//      if (newFrame &lt; getLength() - 1) newFrame++;
//    }
//  } 
//  setFrame(newFrame);  
//}

int getFrame() {    
  return ceil(mov.time() * 30) - 1;
}

void setFrame(int n) {
  mov.play();

  // The duration of a single frame:
  float frameDuration = 1.0 / mov.frameRate;

  // We move to the middle of the frame by adding 0.5:
  float where = (n + 0.5) * frameDuration; 

  // Taking into account border effects:
  float diff = mov.duration() - where;
  if (diff &lt; 0) {
    where += diff - 0.25 * frameDuration;
  }

  mov.jump(where);
  mov.pause();  
}  

int getLength() {
  return int(mov.duration() * mov.frameRate);
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Sound Cuts Out on Video in Processing 2: Advice</title>
      <link>https://forum.processing.org/two/discussion/17707/sound-cuts-out-on-video-in-processing-2-advice</link>
      <pubDate>Sun, 31 Jul 2016 17:31:26 +0000</pubDate>
      <dc:creator>mnoble</dc:creator>
      <guid isPermaLink="false">17707@/two/discussions</guid>
      <description><![CDATA[<p>Hello Processing Forum,</p>

<p>I am working on a 2010 Mac with Processing 2. I am running a simple program with 3 ellipse masks over a video. Whenever I run the video the sound goes silent at about 20-30 seconds. I have tried a variety of codecs including mpeg and H264 and even other videos. All seem to out to silence pretty quickly. I am dying here trying to get it up for a video installation. I really want the sound to play. I would even be up for loading the sound as separate from the video in Processing 2 if that made it work. I would be thrilled with any advice on this-- this is the code I am using:</p>

<p>import java.util.*;
import processing.video.*;</p>

<p>//creating Movie object
Movie vid;
//creating mask image
PImage img;
// movement speed of ellipses in pixels
int moveSpd = 5;</p>

<p>// class representing ellipse
class ellipseMask
{
 // x,y position of center 
 float x;
 float y;
 // x and y radius
 float xr;
 float yr;</p>

<p>//constructor 
 ellipseMask(float x,float y,float xr,float yr)
 {
  this.x = x;
  this.y = y;
  this.xr = xr;
  this.yr = yr; 
 }</p>

<p>}</p>

<p>// initializing ellipse mask objects - CHANGE HEIGHT &amp; WIDTH SCALE HERE
ellipseMask e1 = new ellipseMask(156,280,68,87);
ellipseMask e2 = new ellipseMask(512,280,68,87);
ellipseMask e3 = new ellipseMask(868,280,68,84);</p>

<p>// initialize transparent and black colors
color trans = color(255,255,255,0);
color black = color(0,0,0,255);</p>

<p>void setup()
{
 size(1024,768);
 // loading video
 vid = new Movie(this,"test2-QuickTimeH.264.mov");
 //making video run in loop
 vid.loop();</p>

<p>// create blank image of screen size
 img = createImage(width,height,ARGB);
}</p>

<p>void draw()
{
  background(255);</p>

<p>// displaying current video frame
  image(vid,0,0,width,height);</p>

<p>// loading pixel array, so we can set it
  img.loadPixels();</p>

<p>// iterating over all pixels indices in mask image
  for(int i=0;i&lt;width<em>height;i++)
  {
    // computing x,y coordinates of index
    float y = (float)(  i/(int)width ); 
    float x = (float)(i - y</em>width);</p>

<pre><code>// checking if points are inside ellipses using formula (x-h)^2/rx^2 + (y-k)^2/ry^2 &lt;= 1 for disk/point intersection
if(  ((x-e1.x)*(x-e1.x))/(e1.xr*e1.xr) +  ((y-e1.y)*(y-e1.y))/(e1.yr*e1.yr) &lt;= 1 || ((x-e2.x)*(x-e2.x))/(e2.xr*e2.xr) +  ((y-e2.y)*(y-e2.y))/(e2.yr*e2.yr) &lt;= 1 ||  ((x-e3.x)*(x-e3.x))/(e3.xr*e3.xr) +  ((y-e3.y)*(y-e3.y))/(e3.yr*e3.yr) &lt;= 1  )
{ 
// changing pixel array value of mask image to transparent if its inside ellipse 
img.pixels[i] = trans; 
}
else
{
// changing pixel array value of mask image to black if its outside ellipse   
img.pixels[i] = black;
}
</code></pre>

<p>}</p>

<p>// update mask image using the pixel array
  img.updatePixels();</p>

<p>// displaying mask image
  image(img,0,0,width,height);</p>

<p>}</p>

<p>// video event
void movieEvent(Movie m)
{
  m.read();
}</p>

<p>// called upon key press TO CHANGE POSITION OF ELLIPSES
void keyPressed()
{
 // moving ellipse 1 
 if(keyCode==UP){e1.y -= moveSpd;} 
 else if(keyCode==DOWN){e1.y += moveSpd;} 
 else if(keyCode==LEFT){e1.x -= moveSpd;} 
 else if(keyCode==RIGHT){e1.x += moveSpd;}</p>

<p>// moving ellipse 2 
 if(key=='w'){e2.y -= moveSpd;} 
 else if(key=='s'){e2.y += moveSpd;} 
 else if(key=='a'){e2.x -= moveSpd;} 
 else if(key=='d'){e2.x += moveSpd;}</p>

<p>// moving ellipse 3 
 if(key=='i'){e3.y -= moveSpd;} 
 else if(key=='k'){e3.y += moveSpd;} 
 else if(key=='j'){e3.x -= moveSpd;} 
 else if(key=='l'){e3.x += moveSpd;}</p>

<p>}</p>
]]></description>
   </item>
   <item>
      <title>movie = new Movie (this, "i.mov");</title>
      <link>https://forum.processing.org/two/discussion/17616/movie-new-movie-this-i-mov</link>
      <pubDate>Fri, 22 Jul 2016 16:09:03 +0000</pubDate>
      <dc:creator>ombar</dc:creator>
      <guid isPermaLink="false">17616@/two/discussions</guid>
      <description><![CDATA[<p>hello, i'm sorry this is a very basic question, but i'm all new in processing and trying to run a video in random jumping mode.</p>

<p>but it seams that i didn't knew how to install properly the video library...</p>

<p>please, what i have done wrong?</p>

<p>here is my code:</p>

<pre><code>import processing.video.*;
Movie movie;

float[] cortes={
  5, 10.1, 20.7, 24.5, 32.5, 37.6, 42.8, 53.2, 55.7, 64.3, 72.3, 78,9
};

int trechoAtual;
int quantTrechos = 11;

void setup() {
  size(1020, 882);
  background(0);

  movie = new Movie (this, "komodenu.mov");
  movie.loop();
}

void movieEvent(Movie m) {
  m.read();
}

void draw() {
  if (movie.time()&gt;cortes[trechoAtual+1]) {
    trechoAtual = int(random(quantTrechos-0.1));
    movie.jump(cortes[trechoAtual]);
  }
  image(movie, 0, 0, width, height);
}  
</code></pre>

<p>thanks</p>
]]></description>
   </item>
   <item>
      <title>Can I pauze a movie frame by frame?</title>
      <link>https://forum.processing.org/two/discussion/17628/can-i-pauze-a-movie-frame-by-frame</link>
      <pubDate>Sat, 23 Jul 2016 15:06:13 +0000</pubDate>
      <dc:creator>Maarten</dc:creator>
      <guid isPermaLink="false">17628@/two/discussions</guid>
      <description><![CDATA[<p>I am new to this forum but I really hope you can help me out on this one.</p>

<p>I'm trying to blend multiple movies into one. For blending multiple images I already got my code to work quite nicely I think (example below). Now I want to do the same for every frame in multiple movies. <a rel="nofollow" href="https://www.youtube.com/watch?v=VSUk9RUPwtM">I experimented with this somewhat </a> and I can get the movie frames to blend on click. Now I want to blend every frame. So my code is this:</p>

<pre><code>import processing.video.*;

Movie movie1;
Movie movie2;

void setup (){
  size(1280,720);

  movie1 = new Movie(this, "MVI_8256.MOV");
  movie2 = new Movie(this, "MVI_8257.MOV"); 

  movie1.play();
  movie2.play();
}

void movieEvent (Movie m){
  m.pause();
  if (movie1.available() &amp;&amp; movie2.available()){
    movie1.read();
    movie2.read();
    blend(); 
    movie1.play();
    movie2.play();
  }
}

void blend(){
  //code to blend
}

void draw (){
  image(movie1, 0, 0, 640, 360);
  image(movie2, 0, 640, 640, 360);
}
</code></pre>

<p>To me it looks as though the logic should work but i get a <em>JNA: could not detach thread</em> error. It seems that I can't pause a movie inside the movieEvent().</p>

<p>Hopefully one of you can help me out with some good advice!</p>

<p><img src="https://forum.processing.org/two/uploads/imageupload/195/7FS0765N5ELA.jpg" alt="result3" title="result3" /></p>
]]></description>
   </item>
   <item>
      <title>switching video doesn't work! help me, please!</title>
      <link>https://forum.processing.org/two/discussion/17073/switching-video-doesn-t-work-help-me-please</link>
      <pubDate>Thu, 09 Jun 2016 18:57:31 +0000</pubDate>
      <dc:creator>Massimiliano1987</dc:creator>
      <guid isPermaLink="false">17073@/two/discussions</guid>
      <description><![CDATA[<p>Hi! Could you have a look at my code? I used current movie to switch two video (NemoBimboMovie and NemoShapeMovie, but they don't switch. I don't know why. Pleeeease, help me!</p>

<pre><code>import processing.core.*; 
import processing.data.*; 
import processing.event.*; 
import processing.opengl.*; 

import processing.video.*; 
import processing.sound.*; 

import java.util.HashMap; 
import java.util.ArrayList; 
import java.io.File; 
import java.io.BufferedReader; 
import java.io.PrintWriter; 
import java.io.InputStream; 
import java.io.OutputStream; 
import java.io.IOException;

public class prova_di_oggi extends PApplet {

PImage file;

SoundFile sound1;
SoundFile sound2;

Movie NemoBimboMovie;
Movie NemoShapeMovie;
Movie AdelaideBimbaMovie;
Movie FirstInteractionMovie;

Movie CurrentMovie;

public void setup(){

    background (0);
    file = loadImage("/Users/MASC/Desktop/prova_di_oggi/data/rettangolo.jpg");
    sound1 = new SoundFile(this, "/Users/MASC/Desktop/prova_di_oggi/data/heartbeat.mp3");

    sound2 = new SoundFile(this, "/Users/MASC/Desktop/prova_di_oggi/data/nemo_invito.WAV");
    NemoBimboMovie = new Movie(this, "/Users/MASC/Desktop/prova_di_oggi/data/nemo_bimbo.mp4");
    NemoShapeMovie = new Movie(this, "/Users/MASC/Desktop/prova_di_oggi/data/nemo_shape.mp4");
    AdelaideBimbaMovie = new Movie(this, "/Users/MASC/Desktop/prova_di_oggi/data/adelaide_bimba.mp4");
    FirstInteractionMovie = new Movie(this, "/Users/MASC/Desktop/prova_di_oggi/data/firstinteraction.mp4");

    //In CurrentMovie tengo traccia di quale video é in play al momento.
    //Il promo dei due video che penso tu voglia far partire sia NemoShapeMovie
    CurrentMovie=NemoShapeMovie;
  }

public void draw(){
  image(NemoBimboMovie, 839,0, 600,854);
  image(NemoShapeMovie, 839,0, 600,854);
  image(AdelaideBimbaMovie, 0,0, 600,854);
  image(FirstInteractionMovie, 839,0, 600,854);
}

public void movieEvent(Movie m) { 
  m.read(); 
}

public void keyPressed() {
  if (key == '1') {
    sound1.play();
    image (file,839,0,600, 854);
  }
  if (key == '2') {
    sound2.play();
  }
  else if (key == '3') {
    sound1.stop();
    sound2.stop();
  }
  //Assumo che 'a' significhi che l'utente apra l'altra scatola e debba partire l'altro video 
  else if (key == 'a') {
    double CurrentTime=CurrentMovie.time();//Ottengo a che punto sta il video corrente
    CurrentMovie=NemoBimboMovie;
    CurrentMovie.jump((float)CurrentTime);
    }
  //Assumo che 's' significhi quando l'utente si avvicina...Parte il video con la figura
  else if (key == 's') {
      double CurrentTime=CurrentMovie.time();//Ottengo a che punto sta il video corrente
      CurrentMovie=NemoShapeMovie;
      CurrentMovie.jump((float)CurrentTime);
    }
  else if (key == 'p') {
      NemoBimboMovie.play();
    }
  else if (key == 'd') {
      AdelaideBimbaMovie.play();
    }
  else if (key == 'f') {
      FirstInteractionMovie.play();
    }    
}

public void settings() {  size(1439,854); }

static public void main(String[] passedArgs) {
    String[] appletArgs = new String[] { "--present", "--window-color=#666666", "--stop-color=#cccccc", "prova_di_oggi" };
    if (passedArgs != null) {
      PApplet.main(concat(appletArgs, passedArgs));
    } else {
      PApplet.main(appletArgs);
    }
  }
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Problem with toggling between multiple videos on processing 2.2.1</title>
      <link>https://forum.processing.org/two/discussion/7852/problem-with-toggling-between-multiple-videos-on-processing-2-2-1</link>
      <pubDate>Wed, 29 Oct 2014 08:11:12 +0000</pubDate>
      <dc:creator>silvergravel</dc:creator>
      <guid isPermaLink="false">7852@/two/discussions</guid>
      <description><![CDATA[<p>hi,<br />
so im quite a noob, just clearing that.<br />
im working on a project which involves switching between multiple videos on processing when i press a key. im trying to do some initial testing right now, and trying to get processing to switch between two videos on keypress. the video switches alright, but i cant see it in the applet window! the previous video ( in the paused state continues to stay on top ) . how do i fix this?? please help. find the code below -</p>

<pre><code>    import processing.video.*;

    Movie theMov;
    Movie theMov2;



    void setup() { 
      size(1440, 900);
      theMov = new Movie(this, "sin_city.mp4");
      theMov2 = new Movie(this, "blue_velvet.mp4");

      theMov.stop();  
      theMov2.stop();
    }

    void draw() { 
      background (0);
      image(theMov, 0, 0);
      image(theMov2, 0, 0); 
    } 

    void movieEvent(Movie m) { 
      m.read(); 
    } 

    void keyPressed(){
      if (key == 'p'){

            theMov2.pause();
            background(0);
            theMov.play();

              } else if (key == 'o'){

                       theMov.pause();
                       background(0);
                       theMov2.play();

                     }


}
</code></pre>
]]></description>
   </item>
   <item>
      <title>How to switch between two videos and how to determine which video is visualized (active for image())</title>
      <link>https://forum.processing.org/two/discussion/17049/how-to-switch-between-two-videos-and-how-to-determine-which-video-is-visualized-active-for-image</link>
      <pubDate>Wed, 08 Jun 2016 19:06:41 +0000</pubDate>
      <dc:creator>Massimiliano1987</dc:creator>
      <guid isPermaLink="false">17049@/two/discussions</guid>
      <description><![CDATA[<p>Hi everyone. I'm very new with Processing and I really need a help! I have two videos and I want to switch between them, choosing which video is shown. The two videos will always be in play, never stop or pause. They're playing at the same time and I can choose which visualize. Is there someone that can help me? Please, I'm very desperate because I have an exam and I'm so confused in using the code! Tks in advance. Here is the initial code that I try to do.</p>

<p>import processing.video.*;</p>

<p>Movie Mov1;
Movie Mov2;</p>

<p>void setup(){
    size(1280,720);
    Mov1 = new Movie(this, "nemo_bimbo.mp4");
    Mov2 = new Movie(this, "adelaide_bimba.mp4");
  }</p>

<p>void draw(){
    image(Mov1, 840,0, 440,720);
    image(Mov2, 0,0, 440,720);
}</p>

<p>void movieEvent(Movie m) { 
  m.read(); 
}</p>

<p>void keyPressed() {</p>

<p>//I don't know how to use switch (key)
  //case 'a'
  //PLEASE, help me!</p>

<pre><code>if (key == 'a') {
  Mov1.play();
 }
if (key == 's') {
  Mov2.play();
}

//I don't know how to not visualize anymore the video
</code></pre>

<p>if (key == ' ') {</p>

<p>Mov1.stop ();
Mov2.stop();
    }
}</p>
]]></description>
   </item>
   <item>
      <title>How to make a video stop playing and screen++;</title>
      <link>https://forum.processing.org/two/discussion/16655/how-to-make-a-video-stop-playing-and-screen</link>
      <pubDate>Tue, 17 May 2016 05:06:19 +0000</pubDate>
      <dc:creator>gunnage</dc:creator>
      <guid isPermaLink="false">16655@/two/discussions</guid>
      <description><![CDATA[<p>Hi guys, I have a basic set up of an animation storyline in which when the user clicks the mouse or does certain interactions, it then runs the next 'screen' or next animation. The issue I'm having is that on screen 5 a click of the mouse plays a video I made in after effects. However, this video then stops on the last frame and stays. I cannot work out how to 'screen++' after the video stops. I have tried duration, millis, etc. and nothing seems to be working. Could somebody please shed some light on what might be going on, or how I could achieve this?</p>

<pre><code>import processing.video.*;
Movie myMovie;

Cell[] cells= new Cell[1000];

float x, y;
PFont Baskerville;
int screen=1;
int drawRandomLines = 0;
int ellipseSize = 0;
int totalCells = 0;

void setup () {
  size(1024, 768);
  smooth(3);
  noStroke();
  Baskerville = createFont("Baskerville", 30);
  textFont(Baskerville);
  textAlign(CENTER);
  noStroke();
  x = width/2;
  y = 0;
  myMovie = new Movie(this, "dominant_species.mov");
  //myMovie.play();
}

void draw () {

  if (screen==1) {
    background(4, 16, 36);
    fill(255, 219, 157);
    noStroke();
    //draw first screen
    ellipse(512, 384, 16, 16);
    text("Here is a cell.", width/2, height/2-40);

    // } if (y &gt;= 384) {

    //y = height/2;

    text("Here is a cell.", width/2, height/2-40);
  } else if (screen==2) {
    background(4, 16, 36);

    fill(255, 219, 157, 20);
    rect(mouseX, 0, -mouseX, 768);
    fill(255, 219, 157);
    text("One of millions in the body.", width/2, height/2-40);

    cells[totalCells] = new Cell();

    totalCells ++ ;

    if (totalCells &gt;= cells.length) {
      totalCells = 0;
    }

    for (int i = 0; i &lt; totalCells; i++) {
      cells[i].move();
      cells[i].display();
    }

    if (mouseX &gt;= 900) {
      screen++;
    }

    if (mouseY &lt; 10 ) {
      screen++; //add one onto screen
    }
  } else if (screen==3) {
    background(255, 219, 157);
    //background(4,16,36);
    //draw third screen
    //testing to see if the mouse is inside a circle
    fill(4, 16, 36);
    text("Throughout our daily lives...", width/2, height/2-40);
  } else if (screen==4) {
    background(255, 219, 157);
    noStroke();

    text("our cells duplicate in order to heal and develop.", width/2, height/2+200);


    fill(4, 16, 36);
    ellipse(width/2-40, height/2-40, ellipseSize, ellipseSize);
    ellipse(width/2+40, height/2+40, ellipseSize, ellipseSize);
  } else if (screen==5) {
    background(4, 16, 36);
    noStroke();

    fill(255, 219, 157);
    text("That's how we've gone from a single celled organism...", width/2, height/2-20);
    image(myMovie, 0, 0);

    fill(4, 16, 36);
    ellipse(width/2-40, height/2-40, ellipseSize, ellipseSize);
    ellipse(width/2+40, height/2+40, ellipseSize, ellipseSize);
    //draw fifth screen
    //image(myMovie, 0, 0);
  }
}

//called only once when the user presses the mouse
void mousePressed () {
  if (screen==1) {
    //testing for a button notice it is the same bounds as the
    //rect we are drawing in the test for screen==1 inside draw
    //you could just write 170 instead of 130+40 but I left this
    //here so you can see how the test values relate to the rect coordinates
    float d = dist(mouseX, mouseY, 512, 384);

    if (d&lt;20) {
      screen++;
      //myMovie.play();
    }
  } else if (screen==5) {

    myMovie.play();
  } else if (screen==3) {
    screen++;
  }
}


//called whenever the mouse is movoed
void mouseMoved () {
  if (screen == 4) {
    ellipseSize=ellipseSize+5; 
    if (ellipseSize &gt; width) {
      println("threshold");
      //take us back to the beginning
      //reset all of our variables
      //screen=1;
      drawRandomLines = 0;
      ellipseSize = 0;
      screen++;
    }
  } else if (screen == 6) {
    //take a look inside the screen==5 inside draw
    //ellipseSize++; 
    //if (ellipseSize &gt; width) {
    //println("threshold");
    //take us back to the beginning
    //reset all of our variables
    //screen=1;
    //drawRandomLines = 0;
    //ellipseSize = 0;
  }
}


void movieEvent(Movie m) {
  m.read();
}


//NEW TAB__ CELL CLASS

class Cell {

  float x, y;   // Variables for location of raindrop
  float speed; // Speed of raindrop
  color c;
  float r;     // Radius of raindrop

  Cell() {
    r = 8;                 // All raindrops are the same size
    x = random(mouseX);     // Start with a random x location
    y = -r*4;              // Start a little above the window
    speed = random(1, 5);   // Pick a random speed
    c = color(255,219,157); // Color
  }

  // Move the raindrop down
  void move() {
    // Increment by speed
    y += speed;
  }

  // Check if it hits the bottom
  boolean reachedBottom() {
    // If we go a little beyond the bottom
    if (y &gt; height + r*4) { 
      return true;
    } else {
      return false;
    }
  }

  // Display the raindrop
  void display() {
    // Display the drop
    fill(c);
    noStroke();
    ellipse(x, y, r*2, r*2);
  }

}
`
</code></pre>
]]></description>
   </item>
   <item>
      <title>dynamically show videos added to a folder</title>
      <link>https://forum.processing.org/two/discussion/10738/dynamically-show-videos-added-to-a-folder</link>
      <pubDate>Sun, 10 May 2015 17:56:05 +0000</pubDate>
      <dc:creator>stankugo</dc:creator>
      <guid isPermaLink="false">10738@/two/discussions</guid>
      <description><![CDATA[<p>hej –</p>

<p>i know how to play/loop an existing video. but what if i have a folder in which videos will be copied (from an external source – in my case a raspberry pi that uploads captured video clips) dynamically?</p>

<p>can i add videos to my canvas on runtime? there is a function to list folder contents – but i don't know HOW TO dynamically add video sources to a running project.</p>

<p>is there any help? or a definitive "NO" …?
thanks anyways!</p>

<p>– stephan</p>
]]></description>
   </item>
   <item>
      <title>Arduino + LDR Sensor + Processing</title>
      <link>https://forum.processing.org/two/discussion/16615/arduino-ldr-sensor-processing</link>
      <pubDate>Sun, 15 May 2016 15:41:01 +0000</pubDate>
      <dc:creator>Vasco</dc:creator>
      <guid isPermaLink="false">16615@/two/discussions</guid>
      <description><![CDATA[<p>At the time i dont have the arduino or the light sensors, i will only work on that tomorrow =/. But at processing i'm trying some stuff. The idea is to have a video always in loop, but every time i take the light of a sensor (either if i put my finger on the sensor or a cloth) it show's another video, but when that sensor got light again it goes to the loop video.</p>

<p>This is what i got so far, still missing the keyPressed as a substitute of the sensors. The problem is the videos are all runing ate the same the time, and i've no idea how to do the keyPressing to call the other videos. Its the first time i'm using this library, and i really need help on this.</p>

<pre>
import processing.video.*;

String[] movieList = {"movie/x.mov", "movie/y.mov", "movie/w.mov", "movie/z.mov"};
Movie[] filmes = new Movie[movieList.length];

void setup() {
  size(1280, 720);
  //fullScreen();
  background (0);
  frameRate(60);

  for (int i = 0; i &lt; movieList.length; i++)
  {
    filmes[i] = new Movie(this, movieList[i]);
    filmes[i].loop();
  }
}

void draw() 
{
  for (int i = 0; i &lt; movieList.length; i++)
  {
    image(filmes[i], 0, 0);
  }
}

void movieEvent(Movie m) 
{
  m.read();
}

</pre>
]]></description>
   </item>
   <item>
      <title>Problem with movie freezing when using movie.jump()</title>
      <link>https://forum.processing.org/two/discussion/4575/problem-with-movie-freezing-when-using-movie-jump</link>
      <pubDate>Mon, 21 Apr 2014 11:14:04 +0000</pubDate>
      <dc:creator>gianordoli</dc:creator>
      <guid isPermaLink="false">4575@/two/discussions</guid>
      <description><![CDATA[<p>Hi,
I created a sketch that makes my movie jump based on a list of time positions. Sometimes the transition is fast, but sometimes the movie freezes for a while. Here is the result: <div class="VideoWrap"><div class="Video Vimeo"><object width="640" height="385"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=92457949&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=92457949&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="640" height="385"></embed></object></div></div>
Is there any way to reduce this delay?</p>

<p>Here is part of the code:</p>

<pre><code>void draw() {
  background(0);

  if (!isPlaying) {
    currSub = subs.get(subIndex);
    myMovie.jump(currSub.start);
    isPlaying = true;
  }

  image(myMovie, 0, 0, width, height);

  //Draw subtitle
  text(currSub.speech, width/2, height - 25);

  //Check subtitle ending
  if (myMovie.time() &gt;= currSub.end) {
    subIndex ++;
    isPlaying = false;
  }
}

// Called every start a new frame is available to read
void movieEvent(Movie m) {
  m.read();  
}
</code></pre>

<p>thanks,</p>
]]></description>
   </item>
   <item>
      <title>How to play a video using keyPressed etc.?</title>
      <link>https://forum.processing.org/two/discussion/16285/how-to-play-a-video-using-keypressed-etc</link>
      <pubDate>Wed, 27 Apr 2016 13:04:56 +0000</pubDate>
      <dc:creator>kk324</dc:creator>
      <guid isPermaLink="false">16285@/two/discussions</guid>
      <description><![CDATA[<p>Hi.
I am very very new to Processing. I am working on a project that involves Makey Makey, and I need to figure out how to make a video play smoothly using keys or a mouse. I am using keyPressed now for this, but the video comes out all twitchy, probably because you have to hold the key for the whole duration of the movie in order for it to play. Is there a better way to do it? I was thinking that mouseClicked or keyReleased or keyTyped would be better for this purpose, but I am not sure how to do it. Anyway, here is my code:</p>

<pre><code>import processing.video.*;
Movie myMovie1, myMovie2, myMovie3;
boolean playMovie1=true;
boolean playMovie2=false;
boolean playMovie3=false;



void setup()
{
  size (displayWidth, displayHeight);
  background (0);


 myMovie1 = new Movie(this, "1.mp4");

 myMovie2 = new Movie(this, "2.mp4");

 myMovie3 = new Movie(this, "3.mp4");

}

void draw(){
background(0);
if(playMovie1==true){

myMovie1.play();
image(myMovie1,0, 0);
if(myMovie1.time()&gt;=myMovie1.duration()){
myMovie1.stop();
playMovie1=false;

playMovie2=true;
}
}




if(playMovie3==true){

myMovie3.play();
image(myMovie3,0,0);
if(myMovie3.time()&gt;=myMovie3.duration()){
myMovie3.stop();
playMovie3=false;
}
}
}


void movieEvent(Movie m){
m.read();
}

void keyPressed()

{

// PRESS LEFT OR RIGHT AFTER FIRST VIDEO
  if ((keyCode == RIGHT) || (keyCode == LEFT))

{
 if(playMovie2==true){

myMovie2.read();
myMovie2.play();
image(myMovie2,0,0);
if(myMovie2.time()&gt;=myMovie2.duration()){
myMovie2.stop();
playMovie2=false;
playMovie3=true;
}}


 }}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Problem using Video in Objects/class</title>
      <link>https://forum.processing.org/two/discussion/16245/problem-using-video-in-objects-class</link>
      <pubDate>Mon, 25 Apr 2016 15:45:00 +0000</pubDate>
      <dc:creator>Stencilboy</dc:creator>
      <guid isPermaLink="false">16245@/two/discussions</guid>
      <description><![CDATA[<p>Hello, I am trying to use video inside an object. This code worked fine before I started building the class - I think my problem is that I don't know where to place the initialisation of the movie. Below is my code and I am getting an error on line 43. The error says " The constructor "Movie(Tile,String)" does not exist". Eventually i would like to have a number of tile objects arranged in a certain pattern and when the cursor moves over each tile it plays the movie file and plays a separate sample.</p>

<p>Thanks for the help (code below)</p>

<pre><code>    import processing.video.*;
    import ddf.minim.*;
    Movie movie1; 
    Minim minim;
    AudioSample sample;  

    Tile t1;                

    void setup() {
    fullScreen(2);

    }


     void draw() {

    background(155);
    t1.presentTile(400,500);


 }

 class Tile {


    int boxSize;
    boolean overBox = false;
    boolean canTrigger = true;
    float boxMax = 100;
    float boxMin = 25;

    void movieEvent(Movie movie1) {
    movie1.read();
    }    

Tile() {


    imageMode(CENTER);
    boxSize = 25;

    minim = new Minim(this);
    movie1 = new Movie(this,"TORCH_2_1.mov");
    movie1.loop();
    movie1.pause();
    sample = minim.loadSample("Paper Rustle_1.mp3");

    t1 = new Tile(); 



}



void presentTile(float bx,float by) {

    if (mouseX &gt; bx-(boxSize/2) &amp;&amp; mouseX &lt; bx+(boxSize/2) &amp;&amp;  
    mouseY &gt; by-(boxSize/2) &amp;&amp; mouseY &lt; by+(boxSize/2)) {
    overBox = true; 

    } else {

    overBox = false;
    }

    if ((overBox) &amp;&amp; (boxSize &lt; boxMax)) {

    image(movie1, bx, by,boxSize++,boxSize++);
    movie1.loop();

    }
    if ((!overBox)&amp;&amp;(boxSize &gt; boxMin)){

    image(movie1, bx, by,boxSize-=3,boxSize-=3);
    movie1.pause();

    }
    image(movie1,bx,by,boxSize,boxSize);

    if (canTrigger &amp;&amp; overBox) {
    sample.trigger();
    canTrigger = false;

    }

    if (!overBox) {
    sample.stop();
    canTrigger = true;              
    }

}

}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Trigger sample causes horrible loud distortion using MINIM</title>
      <link>https://forum.processing.org/two/discussion/16173/trigger-sample-causes-horrible-loud-distortion-using-minim</link>
      <pubDate>Thu, 21 Apr 2016 18:38:29 +0000</pubDate>
      <dc:creator>Stencilboy</dc:creator>
      <guid isPermaLink="false">16173@/two/discussions</guid>
      <description><![CDATA[<p>Hello, Im trying to get a sample to trigger when the mouse passes over a movie (which then loops and enlarges) and stop when the mouse is no longer on that movie.</p>

<p>In the below code everything is working correctly but the sound that is heard is horribly distorted. I think this is because it is playing a new sample every frame, but I'm not sure how to prevent that. I can get the sample to play back fine in mousePressed() (outside of draw) but i don't want to use that- i want the sound to play only when the mouse passes over the movie box.  If the solution is to move the  "sample.trigger();" out of draw where would it go?</p>

<p>Im on OSX 10.10.5 and using Processing 3.02</p>

<p>Code is below  - but be warned - turn your speakers down if u play that exact code!</p>

<p>Thanks.</p>

<pre><code>import processing.video.*;
import ddf.minim.*;


Movie movie1; 
Minim minim;
AudioSample sample;

float bx;
float by;
int boxSize;
boolean overBox = false;
float boxMax = 100;
float boxMin = 25;

void setup() {
fullScreen(2);
minim = new Minim(this);
bx = width/2;
by = height/2;
imageMode(CENTER);
boxSize = 25;

movie1 = new Movie(this, "TORCH_2_1.mov");
movie1.loop();
movie1.pause();
sample = minim.loadSample("Paper Rustle_1.mp3");
}

void movieEvent(Movie movie1) {
movie1.read();
}

 void draw() {

background(155);

if (mouseX &gt; bx-(boxSize/2) &amp;&amp; mouseX &lt; bx+(boxSize/2) &amp;&amp;  
mouseY &gt; by-(boxSize/2) &amp;&amp; mouseY &lt; by+(boxSize/2)) {
overBox = true; 

} else {

overBox = false;
}

if ((overBox) &amp;&amp; (boxSize &lt; boxMax)) {

image(movie1, bx, by,boxSize++,boxSize++);
movie1.loop();


}
if ((!overBox)&amp;&amp;(boxSize &gt; boxMin)){

image(movie1, bx, by,boxSize-=3,boxSize-=3);
movie1.pause();


}
image(movie1,bx,by,boxSize,boxSize);

if (overBox) {
sample.trigger();

}

if (!overBox) {
sample.stop();

}

}
</code></pre>
]]></description>
   </item>
   <item>
      <title>launch() won't work inside selectInput() function;</title>
      <link>https://forum.processing.org/two/discussion/16097/launch-won-t-work-inside-selectinput-function</link>
      <pubDate>Tue, 19 Apr 2016 11:06:50 +0000</pubDate>
      <dc:creator>Almeida</dc:creator>
      <guid isPermaLink="false">16097@/two/discussions</guid>
      <description><![CDATA[<p>Hello, I've come across a weird problem in my program. I am making a program that launches a video after I use the function launch() inside it that initializes another program called video_segmentation. This program generates a txt file with information about when each shot and scene of the selected video begins and ends.</p>

<p>The problem here is that this program will not launch inside my <code>selectInput()</code> unless I put another <code>selectInput()</code> before it. Here's my code:</p>

<pre><code>  import processing.video.*;
  import gab.opencv.*;
  import java.awt.*;
  import java.util.*;
  import java.io.*;

  OpenCV openCv;

  PrintWriter output;
  StringList kf;
  StringList [] movieScenes;
  int c=0;
  BufferedReader HowManyScenes;
  int lines;
  String line = "1";
  String [] scenes;

  Movie theMov; 
  File selectionF, selectionT;
  String selectText;
  int fc;
  ArrayList &lt;PImage&gt; frames= new ArrayList();
  int avgFrameColor;

  Boolean trufals=false;
  Boolean process=true;

  void setup() {

    size(1280, 720);
    //frameRate(200);
    selectInput("Select a film to process:", "selectFilm");

  }

  void selectFilm(File selection) {
    println("ola");
    if (selection == null) {
      println("Window was closed or you hit cancel.");
    } else {
      theMov = new Movie (this, selection.getAbsolutePath());
      // println(selection.getAbsolutePath());

      String [] params = split (selection.getAbsolutePath(), "\\");
      String [] segmentation = {"C:/Users/Nuno/Desktop/Segmentation/windows64/video_segmentation", params[params.length-1]};

      launch(segmentation);
      println(segmentation);
      //process=true;

    }
  }  

  void draw() { 

    if (theMov == null || selectText == null) {
      trufals=false;
    } else {
      trufals=true;
    }

//rest of my code which doesnt start untill I select both a video file and a txt file

}
</code></pre>

<p>The problem I have is in the setup I believe, because if I put another random <code>selectInput()</code> before it all works fine and video_segmentation.exe will run. Example:</p>

<pre><code>void setup(){
  size(1280,720);
  selectInput("hi","hi");
  selectInput("Select a film to process:", "selectFilm", selectionF)

}
</code></pre>

<p>I discovered this because I was running another <code>selectInput()</code> that initializes the function <code>selectScenes()</code>which reads the file generated by video_segmentation.exe.</p>

<p>I would appreciate some help if anyone has any idea what this is about.</p>
]]></description>
   </item>
   </channel>
</rss>