class Transcode < XMorph::Base PROGRESSIVE = "progressive" INTERLACED = "interlaced" def set_profiles self.profiles = { PROGRESSIVE => "ffmpeg -y -i %{IN} -map 0:v -map 0:a:0 -map 0:a:0 -c:a:0 libfdk_aac -profile:a aac_low -ac 2 -ab 192k -c:a:1 ac3 -ac 2 -ab 320k -c:v libx264 -vf \"fps=fps=29.97,scale=1920:1080\" -pix_fmt yuv420p -x264opts nal-hrd=cbr -g 13 -aspect 16:9 -bf 2 -profile:v high -b:v 12M -minrate:v 12M -maxrate:v 12M -muxrate 14M -bufsize:v 25M -pes_payload_size 16 -streamid 0:2064 -streamid 1:2068 -streamid 2:2069 -vsync 1 -async 1 %{OUT} 2>&1", INTERLACED => "ffmpeg -y -i %{IN} -map 0:v -map 0:a:0 -map 0:a:0 -c:a:0 libfdk_aac -profile:a aac_low -ac 2 -ab 192k -c:a:1 ac3 -ac 2 -ab 320k -c:v libx264 -vf \"fps=fps=29.97,scale=1920:1080\" -pix_fmt yuv420p -flags +ilme+ildct -top 1 -x264opts nal-hrd=cbr -g 13 -aspect 16:9 -bf 2 -profile:v high -b:v 12M -minrate:v 12M -maxrate:v 12M -muxrate 14M -bufsize:v 25M -pes_payload_size 16 -streamid 0:2064 -streamid 1:2068 -streamid 2:2069 -vsync 1 -async 1 %{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 => ["progressive", "interlaced", "interlaced_mbaff", "interlaced_tff", "interlaced_bff"], #all downcased } end def audio_checks { PRESENCE_OF_AUDIO_TRACK => VALIDATE, ALLOWED_NUMBER_OF_AUDIO_TRACKS => [1, 2], ALLOWED_AUDIO_CODECS => ["ac-3", "aac"], ALLOWED_AUDIO_BIT_RATE => IGNORE, ALLOWED_NUMBER_OF_AUDIO_CHANNELS => [2], } end # Classification is based on scan type # Video of type progressive and interlaced are scaled to 1920x1080 def set_profile_name self.profile_name = nil self.error = nil mediainfo = self.mediainfo_output scan_type = mediainfo["Video"]["Scan_type"] self.profile_name = (scan_type.downcase == "progressive")? PROGRESSIVE : INTERLACED XMorph::Base.logger.debug("XMorph#set_profile_name#dogtv: using profile #{self.profile_name}") unless self.profile_name.nil? return true end end