Loading...
Logo
Processing Forum
hi,
i'm exporting my sketches as .mov and I convert them in .flv --> .swf format
i see that even if the background color is white in my processing skecth (0, 0, 100 HSB or 255, 255, 255 RGB) the background of the final .swf is light grey.
it's the conversion process, i thought, but i realized that even the .mov has a light grey background.
i need to have a real white background and i don't know how to do.

did anyone experience such a kind of problem? suggestions?
thks

Replies(14)

It is the conversion process, but depending on what codec you choose processing also compress the mov file.
try these settings, i never had any problems with colors or compression.
Files get big though.

mm = new MovieMaker(this, width,height, "anim.mov",30, MovieMaker.VIDEO, MovieMaker.HIGH);
thank you cedric. i tried but i still have a light grey background (i previously used MovieMaker.LOSSLESS instead of MovieMaker.HIGH).
it's really a very very light grey, but i need a real white because i'd like to display the video on a white background and i don't want the video window to be visible.
i will check the color value of my videofiles... maybe you are right.

and yes, lossless should be even better... hmm
Nope, its 100% white, i checked two videos. some videos some white particles on black background. and the opposite, white background black particles. White was always (255,255,255)...
strange! i don't know which kind of monitor do u have but the difference between white and the light grey i obtain is quite small.
anyway, here is the code (taken from a openprocessing sketch and modified):

---
import processing.video.*;
MovieMaker mm;

color[][] clre;
PVector[][] posizioni;
 
PVector origin;
ArrayList particles = new ArrayList();
int numParticles = 36000;
int z = 0;
 
void setup()
{
  size(500, 500);
  colorMode(HSB, 360, 100, 100, 100);
  clre = new color[width][height];
  posizioni = new PVector[width][height];
  mm = new MovieMaker(this, width, height, "drawing1.mov", 30, MovieMaker.VIDEO, MovieMaker.LOSSLESS);
 
}
 
void draw()
{

background(0, 0, 100);
  
noStroke();
fill(0, 100, 100, 1);

 
pushMatrix();
translate(230, 0);
beginShape();
vertex(100, 200);
bezierVertex(45, 200, 0, 155, 0, 100);
vertex(0, 100);
bezierVertex(0, 45, 45, 0, 100, 0);
vertex(100, 0);
bezierVertex(136, 0, 169, 19, 185, 48);
vertex (142, 72);
bezierVertex(133, 60, 117, 50, 100, 50);
vertex(100, 50);
bezierVertex(73, 50, 50, 73, 50, 100);
vertex(50, 100);
bezierVertex(50, 127, 73, 150, 100, 150);
vertex(100, 150);
bezierVertex(117, 150, 133, 140, 142, 129);
vertex(185, 152);
bezierVertex(169, 181, 136, 200, 100, 200);
endShape();
popMatrix();

beginShape();
vertex(0, 195);
vertex(113, 0);
vertex(225, 195);
vertex(168, 195);
vertex(113, 100);
vertex(58, 195);
vertex(0, 195);
endShape();
 

    //beginRecord(PDF, "portfolio.pdf");
 
 
 for(int i=0; i<width; i++) {
    for(int j = 0; j<height; j++) {
       clre[i][j] = get(i,j);
       if(clre[i][j] != -1){
            if(z < numParticles){
            posizioni[i][j] = new PVector(i,j,0);
            origin = new PVector(35+posizioni[i][j].x, 130+posizioni[i][j].y, 0);
            PVector a = new PVector();
            PVector v = new PVector();      
            PVector l = new PVector(random(width), random(height) , 0);
            particles.add(new Particle(a,v,l, origin, random(0.05f, 2.0f)));
            z++;
            }
      }
    }
  }
            for (int  h = 0; h<particles.size()-1; h++){
            Particle prt = (Particle) particles.get(h);
            prt.run();
            
            PVector actualVel = prt.getVelocity();
            PVector attrito = PVector.mult(actualVel,-0.05);
            prt.add_force(attrito);
           
            
            if(keyPressed) {
               if (key == 'a' || key == 'A')
              {
                PVector origLoc = prt.getOrigin();
                PVector diff = PVector.sub(origLoc,prt.getLocation());
                diff.normalize();
                float factor = 0.5f;
                diff.mult(factor);
                prt.setAcceleration(diff);
              }
              if (key == ' ' || key == ' ')
              {
               mm.finish();
              }             
            }
           
            if(mousePressed) {
              PVector mouseLoc = new PVector(mouseX, mouseY, 0);
              PVector diff = PVector.sub(mouseLoc,prt.getLocation());
              diff.normalize();
              float factor = 1.0f;
              diff.mult(factor);
              prt.setAcceleration(diff);
          }  
  }
mm.addFrame(); 
}

