Sha256: 4bba1dbe18d7489eb1e6b5da6d9ac1bc75ad073baac1bc543a62c319b6eddd86
Contents?: true
Size: 1.93 KB
Versions: 8
Compression:
Stored size: 1.93 KB
Contents
class Transcode < XMorph::Base ADD_AUDIO = "add_audio" DEFAULT = "default" def set_profiles self.profiles = { ADD_AUDIO => "ffmpeg -y -i %{IN} -f lavfi -i anullsrc -shortest -map 0:v:0 -map 1:a:0 -acodec libfdk_aac -profile:a aac_low -ac 2 -ar 48000 -ab 192k -vcodec libx264 -vf \"fps=fps=25,scale=720:576\" -pix_fmt yuv420p -g 13 -bf 2 -profile:v high -vb 8000000 -minrate:v 8000k -maxrate:v 8000k -bufsize:v 16000k -muxrate 9000k -x264opts nal-hrd=cbr -pes_payload_size 16 -streamid 0:2064 -streamid 1:2068 %{OUT} 2>&1", DEFAULT => "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=25,scale=720:576' -pix_fmt yuv420p -g 13 -bf 2 -profile:v high -vb 8000000 -minrate:v 8000k -maxrate:v 8000k -bufsize:v 16000k -muxrate 9000k -x264opts nal-hrd=cbr -pes_payload_size 16 -streamid 0:2064 -streamid 1:2068 %{OUT} 2>&1" } end def video_checks { ALLOWED_ASPECT_RATIO => ["16:9", "5:4"], ALLOWED_HEIGHT => [720, 1080, 576], ALLOWED_WIDTH => [1280, 1920, 720], ALLOWED_FRAME_RATE => IGNORE, ALLOWED_VIDEO_BIT_RATE => IGNORE, #Mbps ALLOWED_SCAN_TYPE => IGNORE, #all downcased } end def audio_checks { PRESENCE_OF_AUDIO_TRACK => IGNORE, ALLOWED_NUMBER_OF_AUDIO_TRACKS => [0, 1], ALLOWED_AUDIO_CODECS => ["aac"], ALLOWED_AUDIO_BIT_RATE => IGNORE, ALLOWED_NUMBER_OF_AUDIO_CHANNELS => [1, 2], } end # Classification is based on presence of audio track # Audio track is added for Videos with no audio track def set_profile_name self.profile_name = nil self.error = nil mediainfo = self.mediainfo_output audio_tracks = mediainfo["Audio"] self.profile_name = (audio_tracks.empty?) ? ADD_AUDIO : DEFAULT XMorph::Base.logger.debug("XMorph#set_profile_name#hkitv: using profile #{self.profile_name}") unless self.profile_name.nil? return true end end
Version data entries
8 entries across 8 versions & 2 rubygems