EAC and AAC
Reply #4 – 2008-07-30 03:03:22
Speaking of piping, I made this drag-and-drop batch converter for NeroAacEnc per a request which accepts a variety of lossless formats, preserves basic tag information, and scales the input according to RG album gain. Maybe someone will find it helpful...@ECHO OFF IF "%~1" == "" neroaacenc -help && GOTO end SET PARAMS=-q0.45 :encode TITLE Encoding "%~nx1" IF EXIST "%~1.tag" GOTO encode_shift IF EXIST "%~dpn1.m4a" GOTO encode_shift SET /p nul=Encoding "%~nx1" <nul IF /i "%~x1" == ".wav" (CALL :encode_wav %1 ) ELSE (IF /i "%~x1" == ".wv" (CALL :encode_wv %1 ) ELSE (IF /i "%~x1" == ".tak" (CALL :encode_tak %1 ) ELSE (IF /i "%~x1" == ".flac" (CALL :encode_flac %1 ) ELSE (IF /i "%~x1" == ".ape" (CALL :encode_ape %1 ) ELSE ECHO ... Invalid file && GOTO encode_shift ) ) ) ) ECHO Done :encode_shift SHIFT IF "%~1" EQU "" ECHO. && GOTO end GOTO encode :encode_wav SET /p nul=... <nul neroaacenc %PARAMS% -if %1 -of "%~dpn1.m4a" 2>nul GOTO :eof :encode_wv CALL :taginfo %1 SET /p nul=... <nul wvunpack -q %1 - | %SCALE% neroaacenc %PARAMS% -if - -of "%~dpn1.m4a" 2>nul neroAacTag "%~dpn1.m4a" %TAGINFO% 2>nul GOTO :eof :encode_tak CALL :taginfo %1 SET /p nul=... <nul takc -d %1 - | %SCALE% neroaacenc %PARAMS% -if - -of "%~dpn1.m4a" 2>nul neroAacTag "%~dpn1.m4a" %TAGINFO% 2>nul GOTO :eof :encode_flac CALL :taginfo %1 SET /p nul=... <nul flac -dcs %1 | %SCALE% neroAacEnc %PARAMS% -if - -of "%~dpn1.m4a" 2>nul neroAacTag "%~dpn1.m4a" %TAGINFO% 2>nul GOTO :eof :encode_ape CALL :taginfo %1 SET /p nul=... <nul mac %1 - -d 2>nul | %SCALE% neroaacenc %PARAMS% -if - -of "%~dpn1.m4a" 2>nul neroAacTag "%~dpn1.m4a" %TAGINFO% 2>nul GOTO :eof :taginfo tag %1 2> "%~1.tag" SET SCALE= FOR /F "usebackq tokens=1*" %%X IN (`findstr "Title:" "%~1.tag"`) DO ( SET title=%%Y ) FOR /F "usebackq tokens=1*" %%X IN (`findstr "Artist:" "%~1.tag"`) DO ( SET artist=%%Y ) FOR /F "usebackq tokens=1*" %%X IN (`findstr "Album:" "%~1.tag"`) DO ( SET album=%%Y ) FOR /F "usebackq tokens=1*" %%X IN (`findstr "Year:" "%~1.tag"`) DO ( SET year=%%Y ) FOR /F "usebackq tokens=1*" %%X IN (`findstr "Track:" "%~1.tag"`) DO ( SET track=%%Y ) FOR /F "usebackq tokens=1*" %%X IN (`findstr "Genre:" "%~1.tag"`) DO ( SET genre=%%Y ) FOR /F "usebackq tokens=1*" %%X IN (`findstr "Comment:" "%~1.tag"`) DO ( SET comment=%%Y ) SET TAGINFO=-meta:title="%title%" -meta:artist="%artist%" -meta:album="%album%" -meta:year="%year%" -meta:track="%track%" -meta:genre="%genre%" -meta:comment="%comment%" FOR /F "usebackq tokens=1,2* delims== " %%X IN (`findstr "replaygain_album_gain" "%~1.tag"`) DO ( SET SCALE=%%Y ) IF DEFINED SCALE FOR /F %%X IN ('EVAL 10^^^^^(%SCALE%/20^)') DO SET SCALE=sox -v %%X -t wav - -t wav - 2^>nul ^| DEL "%~1.tag" GOTO :eof :end PAUSE Tag.exe can be found at Synthetic Soul's website . Eval.exe can be found here . Sox.exe can be found at sourceforge.net . A special build of mac.exe that provides for stdout can be found at rarewares.org or you can get an updated one at etree.org . EDIT: Spelling and grammar. The code is still the same.