Introduction

Examples

Advanced use

Documentation

Installation

Downloads

Browse source

Forums

Tracker

Wiki

Blog





GSVideo attempts to be API compatible with the core video library of Processing. This means that the classes in GSVideo have the same methods as their conterparts in the core library. This simplifies the task of switching back and forth between both libraries.

Since GSVideo is based on GStreamer, which is an extremely modular and extensible multimedia framework, it is possible that GSVideo will incorporate additional features that expand the basic funcionalities of the core video library.

Movie playback

The class for movie playback is called GSMovie and is a descendant of the PImage class, this means that the video frames can be rendered as a regular image. The movieEvent() function allows to update the movie object every time there is a new frame available:

import codeanticode.gsvideo.*;

GSMovie myMovie;

void setup() {
size(640, 480, P3D);
background(0);
// Load and play the video in a loop
myMovie = new GSMovie(this, "station.mov");
myMovie.loop();
}
void movieEvent(GSMovie myMovie) {
myMovie.read();
}

void draw() {
tint(255, 20);
image(myMovie, mouseX-myMovie.width/2, mouseY-myMovie.height/2);
}

Alternatively, the movie could be updated inside the draw() function by using the available() method:

void draw() {
if (myMovie.available()) {
myMovie.read();
tint(255, 20); 
image(myMovie, mouseX-myMovie.width/2, mouseY-myMovie.height/2);
}
}

Video capture

Grabbing video data from devices such as webcams is possible with the GSCapture object:

import codeanticode.gsvideo.*;

GSCapture cam;

void setup() {
size(640, 480);

cam = new GSCapture(this, 320, 240);
}

void draw() {
if (cam.available() == true) {
cam.read();
image(cam, 160, 100);
}
}

If no parameters are passed to the constructor of GSCapture, then the library will try to find the default capture device on each platform. However, the input device can be specified by passing its name:

cam = new GSCapture(this, 320, 240, "v4lsrc");

Parameters for the input device can also be specified as follows:

String[] parName = new String[0];
String[] parValue = new String[0];
parName[0] = "device";
parValue[0] = "/dev/video0";
capture = new GSCapture(this, 320, 240, "v4lsrc", parName, parValue);

Creating movies

There is a GLMovieMaker object included in the library, but at this point is not working. In future releases this object will reproduce the functionality of the MovieMaker class