# Anyway to fix video stuttering on Raspberry Pi 3?

**URL:** <https://discourse.processing.org/t/anyway-to-fix-video-stuttering-on-raspberry-pi-3/39208>\
**Category:** Processing for Pi\
**Created:** [October 10, 2022, 10:44pm UTC](https://discourse.processing.org/t/anyway-to-fix-video-stuttering-on-raspberry-pi-3/39208 "2022-10-10T22:44:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nitrocaphane](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/nitrocaphane/32/16885_2.png) [@nitrocaphane](https://discourse.processing.org/u/nitrocaphane)\
**Post date:** [October 10, 2022, 10:44pm UTC](https://discourse.processing.org/t/anyway-to-fix-video-stuttering-on-raspberry-pi-3/39208/1 "2022-10-10T22:44:45Z")

</div>

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

```auto
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;
  }
}

```
