Method: WebVideo::Transcoder#screenshot

Defined in:
lib/web_video/transcoder.rb

#screenshot(destination, options = {}, &block) ⇒ Object

Create screenshots

transcoder = WebVideo::Transcoder.new(“demo.avi”) transcoder.screenshot(“demo.jpg”, :resolution => “480x360”)

options:

:count  - count images to generate
:format - image decoder
:at     - sets that image should be taken from the point x seconds from the beginning
:resolution - image resolution


46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/web_video/transcoder.rb', line 46

def screenshot(destination, options = {}, &block)
  options = { 
    :count => 1, 
    :format => "image2", 
    :at => "00:00:01" 
  }.merge(options.symbolize_keys)
  
  # Calculate middle video position
  if options[:at].is_a?(Symbol) && [:center, :middle].include?(options[:at])
    options[:at] = @source.duration_in_seconds / 2
  end
  
  process(destination, @source.screenshot_command, options, &block)
end