/** * Raw. * * Gets raw data frames from video stream, without any color conversion. */ import codeanticode.gsvideo.*; GSPlayer video; PImage img; void setup() { size(1280, 720); video = new GSPlayer(this, "/Volumes/Reservoir/Assets/Video/boat on ocean at night.mov", GSVideo.RAW); // video = new GSPlayer(this, "station.mov", GSVideo.RAW); video.loop(); img = new PImage(720, 480, RGB); } void playerEvent(GSPlayer player) { player.read(); } void draw() { // The raw frame data is stored in video.data, which is a byte array. // video.dataCaps is a string containing info about the incoming data. image(img, 0, 0); if (video.data != null) { // println("Data size: " + video.data.length); // println("Data caps: " + video.dataCaps); img.loadPixels(); for(int x=0;x<720;x++) for(int y=0;y<240;y++) { img.pixels[x+y*480]=video.data[x+y*240]; } img.updatePixels(); } }