class Transcode < XMorph::Base CINEDIGM_CONTENT = "cinedigm_content" DEFAULT = "default" def set_profiles self.profiles = { CINEDIGM_CONTENT => "ffmpeg -y -i %{IN} -map 0:v:0 -map 0:a:0 -acodec libfdk_aac -profile:a aac_low -ac 2 -ar 48000 -ab 192k -vcodec libx264 -vf 'fps=fps=29.97,scale=1920:1080' -pix_fmt yuv420p -g 13 -bf 2 -profile:v high -vb 30000k -minrate:v 30000k -maxrate:v 30000k -bufsize:v 60000k -muxrate 31000k -x264opts nal-hrd=cbr -pes_payload_size 16 -streamid 0:2064 -streamid 1:2068 %{OUT} 2>&1", DEFAULT => "ffmpeg -y -i %{IN} -vcodec copy -vbsf h264_mp4toannexb -acodec copy -map 0:v -streamid 0:2064 -map 0:a -streamid 1:2068 -metadata:s:a:0 language=ENG %{OUT} 2>&1", } end def video_checks { ALLOWED_ASPECT_RATIO => ["16:9"], ALLOWED_HEIGHT => [1080], ALLOWED_WIDTH => [1920], 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", "mpeg-audio"], ALLOWED_AUDIO_BIT_RATE => IGNORE, ALLOWED_NUMBER_OF_AUDIO_CHANNELS => [2], } end #profiles are classified based on fps and bit rate. def set_profile_name self.profile_name = nil self.error = nil mediainfo = self.mediainfo_output video_info = mediainfo["Video"] fps = video_info["Frame_rate"] bit_rate = video_info["Bit_rate"] || video_info["Nominal_bit_rate"] fps = video_info["Frame_rate"].match("29.97") bit_rate = bit_rate.split(" ")[0].to_f if !fps || bit_rate < 30; self.profile_name = CINEDIGM_CONTENT else self.profile_name = DEFAULT end XMorph::Base.logger.debug("XMorph#get_profile#tyt: using profile #{self.profile_name}") unless self.profile_name.nil? return true end end