class CarrierWave::Video::FfmpegTheora
Attributes
input_path[R]
output_path[R]
Public Class Methods
new(input_file_path, output_file_path)
click to toggle source
# File lib/carrierwave/video/ffmpeg_theora.rb, line 5 def initialize(input_file_path, output_file_path) @input_path = input_file_path @output_path = output_file_path end
Public Instance Methods
run(logger=nil)
click to toggle source
# File lib/carrierwave/video/ffmpeg_theora.rb, line 10 def run(logger=nil) cmd = "#{CarrierWave::Video.ffmpeg2theora_binary} #{input_path} -o #{output_path}" logger.info("Running....#{cmd}") if logger outputs = [] exit_code = nil Open3.popen3(cmd) do |stdin, stdout, stderr, wait_thr| stderr.each("r") do |line| outputs << line end exit_code = wait_thr.value end handle_exit_code(exit_code, outputs, logger) end
Private Instance Methods
handle_exit_code(exit_code, outputs, logger)
click to toggle source
# File lib/carrierwave/video/ffmpeg_theora.rb, line 27 def handle_exit_code(exit_code, outputs, logger) return unless logger if exit_code == 0 logger.info("Success!") else outputs.each do |output| logger.error(output) end logger.error("Failure!") end exit_code end