Module: Jack::Tasks::Ffmpeg

Included in:
Jack::Tasks
Defined in:
lib/jack/tasks/ffmpeg.rb

Instance Method Summary collapse

Instance Method Details

#convert_to_flv(filename, size, output = nil, options = {}) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/jack/tasks/ffmpeg.rb', line 14

def convert_to_flv(filename, size, output = nil, options = {})
  if output.is_a?(Hash)
    options = output
    output  = nil
  end
  default = {:rate => 25, :acodec => :mp3, :frequency => 22050, :overwrite => true, :size => size, :file => (output || filename + ".flv")}
  ffmpeg filename, default.update(options)
  options[:file]
end

#ffmpeg(input, options = {}) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/jack/tasks/ffmpeg.rb', line 6

def ffmpeg(input, options = {})
  cmd = ['ffmpeg']
  input = { :file => input } unless input.is_a?(Hash)
  ffmpeg_options :input,  cmd, input
  ffmpeg_options :output, cmd, options
  execute_command cmd.join(" ")
end

#grab_screenshot_from(filename, size, output = nil, options = {}) ⇒ Object



24
25
26
27
28
29
30
31
32
# File 'lib/jack/tasks/ffmpeg.rb', line 24

def grab_screenshot_from(filename, size, output = nil, options = {})
  if output.is_a?(Hash)
    options = output
    output  = nil
  end
  default = {:vframes => 1, :format => :image2, :disable_audio => true, :size => size, :file => (output || filename + ".jpg")}
  ffmpeg filename, default.update(options)
  options[:file]
end