def make
src = @file
dst = Tempfile.new([ @basename, @target_format ].compact.join("."))
dst.binmode
begin
cmd = %Q[-itsoffset #{time_offset} -i :source -y -vcodec mjpeg -vframes 1 -an -f rawvideo ]
if scale_and_crop = transformation_options
cmd << %{pipe: | convert #{scale_and_crop} - #{target_format}:- }
else
cmd << %{-s #{target_geometry} pipe: }
end
cmd << %{| composite -gravity center :icon - :dest }
Paperclip.run('ffmpeg', cmd, :source => File.expand_path(src.path), :dest => File.expand_path(dst.path), :icon => AssetType.find(:video).icon_path, :swallow_stderr => false)
rescue PaperclipCommandLineError => e
raise PaperclipError, "There was an error processing the thumbnail for #{@basename}: #{e}" if whiny
end
dst
end