Sha256: e0ee7131e28d265a224bb759058d74627de4daf803e9313b3cf1640aa85a3a2e

Contents?: true

Size: 661 Bytes

Versions: 4

Compression:

Stored size: 661 Bytes

Contents

# An abstract class for asyncronous jobs that transcode files using FFMpeg

require 'tmpdir'
require 'open3'

module Hydra
  module Derivatives
    module Ffmpeg
      extend ActiveSupport::Concern

      INPUT_OPTIONS=:input_options
      OUTPUT_OPTIONS=:output_options

      included do
        include ShellBasedProcessor
      end


      module ClassMethods

        def encode(path, options, output_file)
          inopts = options[INPUT_OPTIONS] ||= "-y"
          outopts = options[OUTPUT_OPTIONS] ||= ""
          execute "#{Hydra::Derivatives.ffmpeg_path} #{inopts} -i \"#{path}\" #{outopts} #{output_file}"
        end
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hydra-derivatives-1.2.1 lib/hydra/derivatives/ffmpeg.rb
hydra-derivatives-1.2.0 lib/hydra/derivatives/ffmpeg.rb
hydra-derivatives-2.0.0 lib/hydra/derivatives/ffmpeg.rb
hydra-derivatives-1.1.0 lib/hydra/derivatives/ffmpeg.rb