Loop section of video

Hello people,

First of, I’m a total noob, so if anything I say is obvious or stupid, I hereby apologise.

For a university project I’m trying to make an interactive (Think Bandersnatch) video that branches into different clips depending on several variables. For this I’m going to be using an arduino with a heart rate sensor and a gyroscope, through serial communication with processing.

Before I get into this part however, I first decided to try and make my ‘decision point’ in the video loop until a decision is made, or at least for a certain number of loops, until (through clicking or the heart rate/gyro values) the next clip starts.

I realise some of this might be a bit too hard for me as a total beginner, so that’s why I’m focusing on getting a simple loop going first. I would like this loop to start at a certain time code, and loop a specific section of ten seconds with a vide/audio fade to make it smoother.

I have been able to make a video player, but have only succeeded at infinitely looping the full video, rather than a short section. Can anyone give me an example/advice on how to loop a specific section of a video?

(So basically the video file should just play normally, until a specific time code is reached after which it should loop a 10-15 second bit after that.)
Below is what I have so far.

Thanks so much for your time,


import processing.serial.*;

Serial myPort;
String myBPM="";

import processing.video.*;

String PATH = "/Users/follydentoom/Movies/Render Interactive Project Prototype/Fixed 2.0/Daan Slaapt Wide 1.mp4";
Movie mov;

String PATH1 = "/Users/follydentoom/Movies/Render Interactive Project Prototype/Fixed 2.0/Daan Slaapt Wide 1_1.mp4";
Movie mov1;

String PATH2 = "/Users/follydentoom/Movies/Render Interactive Project Prototype/Fixed 2.0/gele pil-.mp4";
Movie mov2;

void setup() {
  size(1920, 1080);
mov = new Movie(this, PATH);



void movieEvent(Movie m) {

void draw() {
  image(mov,0,0, width , height);
1 Like


Welcome to the community. :slightly_smiling_face:
First of all, you can format your code by pressing Ctrl+T in the Processing IDE code editor and on the forum when you edit your message, use the </> button to insert code.

I think you can use the function .jump(where) so when your video is going over a certain time code, you jump to the beginning :

if (myMovie.time() > 1.0){ //Over 1 second
1 Like