Skip to content

Commit

Permalink
improved make logging
Browse files Browse the repository at this point in the history
  • Loading branch information
PeteMichaud committed Sep 28, 2012
1 parent e9c3b6a commit b59cd6e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/paperclip_processors/ffmpeg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,14 @@ def initialize file, options = {}, attachment = nil
def make
Paperclip.log("[ffmpeg] Making...") if @whiny
src = @file
Paperclip.log("[ffmpeg] Building Destination File: '#{@basename}' + ''#{@format}'") if @whiny
Paperclip.log("[ffmpeg] Building Destination File: '#{@basename}' + '#{@format}'") if @whiny
dst = Tempfile.new([@basename, @format ? ".#{@format}" : ''])
Paperclip.log("[ffmpeg] Destination File Built") if @whiny
dst.binmode

parameters = []

Paperclip.log("[ffmpeg] Adding Geometry") if @whiny
# Add geometry
if @geometry
# Extract target dimensions
Expand Down Expand Up @@ -103,20 +105,24 @@ def make
end
end
end

Paperclip.log("[ffmpeg] Adding Format") if @whiny
# Add format
case @format
when 'jpg', 'jpeg', 'png', 'gif' # Images
@convert_options[:input][:ss] = @time
@convert_options[:output][:vframes] = 1
@convert_options[:output][:f] = 'image2'
end


Paperclip.log("[ffmpeg] Adding Source") if @whiny
# Add source
parameters << @convert_options[:input].map { |k,v| "-#{k.to_s} #{v} "}
parameters << "-i :source"
parameters << @convert_options[:output].map { |k,v| "-#{k.to_s} #{v} "}
parameters << ":dest"

Paperclip.log("[ffmpeg] Building Parameters") if @whiny
parameters = parameters.flatten.compact.join(" ").strip.squeeze(" ")

Paperclip.log("[ffmpeg] #{parameters}")
Expand Down

0 comments on commit b59cd6e

Please sign in to comment.