Class: CarrierWave::Video::FfmpegTheora
- Inherits:
-
Object
- Object
- CarrierWave::Video::FfmpegTheora
- Defined in:
- lib/carrierwave/video/ffmpeg_theora.rb
Instance Attribute Summary collapse
-
#input_path ⇒ Object
readonly
Returns the value of attribute input_path.
-
#output_path ⇒ Object
readonly
Returns the value of attribute output_path.
Instance Method Summary collapse
-
#initialize(input_file_path, output_file_path) ⇒ FfmpegTheora
constructor
A new instance of FfmpegTheora.
- #run(logger = nil) ⇒ Object
Constructor Details
#initialize(input_file_path, output_file_path) ⇒ FfmpegTheora
Returns a new instance of FfmpegTheora.
5 6 7 8 |
# 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 |
Instance Attribute Details
#input_path ⇒ Object (readonly)
Returns the value of attribute input_path.
4 5 6 |
# File 'lib/carrierwave/video/ffmpeg_theora.rb', line 4 def input_path @input_path end |
#output_path ⇒ Object (readonly)
Returns the value of attribute output_path.
4 5 6 |
# File 'lib/carrierwave/video/ffmpeg_theora.rb', line 4 def output_path @output_path end |
Instance Method Details
#run(logger = nil) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# 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 |