module VideoBlur::Runner
Public Class Methods
execute(path:, options:)
click to toggle source
# File lib/video_blur/runner.rb, line 3 def self.execute(path:, options:) path = path.first validate(path: path, options: options) screen = VideoBlur::Screen.new(width: options[:screen_width], height: options[:screen_height]) video = VideoBlur::Video.new(input: path, output: options[:output]) box = VideoBlur::Box.new(x: options[:x], y: options[:y], width: options[:width], height: options[:height], ratio: screen.ratio(video: video)) VideoBlur::Blur.new(video: video, box: box).perform end
validate(path:, options:)
click to toggle source
# File lib/video_blur/runner.rb, line 23 def self.validate(path:, options:) abort("Missing path to video") if path.nil? || path.empty? abort("Video file not found: #{@input}") unless File.exists?(path) abort("Missing box options") unless options[:x] && options[:y] && options[:width] && options[:height] end