class CherryPickingMoments::Parapara

Attributes

output_path[R]

Public Class Methods

new(file, rate: 3) click to toggle source
# File lib/cherry_picking_moments/parapara.rb, line 9
def initialize(file, rate: 3)
  @file = file
  @rate = rate
  @output_path = Dir.tmpdir
end

Public Instance Methods

slice!() click to toggle source
# File lib/cherry_picking_moments/parapara.rb, line 15
def slice!
  FileUtils.mkdir_p(@output_path)
  cmd = "ffmpeg -ss 0 -i #{@file} -vsync 2 -r #{@rate} -an -f image2 '#{File.join(@output_path, "%04d.png")}'"
  Open3.capture3(cmd)
end