Video import and export - speed problems

Hello everybody!
i have some problems with a project. i’m trying to import a video, play it back and record the sketch, with the video being played (and some extras i excluded becaus eit doesn’t matter).

so far i get the video played and also exported. but in the exported video, the playback of the video is way to fast.
when i decide to export like 3 seconds, the playbackvideo get’s played more seconds, but compressed into these 3 seconds.
and i don’t know how to resolve this.
maybe someone can help.

BTW: i’m new to processing, so please be gentle with me :slight_smile:


// import video library
import processing.video.*;
import com.hamoid.*; 

Movie movie;
VideoExport videoExport; // Video Export Objekt


String movie_path = "video path";

float movieFPS = 30;
float duration = 3.; // in seconds

// video scaling
float video_scalar = 0.55;

void setup()
{
  size(1080, 1350);

  movie = new Movie(this, movie_path);
  movie.play();
  movie.speed(1);
  
  videoExport = new VideoExport(this, "output_video.mp4"); // Initialisiere den Export mit dem Dateinamen
  videoExport.setFrameRate(movieFPS);
  videoExport.startMovie(); 
  frameRate(movieFPS);    
}

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

void draw() {
  background(200);
  
  // show video
  imageMode(CENTER);
  fill(50, 75, 255, 200);
  noStroke();
  rect(275, 175, movie.height * video_scalar, movie.width * video_scalar);

  pushMatrix(); // Speichere die aktuelle Matri
  
  translate(width/2, height/2);
  imageMode(CENTER);
  rotate(PI/2);
    
  image(movie, 0, 0, movie.width * video_scalar, movie.height * video_scalar);
  popMatrix(); // Stelle die gespeicherte Matrix wieder her
  
  
  // video export
  videoExport.saveFrame();
  
  // End when we have exported enough frames 
  // to match the sound duration.
  if(frameCount > round(movieFPS * duration)) {
    videoExport.endMovie();
    exit();
  }  
}