Sha256: 32f2eb1a478415332d330aa6c61c75d7b545eee7c941fee0442518a793d6db3e

Contents?: true

Size: 1.37 KB

Versions: 4

Compression:

Stored size: 1.37 KB

Contents

class Transcode < XMorph::Base

  SCALE_TO_720p = "720"

  def set_profiles
    self.profiles = {
      SCALE_TO_720p => "ffmpeg -y -i %{IN} -vf \"fps=fps=29.970000,scale=1280x720\" -pix_fmt yuv420p -vcodec h264 -g 13 -bf 2 -x264opts nal-hrd=cbr -profile:v high -vb 8000000 -minrate:v 8000000 -maxrate:v 8000000-bufsize:v 24000000 -ar 48000 -acodec libfdk_aac -profile:a aac_low -ab 192k -map 0:v -map 0:a:0 -muxrate 8600000 -streamid 0:2064 -streamid 1:2068 -vsync 1 -async 1 %{OUT}",
    }
  end

  def video_checks
    {
      ALLOWED_ASPECT_RATIO => ["16:9"],
      ALLOWED_HEIGHT => [720],
      ALLOWED_WIDTH => [1280], 
      ALLOWED_FRAME_RATE => IGNORE,
      ALLOWED_VIDEO_BIT_RATE => IGNORE, #Mbps
      ALLOWED_SCAN_TYPE => IGNORE, #all downcased
    }
  end

  def audio_checks
    {
      PRESENCE_OF_AUDIO_TRACK => VALIDATE,
      ALLOWED_NUMBER_OF_AUDIO_TRACKS => [1],
      ALLOWED_AUDIO_CODECS => ["aac"],
      ALLOWED_AUDIO_BIT_RATE => IGNORE,
      ALLOWED_NUMBER_OF_AUDIO_CHANNELS => [2],
    }
  end

  # Classification is based on Height 
  # Videos with height greater than 720 are transcoded as 1920p
  # Videos with height 720 or lesser are transcoded as 720p
  def set_profile_name
    self.profile_name = SCALE_TO_720p
    XMorph::Base.logger.debug("XMorph#set_profile_name#kalpnik: using profile #{self.profile_name}") unless self.profile_name.nil?
    return true
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
xmorph-0.1.6 lib/xmorph/customers/kalpnik/kalpnik/transcode.rb
xmorph-0.1.5 lib/xmorph/customers/kalpnik/kalpnik/transcode.rb
xmorph-0.1.4 lib/xmorph/customers/kalpnik/kalpnik/transcode.rb
xmorph-0.1.3 lib/xmorph/kalpnik/kalpnik/transcode.rb