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()

    scaleX=5; //int  
    scaleY=1; //int  
    w=peli.width/scaleX; //int  
    h=peli.height/scaleY; //int  

in uptdate()

     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;   

in draw()


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:โ€ฆ-processing

Hope it helps.


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: