I have been using CarrierWave for file uploads on a site which needs to accept a really wide range of different movie formats, stills, PDFs... And I have been struggling with making thumbnails of certain formats. After much yak-shaving with ffmpeg and imagemagick and Rmagick, I finally decided to do a little spike app with nothing but Paperclip. I set up the simplest thing that could possibly work:
has_attached_file :blob, :styles => { :thumb => ["320x320>", :png], :large => ["1500x1500>", :png] }
And no matter what format (within reason) I pass to it, I get a nicely formed PNG format thumbnail and large preview image. PSD, PDF, TIFF, MOV, M4V -- it Just Works™. And I cannot figure out how it is doing this, despite reading through the source code for quite a while.
The reason why I need to access the magic is that while I am getting a nice thumbnail from any movie format I pass in, I am getting the very first frame of the movie (usually black) rather than a few seconds into the clip. In my CarrierWave converter, I had a custom offset time defined for this. But I cannot see where Paperclip is defining what to do with a video to generate a PNG image so I can alter this default.
There are tons of examples on SO and the Web in general, showing how to create a custom video thumbnailer and transcoder, but I would like to avoid rebuilding this wheel that Paperclip seems to have hewn out of pure Elven magick.
Thanks in advance,
Walter