Sha256: 32be7cb38ed08edae8d172b07ec82e3878950ebdf322bb5ace340a0e009ef8e5

Contents?: true

Size: 604 Bytes

Versions: 7

Compression:

Stored size: 604 Bytes

Contents

require 'open3'

module Hydra::Derivatives
  class AudioEncoder
    def initialize
      @ffmpeg_output = Open3.capture3('ffmpeg -codecs').to_s
    rescue StandardError
      Logger.warn('Unable to find ffmpeg')
      @ffmpeg_output = ""
    end

    def audio_encoder
      audio_encoder = if fdk_aac?
                        'libfdk_aac'
                      else
                        'aac'
                      end
      audio_encoder
    end

    private

      def fdk_aac?
        @ffmpeg_output.include?('--enable-libfdk-aac') || @ffmpeg_output.include?('--with-fdk-aac')
      end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
hydra-derivatives-3.7.0 lib/hydra/derivatives/audio_encoder.rb
hydra-derivatives-3.6.1 lib/hydra/derivatives/audio_encoder.rb
hydra-derivatives-3.6.0 lib/hydra/derivatives/audio_encoder.rb
hydra-derivatives-3.5.0 lib/hydra/derivatives/audio_encoder.rb
hydra-derivatives-3.4.2 lib/hydra/derivatives/audio_encoder.rb
hydra-derivatives-3.4.1 lib/hydra/derivatives/audio_encoder.rb
hydra-derivatives-3.4.0 lib/hydra/derivatives/audio_encoder.rb