Sha256: 89cfd2a79f7383d6b609e43f7d22ce3c400e7c7b55156800165a2b44969647cf

Contents?: true

Size: 725 Bytes

Versions: 6

Compression:

Stored size: 725 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]  if options
          inopts ||= "-y"
          outopts = options[OUTPUT_OPTIONS]  if options
          outopts ||= options
          execute "#{Hydra::Derivatives.ffmpeg_path} #{inopts} -i \"#{path}\" #{outopts} #{output_file}"
        end
      end

    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
hydra-derivatives-1.0.0 lib/hydra/derivatives/ffmpeg.rb
hydra-derivatives-1.0.0.rc1 lib/hydra/derivatives/ffmpeg.rb
hydra-derivatives-1.0.0.beta1 lib/hydra/derivatives/ffmpeg.rb
hydra-derivatives-0.1.1 lib/hydra/derivatives/ffmpeg.rb
hydra-derivatives-0.1.0 lib/hydra/derivatives/ffmpeg.rb
hydra-derivatives-0.0.8 lib/hydra/derivatives/ffmpeg.rb