Module: Hydra::Derivatives::Ffmpeg::ClassMethods

Defined in:
lib/hydra/derivatives/ffmpeg.rb

Instance Method Summary collapse

Instance Method Details

#encode(path, options, output_file) ⇒ Object



38
39
40
41
42
43
44
45
46
47
# File 'lib/hydra/derivatives/ffmpeg.rb', line 38

def encode(path, options, output_file)
  command = "#{Hydra::Derivatives.ffmpeg_path} -y -i \"#{path}\" #{options} #{output_file}"
  stdin, stdout, stderr, wait_thr = popen3(command)
  stdin.close
  out = stdout.read
  stdout.close
  err = stderr.read
  stderr.close
  raise "Unable to execute command \"#{command}\"\n#{err}" unless wait_thr.value.success?
end