Add m4a options to reencode

This commit is contained in:
pabloalcantara
2011-08-19 14:36:47 -03:00
parent a2cb87e141
commit 11e6484c93
2 changed files with 27 additions and 18 deletions

View File

@@ -269,7 +269,7 @@
ffmpegselect = ''
else:
lameselect = ''
ffmpegselect = 'selected="selected"'
ffmpegselect = 'selected="selected"'
%>
<h3>Encoder: <select name="encoder">
<option value="lame" ${lameselect}>lame</option>
@@ -278,16 +278,23 @@
<br>
<br>
<%
if config['encoderoutputformat'] == 'mp3':
mp3select = 'selected="selected"'
oggselect = ''
else:
if config['encoderoutputformat'] == 'ogg':
oggselect = 'selected="selected"'
mp3select = ''
oggselect = 'selected="selected"'
m4aselect = ''
elif config['encoderoutputformat'] == 'm4a':
oggselect = ''
m4aselect = 'selected="selected"'
mp3select = ''
else:
oggselect = ''
m4aselect = ''
mp3select = 'selected="selected"'
%>
<h3>Format: <select name="encoderoutputformat">
<option value="mp3" ${mp3select}>mp3</option>
<option value="ogg" ${oggselect}>ogg</option>
<option value="m4a" ${m4aselect}>m4a</option>
</select>
<br>
<br>
@@ -324,11 +331,11 @@
bitrate320select = 'selected="selected"'
%>
<h3>Bitrate: <select name="bitrate">
<option value=64 ${bitrate64select}>64</option>
<option value=128 ${bitrate128select}>128</option>
<option value=192 ${bitrate192select}>192</option>
<option value=256 ${bitrate256select}>256</option>
<option value=320 ${bitrate320select}>320</option>
<option value=64 ${bitrate64select}>64 kbps</option>
<option value=128 ${bitrate128select}>128 kbps</option>
<option value=192 ${bitrate192select}>192 kbps</option>
<option value=256 ${bitrate256select}>256 kbps</option>
<option value=320 ${bitrate320select}>320 kbps</option>
</select>
<br>
<br>
@@ -338,11 +345,11 @@
freq48000 = ''
else:
freq44100 = ''
freq48000 = 'selected="selected"'
freq48000 = 'selected="selected"'
%>
<h3>Sampling: <select name="samplingfrequency">
<option value=44100 ${freq44100}>44100</option>
<option value=48000 ${freq48000}>48000</option>
<option value=44100 ${freq44100}>44.1 kHz</option>
<option value=48000 ${freq48000}>48.0 kHz</option>
</select>
<br>
<br>

View File

@@ -55,8 +55,8 @@ def encode(albumPath):
logger.warn('Can not reencode .ogg music "%s"' % (music))
else:
command(encoder,music,musicTempFiles[i],albumPath)
elif (headphones.ENCODEROUTPUTFORMAT=='mp3'):
if (music.endswith('.mp3') and (infoMusic.bitrate/1000<=headphones.BITRATE)):
elif (headphones.ENCODEROUTPUTFORMAT=='mp3' or headphones.ENCODEROUTPUTFORMAT=='m4a'):
if (music.endswith('.'+headphones.ENCODEROUTPUTFORMAT) and (infoMusic.bitrate/1000<=headphones.BITRATE)):
logger.warn('Music "%s" has bitrate<="%skbit" will not be reencoded' % (music,headphones.BITRATE))
else:
command(encoder,music,musicTempFiles[i],albumPath)
@@ -83,8 +83,10 @@ def command(encoder,musicSource,musicDest,albumPath):
cmd=encoder+ ' -i'
cmd=cmd+ ' "' + musicSource + '"'
if headphones.ENCODEROUTPUTFORMAT=='ogg':
cmd=cmd+ ' -acodec vorbis -strict experimental'
cmd=cmd+ ' -ac 2 -map_metadata 0:0,s0 -vn -ar ' + str(headphones.SAMPLINGFREQUENCY) + ' -ab ' + str(headphones.BITRATE) + 'k'
cmd=cmd+ ' -acodec libvorbis'
if headphones.ENCODEROUTPUTFORMAT=='m4a':
cmd=cmd+ ' -strict experimental'
cmd=cmd+ ' -y -ac 2 -map_metadata 0:0,s0 -vn -ar ' + str(headphones.SAMPLINGFREQUENCY) + ' -ab ' + str(headphones.BITRATE) + 'k'
cmd=cmd+ ' ' + headphones.ADVANCEDENCODER
cmd=cmd+ ' "' + musicDest + '"'
return_code = call(cmd, shell=True)