Hi
I'm trying to run multiple simultaneous movie files (at independent starting point) to represent letters.
(1) once I'm increasing the size or am run more than 15 videos, the frame rate drops to 3-5. any easy way to avoid that? (2) as a workaround, I thought about recording the video, but it seems like it's sampling the movie files according to time intervals (for example frames 7, 14, 21 and not go through every frame of the movie file).
I want to either display the video files in a reasonable framerate (~20) or record all frames from the movie files. Any ideas?
String str = "אוטובוס הקסמים יוצא להרפתקה חדשה";
int wordsNum = 1;
int t = 0;
int[] wordsLength;
float fontMultiplier = 2;
float kerning = -130*fontMultiplier;
float leading =-60;
float charLocation = 0;
float lineLocation = 0;
float fontHeight = 122*fontMultiplier;
float fontWidth = 160*fontMultiplier;
float horMargin = 100;
float vertMargin = 100;
Movie[] currentLetter;
import processing.video.*;
void setup() {
size(1200, 900);
//frameRate(2);
// finding out how many words are there (important for the wordsLength array)
for (int i = 0; i<str.length(); i++) {
if (str.charAt(i)==' ') {
wordsNum++;
}
}
println("number of words is: ", wordsNum);
int letCount = 0;
wordsLength = new int[wordsNum];
for (int i = 0; i<str.length(); i++) {
if (str.charAt(i)==' ') {
wordsLength[t]=letCount;
letCount=0;
t++;
} else {
letCount++;
}
}
println(wordsLength);
currentLetter = new Movie[str.length()];
for (int i=0; i<str.length(); i++) {
if(str.charAt(i)!=' '){
currentLetter[i] = new Movie(this, str.charAt(i)+".mov");
//currentLetter[i].frameRate(2);
currentLetter[i].loop();
currentLetter[i].jump(random(0,3));
}
else{
currentLetter[i] = new Movie(this, "space.mov");
}
}
t=0;
}
void draw() {
background(255);
blendMode(MULTIPLY);
charLocation = 0;
lineLocation = 0;
t = 0;
for (int let = 0; let < str.length(); let++) {
float letterxLocation = width-horMargin+charLocation-fontWidth;
image(currentLetter[let], letterxLocation, vertMargin+lineLocation, fontWidth, fontHeight);
// Character Location
charLocation = charLocation - fontWidth - kerning;
// checking if it's a new word
if (str.charAt(let)==' ' && t < wordsNum) {
// creatng a new line
if (width-horMargin+charLocation-wordsLength[t]*(fontWidth+kerning) < horMargin) {
charLocation = 0;
lineLocation = lineLocation + fontHeight + leading;
}
t++;
}
}
fill(0);
textSize(16);
text("Frame rate: " + int(frameRate), 10, 20);
// saveFrame("output/framer_####.jpg");
}
void movieEvent(Movie m) {
m.read();
}