You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I would like to generate 10 thumbnails from the loaded video,
but without having to play the video (with a semi manual workflow...)
I tried to set the player position into a for loop but it seems, that video position is not updated if not "really playing".
All the output thumbs are the same image frame.
(Then current being drawn frame)
That's my approach:
voiddoGenerateThumbnails()
{
ofImageType type = OF_IMAGE_COLOR;
int n = 10;//thumbnails amountfor (int i = 0; i < n; i++)
{
float p = i * (1.0f / n);
player.stop();//trying to force refresh
player.setPosition(p);
//trying tricks//ofGetAppPtr()->update();//ofGetAppPtr()->draw();
player.play();//trying to force refresh
player.update();//trying to force refresh
ofTexture* t = player.getTexture();
int w = t->getWidth();
int h = t->getHeight();
ofFbo fbo;
fbo.allocate(w, h);
fbo.begin();
ofClear(0);
player.draw(0, 0);
fbo.end();
ofPixels pix;
pix.allocate(w, h, type);
fbo.readToPixels(pix);
ofImage img;
img.allocate(w, h, type);
img.setFromPixels(pix);
img.update();
img.saveImage(ofToString(i) + ".jpg");
}
}
Any idea or workaround?
The text was updated successfully, but these errors were encountered:
Hello,
I would like to generate 10 thumbnails from the loaded video,
but without having to play the video (with a semi manual workflow...)
I tried to set the player position into a for loop but it seems, that video position is not updated if not "really playing".
All the output thumbs are the same image frame.
(Then current being drawn frame)
That's my approach:
Any idea or workaround?
The text was updated successfully, but these errors were encountered: