Sha256: c3bb9b1a85467e9a1556dc595b263753e3b394e57caf3f015081f4913b78e8bb

Contents?: true

Size: 918 Bytes

Versions: 28

Compression:

Stored size: 918 Bytes

Contents

# frozen_string_literal: true

module Ehbrs
  module Videos
    module Unsupported
      module Fixes
        class SupportedCodec
          TRACK_TYPE_OPTIONS = {
            audio: '-acodec',
            video: '-vcodec',
            subtitle: '-scodec'
          }.freeze

          TRACK_TYPE_FIX_CODECS = {
            audio: 'aac',
            video: 'libx264',
            subtitle: 'ass'
          }.freeze

          def ffmpeg_args(track)
            ["#{track_codec_option_by_type(track.codec_type)}:#{track.index}",
             track_codec_fix_by_type(track.codec_type)]
          end

          def track_codec_option_by_type(track_type)
            TRACK_TYPE_OPTIONS.fetch(track_type.to_s.underscore.to_sym)
          end

          def track_codec_fix_by_type(track_type)
            TRACK_TYPE_FIX_CODECS.fetch(track_type.to_s.underscore.to_sym)
          end
        end
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
ehbrs-tools-0.25.0 lib/ehbrs/videos/unsupported/fixes/supported_codec.rb
ehbrs-tools-0.24.0 lib/ehbrs/videos/unsupported/fixes/supported_codec.rb
ehbrs-tools-0.23.1 lib/ehbrs/videos/unsupported/fixes/supported_codec.rb
ehbrs-tools-0.23.0 lib/ehbrs/videos/unsupported/fixes/supported_codec.rb
ehbrs-tools-0.22.0 lib/ehbrs/videos/unsupported/fixes/supported_codec.rb
ehbrs-tools-0.21.0 lib/ehbrs/videos/unsupported/fixes/supported_codec.rb
ehbrs-tools-0.20.0 lib/ehbrs/videos/unsupported/fixes/supported_codec.rb
ehbrs-tools-0.19.0 lib/ehbrs/videos/unsupported/fixes/supported_codec.rb