void keyPressed(){

if (key == 'q' || key == 'Q') {
    //endRecord();
    exit();
  }             
}



 class Particle {
  PVector or;
  PVector loc;
  PVector vel;
  PVector acc;
  float ms;
  float distance;
 
  Particle(PVector a, PVector v, PVector l, PVector o, float ms_) {
    acc = a;
    vel = v;
    loc = l;
    ms = ms_;
    or = o;
  }
 
  void run() {
    update();
    render();
  }
 
  void update() {
    vel.add(acc);
    loc.add(vel);
    acc = new PVector();
  }
 
  void render() {
    stroke(1, 100, 0);
    point(loc.x,loc.y);
   
    //noStroke();
    //fill(204, 102, 0);
    //ellipse(loc.x, loc.y, 1, 1);
   
    //stroke(360, 80, 50);
    //line(loc.x-1, loc.y-1, loc.x, loc.y);
  }
 
 void add_force(PVector force) {
    force.div(ms);
    vel.add(force);
  }
 
 float getMass() {
    return ms;
  }
  
  PVector getLocation() {
    return loc;
  }
  PVector getOrigin() {
    return or;
  }
  PVector getVelocity() {
    return vel;
  }
  void setLocation(PVector l){
    loc = l;  
  }
 
  void setAcceleration(PVector a){
    acc = a;
  }
}
the monitor doesnt make a difference, i took a screenshot and checked the color value in photoshop... but i will try to run your code. and check again.
Hmm, using your sketch i recorded a video and took a screenshot of the video file. here it is, check it yourself. its white.
Maybe it has something to do with your installed quicktime version.
How did you check the color value ?


in photoshop i find a HSB 0 0 97 (RGB 248 248 248) background...
(thanks a lot for your attention, cedric!)
i can't believe, you have a perfect white background with the same code!
(guess the image you put is a frame of the movie)
mmm really strange
the quicktime i have is the free version i downloaded a couple of months ago...
yes, its a capture from the movie, not the sketch.
So the code is not the problem. Did you download. original apple quicktime?I believe thats what i am using.
yes it's the original one, even if it's the free version.
Maybe try another codec.
PhilLho once did some tests and posted his results here :

http://processing.org/discourse/yabb2/YaBB.pl?num=1211318862

it's a problem of players and converters, processing is ok
if i play the .mov with quicktime i have a 247 247 247 background
if i play the .mov with vlc i have a good 255 255 255 background
if i convert the .mov to .swf (tried with adobe media encoder and flash, dvdvideosoft) i can't obtain a 255 255 255 background.
i'll try with other converters
thks again!
i discovered that it depends from a problem called gamma shift: many players/converters assume a RGB range different from 0 255 (the maximum = white is less than 255), so when a video is worked through a tool like this his RGB range il smaller than the one we usually deal with on a pc.
using sony vegas (video editing tool) i applied as color correction and rescaled the RGB levels.
now everything is ok.
still don't understand why cedric was able to see everything fine on his quicktime, but... doesn't matter.
thank you for your help!