how to change the video resolution in real time

Hi everyone!

I need to transform in real time a video with some reolution to one with less resolution.
I was trying to get the pixels from the video and then creating an image or a texture, but I have no idea about how to reduce his resolution. I ve seen that a resize method exists but what I want is to display the video in the same area with less resolution.

Any suggestion?

Thanks in advance :smiley:

This is a way:

in setup()

  
 peli.loadMovie("rayos.mov");  
	peli.play();  
    scaleX=5; //int  
    scaleY=1; //int  
    w=peli.width/scaleX; //int  
    h=peli.height/scaleY; //int  
    pantalla.allocate(w,h,GL_RGB);  
  

in uptdate()

  
  
peli.idleMovie();  
     int bytes_per_pixel=3;  
     unsigned char * pixels = peli.getPixels();  
       
     unsigned char * nPixels=new unsigned char[w*h*bytes_per_pixel];;  
          for (int i = 0; i < w*h; i++) {  
        int base = i * bytes_per_pixel;  
        int nBase = base*(scaleX*scaleY);  
  
         
        unsigned char r = pixels[nBase + 0];  
        unsigned char g = pixels[nBase + 1];  
        unsigned char b = pixels[nBase + 2];  
  
  
        nPixels[base + 0] = r;   
        nPixels[base + 1] = g;   
        nPixels[base + 2] = b;   
      }  
  
      
    pantalla.loadData(nPixels,w,h,GL_RGB);  
  

in draw()

  
  
pantalla.draw(50,50,w*scaleX,h*scaleY);  
  

Where pantalla is an ofTexture and peli a ofMovieplayer.
scaleX sets the number o times the information of pixels gets lost.
Keep scaleY==1; unless you want to get a repeated, croped (or some dsitortion else) image.
I just modified the example in the wiki:
http://wiki.openframeworks.cc/index.php-โ€ฆ-processing

Hope it helps.

Saludos

Thanks xumo it works.

The problem is that i canโ€™t obtain what iโ€™m looking form , a more efficient way to display several videos :frowning: