Class: Transcode

Inherits:
XMorph::Base show all
Defined in:
lib/xmorph/customers/cbn/cbn/transcode.rb,
lib/xmorph/customers/tyt/TYT/transcode.rb,
lib/xmorph/customers/dogtv/dogtv/transcode.rb,
lib/xmorph/customers/gusto/gusto/transcode.rb,
lib/xmorph/customers/hkitv/hkitv/transcode.rb,
lib/xmorph/customers/tern-cp/TCP/transcode.rb,
lib/xmorph/customers/zsports/asn/transcode.rb,
lib/xmorph/customers/lightning/LIG/transcode.rb,
lib/xmorph/customers/rewind/rewind/transcode.rb,
lib/xmorph/customers/sabatv/sabatv/transcode.rb,
lib/xmorph/customers/hungama/Hungama/transcode.rb,
lib/xmorph/customers/kalpnik/kalpnik/transcode.rb,
lib/xmorph/customers/scripps-cp/scpbu/transcode.rb,
lib/xmorph/customers/cinedigm/Cinedigm/transcode.rb,
lib/xmorph/customers/peopletv/peopletv/transcode.rb,
lib/xmorph/customers/curiosity/curiosity/transcode.rb,
lib/xmorph/customers/tastemade/tastemade/transcode.rb,
lib/xmorph/customers/shoutfactory/shoutfactory/transcode.rb,
lib/xmorph/customers/rooster-teeth/roosterteeth/transcode.rb,
lib/xmorph/customers/turner-nordic/TurnerNordic/transcode.rb

Constant Summary collapse

DEFAULT_COMMAND =
"DEFAULT_COMMAND"
CINEDIGM_CONTENT =
"cinedigm_content"
DEFAULT =
"default"
PROGRESSIVE =
"progressive"
INTERLACED =
"interlaced"
PRO_1080_16_TRACKS =
"1080_16"
PRO_1080_14_TRACKS =
"1080_14"
PRO_1080_8_TRACKS =
"1080_8_TRACKS"
PRO_1080_2_TRACKS =
"1080_2_TRACKS"
PRO_1080_STEREO =
"1080_STEREO"
PRO_720_STEREO =
"720_stereo"
ADD_AUDIO =
"add_audio"
MONO =
"mono"
STEREO =
"stereo"
REWRAP_COMMAND =
"rewrap_command"
SCALE_TO_720p =
"720"
SCALE_TO_720x480_4_3 =
"720x480_4_3"
SCALE_TO_720x480_16_9 =
"720x480_16_9"
SCALE_TO_1920x1080_16_9 =
"1920x1080_16_9"
SCALE_TO_720x480_3_2 =
"720x480_3_2"
HIGH_DEFINITION =
"HIGH_DEFINITION"
STANDARD_DEFINITION =
"STANDARD_DEFINITION"
PRO_4_3_STEREO =
"4_3_STEREO"
PRO_4_3_MORE_CH_4 =
"4_3_MORE_CH_4"
PRO_4_3_MORE_CH_8 =
"4_3_MORE_CH_8"
PRO_4_3_2_TRACKS =
"4_3_2_TRACKS"
PRO_4_3_4_TRACKS =
"4_3_4_TRACKS"
PRO_4_3_6_TRACKS =
"4_3_6_TRACKS"
PRO_4_3_8_TRACKS =
"4_3_8_TRACKS"
PRO_16_9_STEREO =
"16_9_STEREO"
PRO_16_9_MORE_CH_4 =
"16_9_MORE_CH_4"
PRO_16_9_MORE_CH_8 =
"16_9_MORE_CH_8"
PRO_16_9_2_TRACKS =
"16_9_2_TRACKS"
PRO_16_9_4_TRACKS =
"16_9_4_TRACKS"
PRO_16_9_6_TRACKS =
"16_9_6_TRACKS"
PRO_16_9_8_TRACKS =
"16_9_8_TRACKS"
PRO_1080_MORE_CH_4 =
"1080_MORE_CH_4"
PRO_1080_MORE_CH_8 =
"1080_MORE_CH_8"
PRO_1080_4_TRACKS =
"1080_4_TRACKS"
PRO_1080_6_TRACKS =
"1080_6_TRACKS"

Constants inherited from XMorph::Base

XMorph::Base::ALLOWED_ASPECT_RATIO, XMorph::Base::ALLOWED_AUDIO_BIT_RATE, XMorph::Base::ALLOWED_AUDIO_CODECS, XMorph::Base::ALLOWED_FRAME_RATE, XMorph::Base::ALLOWED_HEIGHT, XMorph::Base::ALLOWED_NUMBER_OF_AUDIO_CHANNELS, XMorph::Base::ALLOWED_NUMBER_OF_AUDIO_TRACKS, XMorph::Base::ALLOWED_SCAN_TYPE, XMorph::Base::ALLOWED_VIDEO_BIT_RATE, XMorph::Base::ALLOWED_WIDTH, XMorph::Base::IGNORE, XMorph::Base::PRESENCE_OF_AUDIO_TRACK, XMorph::Base::VALIDATE

Instance Attribute Summary

Attributes inherited from XMorph::Base

#asset_path, #default_audio_checks, #default_video_checks, #error, #logger, #mediainfo_output, #profile_name, #profiles

Instance Method Summary collapse

Methods inherited from XMorph::Base

#get_asset_details, #get_profile, get_transcode_template, #initialize, logger, logger=, #perform_default_audio_validations, #perform_default_video_validations, #post_process, root, #set_validations, #transcode, #validate_asset

Constructor Details

This class inherits a constructor from XMorph::Base

Instance Method Details

#audio_checksObject



22
23
24
25
26
27
28
29
30
# File 'lib/xmorph/customers/cbn/cbn/transcode.rb', line 22

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

#set_profile_nameObject

profiles are classified based on aspect ratio, height and number of audio channels

  1. height is 1080 and audio tracks could be (1 track with stereo), (2, 4, 6, 8 tracks and all mono), (1 track with 4, 8 channels)

  2. line 1 applies with aspect ration as 4:3 and 16:9



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/xmorph/customers/tyt/TYT/transcode.rb', line 33

def set_profile_name
  self.profile_name = nil
  self.error = nil

  audio_tracks = self.mediainfo_output["Audio"]
  sample_rate = audio_tracks.map{|a| a["Sampling_rate"]}
  self.error = "Unexpected audio sample rate #{sample_rate.uniq}. We support 48.0 KHz" and return  if sample_rate.uniq != ["48.0 KHz"]

  number_of_audio_tracks = audio_tracks.count
  number_of_audio_channels = audio_tracks.map{|a| a["Channel_s_"].split(" ")[0].to_i if a["Channel_s_"].present? }

  if (number_of_audio_tracks == 2 and number_of_audio_channels.uniq == [1]) or (number_of_audio_tracks == 1 and number_of_audio_channels.uniq == [2])
    self.profile_name = DEFAULT_COMMAND
    return true
  end

  XMorph::Base.logger.debug("XMorph#set_profile_name#cbn: using profile #{self.profile_name}") unless self.profile_name.nil?
  return true
end

#set_profilesObject



5
6
7
8
9
# File 'lib/xmorph/customers/cbn/cbn/transcode.rb', line 5

def set_profiles
  self.profiles = {
    DEFAULT_COMMAND => "docker run --rm -v %{IP_MOUNT_PATH}:%{IP_MOUNT_PATH} -v %{OP_MOUNT_PATH}:%{OP_MOUNT_PATH} %{VOLT_TAG} ./volt/transcoder -if %{IN} -of %{OUT} -vr 1080i60 -acm \"1,2;1,2\" -ac \"ac3;aac\" -ac3_dialnorm -24 -lt -25 -lm DOLBY",
  }
end

#video_checksObject



11
12
13
14
15
16
17
18
19
20
# File 'lib/xmorph/customers/cbn/cbn/transcode.rb', line 11

def video_checks
  {
    ALLOWED_ASPECT_RATIO => ["16:9"],
    ALLOWED_HEIGHT => [1080],
    ALLOWED_WIDTH => [1440, 1920], 
    ALLOWED_FRAME_RATE => [29.97],
    ALLOWED_VIDEO_BIT_RATE => IGNORE, #Mbps
    ALLOWED_SCAN_TYPE => ["interlaced"], #all downcased
  }
end