Trying to resize video from ipCapture - Processing (AndroidMode)

I am streaming mjpg video over http .

It works fine if the resolution of the video I am streaming is the same as the phones resolution (I’m displaying it on the background). The library ipcapture inhereits methods from PImage such as resize , but it doesn’t work to me and the app crashes at cam.read().

IPCapture cam;

void setup() {
  size(800, 480);//resolution of the phone
  orientation(LANDSCAPE);
  cam = new IPCapture(this, "http://"+R2B2ip+"/?action=stream", "", "");
  cam.start();
}

void draw() {
  if (cam.isAvailable()) {
    //cam.resize(800,480); 
    cam.read();
    background(cam);
  }
  else{
    print("fail");
  }

So, if I stream in 800x480 this will work just fine, yet if i change the phones resolution or the resolution i’m streaming in, it doesn’t work, even if I try to use the resize(x,y) function. Any ideas?

Error I get

1 Like

The error says no such method. I looked into the class on github, and I couldn’t find a method resize. So I think you have to find out a work around.
Just a wild guess. Declare PImage img;
img = cam.read();
img.resize(800,400);

Thanks for answering.
What you propose its not correct since read() is a void. I actually posted this yesterday but my account wasn’t validated until today. I’ve found this post which should solve my problem but it just makes it a little bit better. I’ve made a comment with my current problem there.

It’s a little bit old, but I’m hoping I can get some help

1 Like