-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDecodeAudio.cmd
More file actions
170 lines (154 loc) · 4.82 KB
/
Copy pathDecodeAudio.cmd
File metadata and controls
170 lines (154 loc) · 4.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
@echo off
echo ================================================
echo EA Layer 3 Stream Extractor/Decoder 0.5.0
echo (C) 2010, Ben Moench
echo ================================================
echo.
setlocal enabledelayedexpansion
set "inputDir=%~dp0Work"
set "outputDir=%~dp0DecodedAudio"
:: ===== Check Work folder =====
if not exist "%inputDir%" (
echo "Work" folder not found. Creating one now...
mkdir "%inputDir%"
echo.
)
:: ===== Check for FFmpeg =====
set "FFMPEG_PATH="
:: Check local folder first
if exist "%~dp0ffmpeg.exe" (
set "FFMPEG_PATH=%~dp0ffmpeg.exe"
) else (
:: Check system PATH
for %%I in (ffmpeg.exe) do (
where %%I >nul 2>&1
if not errorlevel 1 set "FFMPEG_PATH=%%I"
)
)
if "%FFMPEG_PATH%"=="" (
echo WARNING: FFmpeg was not found.
echo .vid files will not be processed.
echo.
echo Make sure 'ffmpeg.exe' is in the same folder as this script or installed to system PATH.
echo You can download FFmpeg here: https://ffmpeg.org/download.html
echo ----------------------------------
set "FFMPEG_AVAILABLE=0"
) else (
set "FFMPEG_AVAILABLE=1"
)
:CHECKFILES
set /a total=0
for %%i in ("%inputDir%\*.sns") do set /a total+=1
for %%i in ("%inputDir%\*.snr") do set /a total+=1
for %%i in ("%inputDir%\*.vid") do set /a total+=1
if %total%==0 (
echo "Work" folder is empty.
echo Please place .sns, .snr, or .vid files into that folder.
echo.
choice /c YN /n /m "Press Y to add files or N to exit: "
if errorlevel 2 exit /b
echo.
echo Opening the Work folder for you to add files...
start "" "%inputDir%"
echo Waiting for you to add files...
pause
echo Checking again...
goto CHECKFILES
)
:: ===== Check output folder =====
if not exist "%outputDir%" mkdir "%outputDir%"
echo Found %total% file(s) to decode.
echo.
set /a decoded=0
set /a skipped=0
set /a processed=0
echo Starting decoding process...
echo.
:: ===== Process .sns files =====
for %%i in ("%inputDir%\*.sns") do (
set "outfile=%outputDir%\%%~ni.wav"
if not exist "!outfile!" (
set /a decoded+=1
set /a processed+=1
echo [!processed!/%total%] Decoding: %%~nxi
"%~dp0ealayer3.exe" -mc "%%i"
copy "%%~dpni.wav" "%outputDir%\" >nul 2>&1
del "%%~dpni.wav" >nul 2>&1
) else (
set /a skipped+=1
set /a processed+=1
echo Skipped. Already decoded: %%~nxi
)
)
:: ===== Process .snr files =====
for %%i in ("%inputDir%\*.snr") do (
set "outfile=%outputDir%\%%~ni.wav"
if not exist "!outfile!" (
set /a decoded+=1
set /a processed+=1
echo [!processed!/%total%] Decoding: %%~nxi
"%~dp0ealayer3.exe" -mc "%%i"
copy "%%~dpni.wav" "%outputDir%\" >nul 2>&1
del "%%~dpni.wav" >nul 2>&1
) else (
set /a skipped+=1
set /a processed+=1
echo Skipped. Already decoded: %%~nxi
)
)
:: ===== Process .vid files =====
if "%FFMPEG_AVAILABLE%"=="1" (
for %%i in ("%inputDir%\*.vid") do (
set "outfile=%outputDir%\%%~ni.wav"
if not exist "!outfile!" (
set /a decoded+=1
set /a processed+=1
echo [!processed!/%total%] Decoding: %%~nxi
"%FFMPEG_PATH%" -i "%%i" -f wav -y "!outfile!" >nul 2>&1
) else (
set /a skipped+=1
set /a processed+=1
echo Skipped. Already decoded: %%~nxi
)
)
) else (
echo Skipping .vid files as FFmpeg is not available.
)
echo.
echo ==================================================
:: ============== Ending message =================
if %decoded%==0 (
:: All skipped
echo No files were processed.
echo =================================================
echo.
echo Press any key to exit.
pause >nul
exit /b
) else (
if %skipped% gtr 0 (
:: Some decoded, some skipped
if %decoded%==1 (
echo Decoding complete. 1 file was processed, %skipped% skipped.
) else (
echo Decoding complete. %decoded% of %total% files were processed, %skipped% skipped.
)
echo Decoded audio has been saved to "..\DecodedAudio\".
echo ===================================================
choice /c YN /n /m "Press Y to open the folder or N to exit: "
if %errorlevel%==1 start "" "%outputDir%"
exit /b
) else (
:: All decoded (no skipped)
if %total%==1 (
echo Decoding completed. All 1 file was processed.
) else (
echo Decoding completed. All %total% files processed.
)
echo Decoded audio has been saved to "..\DecodedAudio\".
echo ===================================================
choice /c YN /n /m "Press Y to open the folder or N to exit: "
if %errorlevel%==1 start "" "%outputDir%"
exit /b
)
)