Anyway to fix video stuttering on Raspberry Pi 3?

Hi, I’m making an IR sensor triggered video installation (Processing 3 on Pi 3) and the videos (not even high-res) look quite stuttering for some reason.

I know that Pis have pretty shitty visual performance but no way it’s so bad. When I played the videos in the video player on the Pi (not in Processing), they run smoothly.

I tried to increase the GPU a little etc. Nothing helps.
Anyone has any idea how to solve this?

The code is very simple:
mouth 0 = video of a mouth closed
mouth 1 = video of a mouth open

import processing.video.*;
import processing.io.*;

Movie mouth0, mouth1;
int playing = 0;


void setup() {
 fullScreen();
    noCursor();
    background(0);
    frameRate(24);
    
  GPIO.pinMode(17, GPIO.INPUT_PULLUP);
  
  //size(480, 270);
  background(0);
  mouth0 = new Movie(this, "mouth0.mov");
  mouth1 = new Movie(this, "mouth1.mov");
}

void movieEvent(Movie m) { 
  m.read();
} 

void draw() {  
  println(playing);
  if(playing==0){ 
      mouth0.loop();
      image(mouth0, 0, 0, width, height);
      println("mouth0 playing");
  }else{
      mouth0.stop();
      mouth1.play(); 
      image(mouth1, 0, 0, width, height);
      println("mouth1 playing");
      if (abs(mouth1.duration()-mouth1.time()) < .05){
        mouth1.stop();
        playing = 0;
        //VideoPlaying = 0;
      } 
  }
  sensor();
}

void sensor() {
  if (GPIO.digitalRead(17) == GPIO.LOW) {
    playing = 1;
  }
}