Last active
August 27, 2017 16:48
-
-
Save withmorten/3765a714d11eb0bd4819be3bd27e42a1 to your computer and use it in GitHub Desktop.
drag & drop input parser
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
setlocal disableDelayedExpansion | |
set args=%* | |
set "dragDrop=" | |
set aac=0 | |
setlocal enableDelayedExpansion | |
set "cmd=!cmdcmdline!" | |
set "cmd2=!cmd:*%~f0=!" | |
if "!cmd2!" neq "!cmd!" ( | |
set dragDrop=1 | |
set "args=!cmd2:~0,-1! " | |
set "args=!args:* =!" | |
) | |
echo Into which format shall I encode, Sir? | |
echo. | |
echo 1: aac abr | |
echo 2: mp3 320cbr | |
echo 3: alac | |
echo 4: mp3 V0 vbr | |
echo 5: mp3 160cbr | |
echo 6: alac to cdrive | |
echo 7: aac to cdrive (nodelay) | |
echo 8: aac abr to cdrive (nodelay) | |
echo 9: mp3 320cbr (nolp) | |
choice /c 123456789c /n /m "c: cancel" | |
echo. | |
if %errorlevel%==10 goto totalend | |
if %errorlevel%==8 set aac=8 | |
if %errorlevel%==1 set aac=1 | |
if NOT %aac%==0 ( | |
echo Which bitrate shall I choose, Sir? | |
echo. | |
echo 1: 320 | |
echo 2: 256 | |
echo 3: 192 | |
choice /c 123c /n /m "c: cancel" | |
echo. | |
if %errorlevel%==4 goto totalend | |
) | |
for %%F in (!args!) do ( | |
if "!!"=="" endlocal & set "dragDrop=%dragDrop%" | |
if %aac%==8 ( | |
if %errorlevel%==1 ( | |
ffmpeg -y -i "%%~F" -loglevel quiet -f wav pipe: | qaac --abr 320 -q 2 -i --no-delay -r keep --threading -o "C:\temp\m4a\%%~nF.m4a" - | |
) else if %errorlevel%==2 ( | |
ffmpeg -y -i "%%~F" -loglevel quiet -f wav pipe: | qaac --abr 256 -q 2 -i --no-delay -r keep --threading -o "C:\temp\m4a\%%~nF.m4a" - | |
) else if %errorlevel%==3 ( | |
ffmpeg -y -i "%%~F" -loglevel quiet -f wav pipe: | qaac --abr 192 -q 2 -i --no-delay -r keep --threading -o "C:\temp\m4a\%%~nF.m4a" - | |
) | |
) else if %aac%==1 ( | |
if %errorlevel%==1 ( | |
ffmpeg -y -i "%%~F" -loglevel quiet -ar 44100 -f wav pipe: | qaac --abr 320 -q 2 -i -r keep --threading -o "%%~dpnF.m4a" - | |
) else if %errorlevel%==2 ( | |
ffmpeg -y -i "%%~F" -loglevel quiet -ar 44100 -f wav pipe: | qaac --abr 256 -q 2 -i -r keep --threading -o "%%~dpnF.m4a" - | |
) else if %errorlevel%==3 ( | |
ffmpeg -y -i "%%~F" -loglevel quiet -ar 44100 -f wav pipe: | qaac --abr 192 -q 2 -i -r keep --threading -o "%%~dpnF.m4a" - | |
) | |
) else if %errorlevel%==2 ( | |
ffmpeg -y -i "%%~F" -ar 44100 -f wav pipe: | lame -q 2 -V 0 -b 320 --cbr - "%%~dpnF.mp3" | |
) else if %errorlevel%==3 ( | |
ffmpeg -y -i "%%~F" -c:a alac -sample_fmt s16p -vn "%%~dpnF.m4a" | |
) else if %errorlevel%==4 ( | |
ffmpeg -y -i "%%~F" -ar 44100 -f wav pipe: | lame -V 0 -b 0 -B 320 --lowpass 20.5 -q 2 - "%%~dpnF.mp3" | |
) else if %errorlevel%==5 ( | |
ffmpeg -y -i "%%~F" -ar 44100 -f wav pipe: | lame -b 160 --lowpass -1 -q 2 --cbr - "%%~dpnF.mp3" | |
) else if %errorlevel%==6 ( | |
ffmpeg -y -i "%%~F" -c:a alac -sample_fmt s16p -vn "C:\temp\alac\%%~nF.m4a" | |
) else if %errorlevel%==7 ( | |
ffmpeg -y -i "%%~F" -loglevel quiet -f wav pipe: | qaac -V127 -q 2 -i --no-delay -r keep --threading -o "C:\temp\m4a\%%~nF.m4a" - | |
) else if %errorlevel%==9 ( | |
ffmpeg -y -i "%%~F" -ar 44100 -f wav pipe: | lame --resample 44.1 -q 2 -V 0 -b 320 --cbr --lowpass -1 - "%%~dpnF.mp3" | |
) | |
echo. | |
) | |
if defined dragDrop ( | |
exit | |
) | |
goto totalend | |
:totalend |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment