Serious problem with video library

Hello everyone, i'm expiriencing serious problems with a code i wrote.

`import; import fullscreen.*; import japplemenubar.*; import*;
import controlP5.*;
import processing.serial.*;

ControlP5 controlP5; //Define the variable controlP5 as a ControlP5 type. DropdownList ports; //Define the variable ports as a Dropdownlist. Serial port; //Define the variable port as a Serial object. int Ss; //The dropdown list will return a float value, which we will connvert into an int. we will use this int for that). String[] comList ; //A string to hold the ports in. boolean serialSet; //A value to test if we have setup the Serial port. boolean Comselected = false; //A value to test if you have chosen a port in the list. int larghezza=1920; int altezza=1080; PImage bg;
Movie im1; Movie im2; Movie im3; SoftFullScreen fs; int value = 0;
boolean show_image = false;
boolean show_video = false; boolean ready=false; int image_no = -1;
int start_time = 0;

void setup() {

larghezza=displayWidth; altezza=displayHeight; size(larghezza,altezza); controlP5 = new ControlP5(this); ports = controlP5.addDropdownList("list-1",10,25,120,84); customize(ports); bg = loadImage ("sfondo169.jpg");
bg.resize(larghezza, altezza); fs = new SoftFullScreen(this,0); fs.enter(); frameRate(24);

im1 = new Movie(this, "analysis.mp4"); //Formati disponibili: .mp4, .mov, .wmv im2 = new Movie(this, "connection.mp4"); //Formati disponibili: .mp4, .mov, .wmv im3 = new Movie(this, "oil.mp4"); //Formati disponibili: .mp4, .mov, .wmv (); (); ();

im1.frameRate(24); im2.frameRate(24); im3.frameRate(24); println(displayWidth); println(displayHeight); } void draw_image() {

if (show_video) { switch(image_no) { case 1: video(im1); break;

  case 2:

  case 3:
else {


//The dropdown list returns the data in a way, that i dont fully understand, again mokey see monkey do. However once inside the two loops, the value (a float) can be achive via the used line ;). void controlEvent(ControlEvent theEvent) { if (theEvent.isGroup()) { //Store the value of which box was selected, we will use this to acces a string (char array). float S =; //Since the list returns a float, we need to convert it to an int. For that we us the int() function. Ss = int(S); //With this code, its a one time setup, so we state that the selection of port has been done. You could modify the code to stop the serial connection and establish a new one. Comselected = true; } }

//here we setup the dropdown list. void customize(DropdownList ddl) { //Set the background color of the list (you wont see this though). ddl.setBackgroundColor(#FFFFFF); //Set the height of each item when the list is opened. ddl.setItemHeight(20); //Set the height of the bar itself. ddl.setBarHeight(15); ddl.captionLabel().set("Seleziona la porta COM"); ddl.captionLabel().style().marginTop = 3; ddl.captionLabel().style().marginLeft = 3; ddl.valueLabel().style().marginTop = 3; comList = port.list(); String comlist = join(comList, ","); String COMlist = comList[0]; int size2 = COMlist.length(); int size1 = comlist.length() / size2; for(int i=0; i< size1; i++) { ddl.addItem(comList[i],i); } ddl.setColorBackground(#FFFFFF); ddl.setColorActive(color(255,128)); ddl.setColorLabel(#000000); ddl.setColorForeground(#FFFED6); }

void startSerial(String[] theport) { //When this function is called, we setup the Serial connection with the accuried values. The int Ss acesses the determins where to accsess the char array. port = new Serial(this, theport[Ss], 57600); //Since this is a one time setup, we state that we now have set up the connection. serialSet = true; } void serialEvent(int serial) {
if (serial != 'z'){
show_video = true;
start_time = millis();
image_no = serial- 'A' + 1;} //--------------------------------------------------------------------------------------------- }

void draw() { //So when we have chosen a Serial port but we havent yet setup the Serial connection. Do this loop while(Comselected == true && serialSet == false) { //Call the startSerial function, sending it the char array (string[]) comList startSerial(comList); } background (bg); //inviamo l'immagine bg come background draw_image();
//--------------------------------------------------------------------------------------------- if(serialSet){
ports.hide(); if (port.available() > 0) {
value =; serialEvent(value);}



void video(Movie vd1){ imageMode(CENTER); image(vd1, larghezza/2, altezza/2); if(vd1.available()) (); (); if(vd1.time()>=vd1.duration()){show_video=false;vd1.stop();} if(vd1!=im1) im1.stop(); if(vd1!=im2) im2.stop(); if(vd1!=im3) im3.stop(); }`

the issue presents only on a single computer, in which i need to run the sketch: the video, recieved the serial signal, doesn't shows. I supposed it could depends by the codecs or by gstreamer, so i've installed both them, and nothing changed. So i've tried to replace my videos with one i took from the example sketchs, "" and it works. Its codec is avc1 h.264 in a .mov container, mine videos were MPEG-4 in a mp4 container, so i converted my videos to the container and codec of the example video but it still doesnt work. I cant copy the error it gave me when playng mpeg4 videos, but it was something about playsink0. I've tried to use both processing 2.x and 3.x, nothing changes. I've also tried to export the application on another computer (where it works) and the application simply doesnt launch What can i do?



  • Please format your code for this forum

  • I've tried with quotes but it didn't worked

  • Make sure tyere is a blank line before and after the code. Highlight the code and press Ctrl+o

  • Is my guide badly written or are people only skimming through it? Is it too long?
    Are the differences between code fragment and code block too hard to understand?

    Perhaps I should put the explanations about code block (the most common case) before those about code fragments, as people seem to stop reading after the first sentence...

  • @PhiLho I suspect that the problem is that most new forum members (the OP joined just 9 hours ago) don't read the Common Questions. Perhaps change Forum Rules and Advice to NEW MEMBERS MUST READ THIS or similar

  • Reworded a bit the article, and changed the order...

Sign In or Register to comment.