Quantcast
Channel: Library Questions - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 2896

Getting audio and video in sync

$
0
0

Hi,

I have some code to play a video with different soundtracks (or sometimes no sound) and I can't seem to get them in sync. The sound plays noticeably behind the video, maybe by about a third to a half of a second. Any ideas?

import processing.video.*;
import processing.sound.*;

Movie video;
SoundFile audio;

void setup() {
  size(640, 360);
  background(0);
  video = new Movie(this, "test.mp4");
  audio = new SoundFile(this, "test.mp3");

  video.play();
  audio.play();

}

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

void draw() {
  image(video, 0, 0, width, height);
}

Viewing all articles
Browse latest Browse all 2896

Trending Articles