Class: DragonflyVideo::Processors::Screenshot

Inherits:
Object
  • Object
show all
Defined in:
lib/dragonfly_video/processors/screenshot.rb

Constant Summary collapse

FFMPEG_COMMAND =
'ffmpeg'.freeze

Instance Method Summary collapse

Instance Method Details

#call(content, options = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/dragonfly_video/processors/screenshot.rb', line 10

def call(content, options = {})
  format = options.delete(:format) { :jpg }

  content.shell_update(ext: format) do |old_path, new_path|
    "#{FFMPEG_COMMAND} -y -i #{old_path} -vframes 1 #{new_path}"
  end

  content.ext = format
  content
end

#update_url(attrs, options = {}) ⇒ Object



21
22
23
24
# File 'lib/dragonfly_video/processors/screenshot.rb', line 21

def update_url(attrs, options = {})
  format = options.fetch(:format, :jpg)
  attrs.ext = format.to_s
end