Technique to generate thumbnails from a lot of videos

Hi all

Does anyone know a good technique to generate thumbnails from a lot of videos?

In my head I was thinking

  • Load a video
  • Skip a few frames forward in time
  • Output the thumbnail image
  • Repeat for the next video

Too me this seems very inefficient. Do you know a better way?

Cheers
Az

OF 0.8, VS2012

anyone?

hi,
that is quite straight forwards indeed. Obviously if it is done by hand it would be very inefficient, but you can code it all with just a few lines.
it should be something like this

string videosFolder = "the_folder_where_your_video_files_are";
ofDirectory dir;
dir.allowExt("mov");//change this to use different files. Duplicate this line to add more filetypes.
dir.listDir(videosFolder);
ofVideoPlayer tmp;
for(int i =0; i < dir.size(); i++){
string videoPath = dir.getPath(i);
tmp.loadMovie(videoPath);
tmp.play();
tmp.setPosition(0.1);
img.setFromPixels( tmp.getPixelsRef() );
float thumbWidth = 120;//change this for another thumb size
img.resize(thumbWidth, thumbWidth * (img.getHeight() / img.getWidth()) );
img.saveImage("thumbs/"+ofFilePath::getBaseName(videoPath) + ".jpg");
}

best.

cheers