Class: Ehbrs::Videos::Unsupported::Fixes::SupportedCodec

Inherits:
Object
  • Object
show all
Defined in:
lib/ehbrs/videos/unsupported/fixes/supported_codec.rb

Constant Summary collapse

TRACK_TYPE_OPTIONS =
{
  audio: '-acodec',
  video: '-vcodec',
  subtitle: '-scodec'
}.freeze
TRACK_TYPE_FIX_CODECS =
{
  audio: 'aac',
  video: 'libx264',
  subtitle: 'ass'
}.freeze

Instance Method Summary collapse

Instance Method Details

#ffmpeg_args(track) ⇒ Object



20
21
22
23
# File 'lib/ehbrs/videos/unsupported/fixes/supported_codec.rb', line 20

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

#track_codec_fix_by_type(track_type) ⇒ Object



29
30
31
# File 'lib/ehbrs/videos/unsupported/fixes/supported_codec.rb', line 29

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

#track_codec_option_by_type(track_type) ⇒ Object



25
26
27
# File 'lib/ehbrs/videos/unsupported/fixes/supported_codec.rb', line 25

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