* VRFS-2431 - run normalize-ogg and normalize-mp3 to bump up master mix

This commit is contained in:
Seth Call 2014-10-29 11:28:13 -05:00
parent 149967f877
commit 62833198b3
4 changed files with 36 additions and 0 deletions

View File

@ -126,6 +126,8 @@ module JamAdmin
config.twitter_app_secret = ENV['TWITTER_APP_SECRET'] || 'Azcy3QqfzYzn2fsojFPYXcn72yfwa0vG6wWDrZ3KT8'
config.ffmpeg_path = ENV['FFMPEG_PATH'] || (File.exist?('/usr/local/bin/ffmpeg') ? '/usr/local/bin/ffmpeg' : '/usr/bin/ffmpeg')
config.normalize_ogg_path = ENV['NORMALIZE_OGG_PATH'] || (File.exist?('/usr/local/bin/normalize-ogg') ? '/usr/local/bin/normalize-ogg' : '/usr/bin/normalize-ogg')
config.normalize_mp3_path = ENV['NORMALIZE_MP3_PATH'] || (File.exist?('/usr/local/bin/normalize-mp3') ? '/usr/local/bin/normalize-mp3' : '/usr/bin/normalize-mp3')
config.max_audio_downloads = 100

View File

@ -335,6 +335,30 @@ module JamRuby
end
raise "no output mp3 file after conversion" unless File.exist? @output_mp3_filename
# time to normalize both mp3 and ogg files
normalize_ogg_cmd = "#{APP_CONFIG.normalize_ogg_path} --bitrate 128 -i \"#{@output_ogg_filename}\""
system(normalize_ogg_cmd)
unless $? == 0
@error_reason = 'normalize-ogg-failed'
@error_detail = $?.to_s
error_msg = "normalize-ogg failed status=#{$?} error_reason=#{@error_reason} error_detail=#{@error_detail}"
@@log.info(error_msg)
raise error_msg
end
raise "no output ogg file after normalization" unless File.exist? @output_ogg_filename
normalize_mp3_cmd = "#{APP_CONFIG.normalize_mp3_path} --bitrate 128 -i \"#{@output_mp3_filename}\""
system(normalize_mp3_cmd)
unless $? == 0
@error_reason = 'normalize-mp3-failed'
@error_detail = $?.to_s
error_msg = "normalize-mp3 failed status=#{$?} error_reason=#{@error_reason} error_detail=#{@error_detail}"
@@log.info(error_msg)
raise error_msg
end
raise "no output mp3 file after conversion" unless File.exist? @output_mp3_filename
end
def symbolize_keys(obj)

View File

@ -38,6 +38,14 @@ def app_config
ENV['FFMPEG_PATH'] || '/usr/local/bin/ffmpeg'
end
def normalize_ogg_path
ENV['NORMALIZE_OGG_PATH'] || '/usr/local/bin/normalize-ogg'
end
def normalize_mp3_path
ENV['NORMALIZE_MP3_PATH'] || '/usr/local/bin/normalize-mp3'
end
def icecast_reload_cmd
'true' # as in, /bin/true
end

View File

@ -178,6 +178,8 @@ if defined?(Bundler)
config.audiomixer_path = "/var/lib/audiomixer/audiomixer/audiomixerapp"
config.ffmpeg_path = ENV['FFMPEG_PATH'] || (File.exist?('/usr/local/bin/ffmpeg') ? '/usr/local/bin/ffmpeg' : '/usr/bin/ffmpeg')
config.normalize_ogg_path = ENV['NORMALIZE_OGG_PATH'] || (File.exist?('/usr/local/bin/normalize-ogg') ? '/usr/local/bin/normalize-ogg' : '/usr/bin/normalize-ogg')
config.normalize_mp3_path = ENV['NORMALIZE_MP3_PATH'] || (File.exist?('/usr/local/bin/normalize-mp3') ? '/usr/local/bin/normalize-mp3' : '/usr/bin/normalize-mp3')
# if it looks like linux, use init.d script; otherwise use kill
config.icecast_reload_cmd = ENV['ICECAST_RELOAD_CMD'] || (File.exist?('/usr/local/bin/icecast2') ? "bash -l -c #{Shellwords.escape("sudo /etc/init.d/icecast2 reload")}" : "bash -l -c #{Shellwords.escape("kill -1 `ps -f | grep /usr/local/bin/icecast | grep -v grep | awk \'{print $2}\'`")}")