Video data size limit error

I am running into an error when attempting to load video which is around 200MB in size.

allocation size overflow p5.dom.js:807:15

The error doesn’t occur with small videos.

please help, thanks

1 Like

What environment are you using?

p5.js + Firefox 62 + Linux Mint 18.3

Maybe I should share an example bit of code.

ar film;
var fx,fy,fw,fh;



function setup() {
  createCanvas(windowWidth, windowHeight);
  input = createFileInput(handleFile);
  input.position(0, 0);
  noLoop();
}

function draw() {
  background(0);
  image(film,fx,fy,fw,fh);
}

function vidLoad() {
  film.play();
  var ratio = width/height;
  var fratio = film.width/film.height;
  if(ratio > fratio)//screen is more wide
  {
    fh = height;
    fw = film.width * (height/film.height);
    fy = 0;
    fx = width/2-fw/2;
  }
  else //film is wider
  {
    fw = width;
    fh = film.height * (width/film.width);
    fy = height/2-fh/2;
    fx = 0;
  }
  input.hide();
  loop()
}

function handleFile(file) { 
  print(file.type); 
  if (file.type === 'video') 
  { 
    film = createVideo(file.data,vidLoad); 
    film.hide(); 
  } 
} 

function windowResized() {
  resizeCanvas(windowWidth, windowHeight);
  var ratio = width/height;
  var fratio = film.width/film.height;
  if(ratio > fratio)//screen is more wide
  {
    fh = height;
    fw = film.width * (height/film.height);
    fy = 0;
    fx = width/2-fw/2;
  }
  else //film is wider
  {
    fw = width;
    fh = film.height * (width/film.width);
    fy = height/2-fh/2;
    fx = 0;
  }
  scaleX = width/100;
  scaleY = height/100;
  trackW = width;
  trackH = height;
}
1 Like

It appears the file size limit for the p5.js editor is 5MB.

1 Like

Thank you, but I do not believe that is the issue I’m dealing with here. This issue also happens if I try to load the video from my assets, and I’m not really uploading here; I’m just selecting a local file. I can not imagine that all p5.js sketches are limited to using small videos only. I have it working with a 95MB video. I’m not sure where the exact cut off is.

Please help

I have solved this issue.

Very glad to hear it!

Was there a solution you could share that might help others in a similar situation?

3 Likes

Spongman created it: https://github.com/processing/p5.js/issues/3237#issuecomment-424436519

2 Likes