We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I have two questions with the below code:
import processing.video.*;
Movie myMovie;
void setup() {
size(600, 400);
frameRate(30);
myMovie = new Movie(this, "1.mp4");
myMovie.loop();
}
void draw() {
if (myMovie.available()) {
myMovie.read();
float x1 = map(mouseX, 0, width, 0, 3);
myMovie.speed(x1);
}
image(myMovie, 0, 0);
}
1) How can I make the video play backwards? If I write the following code, I get this error message: (Processing core video:14294): GStreamer-CRITICAL **: get_segment_set_seek: assertion 'start <= stop' failed
float x1 = map(mouseX, 0, width, -1, 3)
2) Is there a way to make the playback a little more smooth? There is a lengthy delay between when the mouse is moved and when the video changes playback speeds.
Answers
Since both of your map() & speed() depend on available(), response time isn't
frameRate(30);
.I'd also replace image() w/ set() for a tiny bit performance gain. B-)
I don't think that library got such feature. :(
If you got lotsa RAM, you might try to get() each read() into some List<PImage>.
Once playback is finished, display each PImage backwards:
Hi GoToLoop,
Thanks for your response.
After doing a little more reading, it looks like the inability to play the video backwards is because of the codec I'm using--so that solves that issue.
I'm still a little cofused as to how to solve the jittery playback though.
I understand that what you're saying is that both my map() and speed() depend on available(), and so it's slowing things down. Is there a way to solve that problem?
Thanks!
frameRate(30);
, map()'s calculation + speed() modification only happen once a new frame becomes available().if ()
block.Thanks for your feedback, and for clarifying your last post.
Unfortunately, I've tried moving them out of the if block, but it still doesn't seem to solve the problem: