Skip to content

Commit b0024a5

Browse files
committed
v1.3 Alpha added
Very early file. Things will be changed here first, before being pushed to the main TcNo-Transcoder.bat file. New in v1.3: Folder support. You can add 1 or more folders, as well as files for transcoding.
1 parent 89be439 commit b0024a5

File tree

2 files changed

+375
-0
lines changed

2 files changed

+375
-0
lines changed

.gitignore

Whitespace-only changes.

TcNo-Transcoder-ALPHA.bat

+375
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,375 @@
1+
@ECHO OFF
2+
setlocal enableExtensions disableDelayedExpansion
3+
title TechNobo's Transcoder - NVEncC
4+
:pgStart
5+
::---------------------------------------
6+
:: ------------ VARIABLE DEF ------------
7+
::---------------------------------------
8+
:: CD to .bat location
9+
cd /d "%~dp0"
10+
:: Load variables
11+
CALL settings.bat
12+
:: Static variables. DO NOT EDIT
13+
SET batVer=1.3
14+
SET nvenccVer=4.31
15+
SET minNV=418.81
16+
17+
:: Checking if 32 or 64 bit, if not set prior.
18+
IF NOT DEFINED bit ( GOTO getbit )
19+
:getbitReturn
20+
21+
:: Setting executable to the correct version
22+
IF "%bit%"=="32" (set nvexe=NVEncC.exe) ELSE (set nvexe=NVEncC64.exe)
23+
CD x%bit%
24+
::---------------------------------------
25+
26+
27+
::---------------------------------------
28+
:: ------------- ARGUMENTS -------------
29+
::---------------------------------------
30+
:: Checks for arguments, like -h or --help
31+
IF "%~1"=="-h" ( GOTO help )
32+
IF "%~1"=="--help" ( GOTO help )
33+
IF "%~1"=="-i" ( GOTO info )
34+
IF "%~1"=="--info" ( GOTO info )
35+
IF "%~1"=="-d" ( GOTO devices )
36+
IF "%~1"=="--devices" ( GOTO devices )
37+
IF "%~1"=="-a" ( GOTO audio )
38+
IF "%~1"=="--audio" ( GOTO audio )
39+
IF "%~1"=="-v" ( GOTO video )
40+
IF "%~1"=="--video" ( GOTO video )
41+
:: Show welcome screen
42+
GOTO welcome
43+
:welcomeReturn
44+
45+
:: Checks if a file (or multiple files) were dragged onto the .bat
46+
:: They will be processed instantly, without further warning than "Do you wish to continue?"
47+
:: If you're going to do this, test the settings beforehand, but running this .bat, and following the steps with 1 file.
48+
:: If you are happy with the results, then feel free to continue.
49+
IF [%1]==[] GOTO skip
50+
ECHO ATTENTION!
51+
ECHO Dragging files in will process them INSTANTLY using the settings in settings.bat!
52+
ECHO.
53+
ECHO The following files will be processed:
54+
ECHO %*
55+
ECHO.
56+
set /p sure="Are you sure you wish to continue? (y/n): "
57+
58+
IF "%sure%"=="y" ( GOTO processMulti ) ELSE ( GOTO multiCancel )
59+
::---------------------------------------
60+
61+
62+
::---------------------------------------
63+
:: ------------- NORMAL USE -------------
64+
::---------------------------------------
65+
:: If no arguments were added, the program will start here
66+
:skip
67+
68+
SET /p inF="Drag and Drop input file into here: "
69+
ECHO.
70+
:: Sets outF to the output file, with the format defined in settings.bat
71+
IF DEFINED outFLD ( GOTO FolderGiven ) ELSE ( GOTO NoFolderGiven )
72+
:fgReturn
73+
74+
:: Enter respective version's folder.
75+
ECHO Using NVEncC x%bit%
76+
ECHO The file will save to: %outF%
77+
ECHO If you want it saved to a new directory, exit, and set it in settings.bat.
78+
PAUSE
79+
ECHO.
80+
ECHO %inF% will render with the current settings:
81+
ECHO Resolution: %res%
82+
ECHO FPS: %fps%
83+
ECHO Codec: %codec%
84+
ECHO.
85+
ECHO This command will be run:
86+
ECHO.
87+
88+
:: Sets string that it will run
89+
GOTO setStr
90+
:setStrReturn
91+
92+
ECHO %comStr%
93+
94+
ECHO.
95+
ECHO.
96+
:: Checks that the user is comfortable running the command
97+
SET /p corr="Is this correct? (y/n): "
98+
IF "%corr%"=="y" (%comStr%)
99+
IF "%corr%"=="n" ( ECHO Stopped. )
100+
101+
:: Goes back a folder (if run from command line) so user doesn't have to navigate themselves.
102+
CD ../
103+
ECHO.
104+
ECHO.
105+
GOTO thanks
106+
:thanksReturn
107+
ECHO.
108+
:: Loops back to the start of the program
109+
GOTO pgStart
110+
::---------------------------------------
111+
112+
113+
::---------------------------------------
114+
:: ------------ HELP + INFO ------------
115+
::---------------------------------------
116+
:help
117+
CLS
118+
ECHO Hello.
119+
ECHO Welcome to TechNobo's Video Transcoder %batVer%
120+
ECHO built for generating Proxy files with multitrack audio quickly.
121+
ECHO.
122+
ECHO ---------------------------------------
123+
ECHO.
124+
ECHO BASIC USAGE:
125+
ECHO Edit run.bat with a text editor to manually set variables at the top.
126+
ECHO.
127+
ECHO ---------------------------------------
128+
ECHO.
129+
ECHO INFORMATION OPTIONS:
130+
ECHO -h, --help Displays this help INFORMATION
131+
ECHO -i, --info Displays program + author info
132+
ECHO -d, --devices Displays available GPUs
133+
ECHO -a, --audio Displays available input + output audio codecs/formats
134+
ECHO -v, --video Displays available input + output video codecs/formats
135+
ECHO.
136+
ECHO ---------------------------------------
137+
ECHO.
138+
ECHO TROUBLESHOOTING:
139+
ECHO - Make sure you're using the most updated Nvidia drivers. The project currently uses NVEncC version %nvenccVer%. Make sure you're using Nvidia graphics driver %minNV% or later.
140+
ECHO.
141+
ECHO.
142+
ECHO.
143+
ECHO For far more information, check the TcNo Transcoder Wiki https://github.com/TcNobo/TcNo-Transcoder/wiki
144+
GOTO :eof
145+
146+
:info
147+
CLS
148+
ECHO Hello.
149+
ECHO Welcome to TechNobo's Video Transcoder %batVer%
150+
ECHO built for generating Proxy files with multitrack audio quickly.
151+
ECHO.
152+
ECHO ---------------------------------------
153+
ECHO.
154+
ECHO This project is Open-Source, licensed under GPL-3.0
155+
ECHO You can see what's going on under the hood, or contribute here:
156+
ECHO GitHub: https://GitHub.com/TcNobo/TcNo-Transcoder
157+
ECHO.
158+
ECHO -------------------------------
159+
ECHO Created with love from TechNobo
160+
ECHO -------------------------------
161+
ECHO Instagram: https://www.instagram.com/TcNobo/
162+
ECHO Twitter: https://twitter.com/TcNobo
163+
ECHO YouTube: https://YouTube.com/TechNobo
164+
ECHO Web: https://tcno.co/
165+
ECHO.
166+
ECHO.
167+
ECHO Happy transcoding :)
168+
GOTO :eof
169+
170+
:devices
171+
CLS
172+
ECHO NOTE:
173+
ECHO When manually setting: use 0, 1, or any other integer, next to the GPU of your choice
174+
ECHO The following GPU's are available for NVEncC transcoding:
175+
%nvexe% --check-device
176+
GOTO :eof
177+
178+
:audio
179+
CLS
180+
ECHO.
181+
ECHO TechNobo's Video Transcoder
182+
ECHO ------------------------------------------
183+
ECHO Listing available audio ENCODERS (output)
184+
ECHO ------------------------------------------
185+
ECHO.
186+
%nvexe% --check-encoders
187+
ECHO.
188+
ECHO ------------------------------------------
189+
ECHO Listing available audio DECODERS (input)
190+
ECHO ------------------------------------------
191+
ECHO.
192+
ECHO.
193+
%nvexe% --check-decoders
194+
ECHO.
195+
ECHO ------------------------------------------
196+
ECHO Remember to scroll to the top.
197+
ECHO ABOVE: Audio ENCODERS and then DECODERS.
198+
ECHO.
199+
ECHO To see a list of videdo encoders, use -v
200+
ECHO ------------------------------------------
201+
GOTO :eof
202+
203+
:video
204+
CLS
205+
ECHO.
206+
ECHO TechNobo's Video Transcoder
207+
ECHO ------------------------------------------
208+
ECHO.
209+
%nvexe% --check-formats
210+
ECHO.
211+
ECHO ------------------------------------------
212+
ECHO Remember to scroll to the top.
213+
ECHO ABOVE: Video Muxers and Demuxers.
214+
ECHO.
215+
ECHO ^|^| D- : Demuxer (input) ONLY.
216+
ECHO ^|^| -M : Muxer (output) ONLY.
217+
ECHO ^|^| DM : Demuxer and Muxer, both input and output available.
218+
ECHO.
219+
ECHO To see a list of audio encoders, use -a
220+
ECHO ------------------------------------------
221+
GOTO :eof
222+
::---------------------------------------
223+
224+
225+
::---------------------------------------
226+
:: ------------- FUNCTIONS -------------
227+
::---------------------------------------
228+
:: Check if Windows is x32 or x64, unless otherwise specified.
229+
:getbit
230+
REG Query "HKLM\Hardware\Description\System\CentralProcessor\0" | find /i "x86" > NUL && set OS=32BIT || SET OS=64BIT
231+
IF %OS%==32BIT SET bit=32
232+
IF %OS%==64BIT SET bit=64
233+
GOTO getbitReturn
234+
:: Sets the output file and folder, depending on whether the user set the output folder, or not.
235+
:: Runs when the output folder is set manually:
236+
:FolderGiven
237+
for %%f in (%inF%) do set fnW=%%~nf
238+
set outF=%outFLD%\%fnW%%suf%.%outFM%
239+
IF NOT DEFINED multi ( GOTO fgReturn ) ELSE ( GOTO multifgReturn )
240+
241+
:: Runs when the output folder is NOT set manually:
242+
:NoFolderGiven
243+
FOR %%f IN (%inF%) DO set fn=%%~dpnf
244+
set outF=%fn%%suf%.%outFM%
245+
IF NOT DEFINED multi ( GOTO fgReturn ) ELSE ( GOTO multifgReturn )
246+
247+
:: Sets the string that the program will run. This is what does all the magic.
248+
:setStr
249+
IF NOT DEFINED ovrr ( GOTO noOverride ) ELSE ( GOTO override )
250+
:noOverrideReturn
251+
:overrideReturn
252+
IF NOT DEFINED multi ( GOTO setStrReturn ) ELSE ( GOTO multiStrReturn )
253+
254+
:: Setting string when no override defined.
255+
:noOverride
256+
SET comStr=%nvexe% -i %inf% --%decodemode% --codec %codec% --fps %fps% --output-res %res% --profile %profile% --level %level% --preset %preset% --lookahead %lookahead% --cuda-schedule %cudasch% --%bitrate% --gop-len %GOPLen% --bframes %bframes% --ref %ref% --mv-precision %mvpr% --colormatrix %cm% --output "%outF%"
257+
IF DEFINED audiocopy (set comStr=%comStr% --audio-copy)
258+
IF DEFINED audiocodec (set comStr=%comStr% --audio-codec %audiocodec%)
259+
IF DEFINED sar (set comStr=%comStr% --sar %sar%)
260+
IF DEFINED cabac (set comStr=%comStr% --cabac)
261+
IF DEFINED deblock ( GOTO deblock )
262+
:deblockReturn
263+
IF DEFINED gpu (set comStr=%comStr% --device %gpu%)
264+
IF DEFINED otherargs (set comStr=%comStr% %otherargs%)
265+
GOTO noOverrideReturn
266+
267+
:: Enables or disables the Deblock flag, if set in settings.bat
268+
:deblock
269+
IF "%deblock%"=="on" (set comStr=%comStr% --deblock)
270+
IF "%deblock%"=="off" (set comStr=%comStr% --no-deblock)
271+
GOTO deblockReturn
272+
273+
:: Setting string when override defined
274+
:override
275+
IF DEFINED otherargs (
276+
SET comStr=%nvexe% -i %inf% --output "%outF%" %otherargs%
277+
) ELSE (
278+
ECHO.
279+
ECHO ERROR:
280+
ECHO No other settings were found in "otherargs".
281+
ECHO Check your settings and relaunch
282+
PAUSE
283+
GOTO :eof
284+
)
285+
GOTO overrideReturn
286+
287+
:processMulti
288+
:: Tells :FolderGiven, :NoFolderGiven and :setStr where to return to
289+
SET multi=1
290+
291+
:: Loops through each file dragged onto the .bat
292+
:loop
293+
:: Checks if it's a folder
294+
FOR %%i IN (%1) DO IF EXIST %%~si\NUL ( GOTO fldr ) ELSE ( GOTO notFldr )
295+
:fldr
296+
:: FOLDER
297+
SET fld=1
298+
ECHO ---------------------------
299+
ECHO Discovering files in folder: %1
300+
SET i=0
301+
:: Lists files in folder, and counts
302+
FOR %%i IN (%1\*.*) DO (
303+
ECHO - %%i
304+
SET /A i+=1
305+
)
306+
ECHO ---------------------------
307+
ECHO PROCESSING %i% FILES
308+
ECHO ---------------------------
309+
310+
:: Processes each file in folder
311+
FOR %%i IN (%1\*.*) DO ( CALL :processFile )
312+
ECHO ---------------------------
313+
ECHO FOLDER %1 COMPLETE
314+
ECHO ---------------------------
315+
GOTO nextArg
316+
:notFldr
317+
:: NOT A FOLDER
318+
SET fld=0
319+
SET inF=%1
320+
GOTO processFile
321+
:processFileReturn
322+
:nextArg
323+
:: Incriments the argument counter then loops if there are more to process.
324+
SHIFT
325+
IF not [%1]==[] GOTO loop
326+
ECHO.
327+
ECHO.
328+
GOTO thanks
329+
:thanksMultiReturn
330+
PAUSE
331+
GOTO :eof
332+
333+
:processFile
334+
IF "%fld%"=="1" ( SET inF=%%i )
335+
:: Gets output file and directory
336+
IF DEFINED outFLD ( GOTO FolderGiven) ELSE ( GOTO NoFolderGiven)
337+
:multifgReturn
338+
339+
:: Sets string that it will run, and then runs it.
340+
GOTO setStr
341+
:multiStrReturn
342+
ECHO.
343+
ECHO PROCESSING:
344+
ECHO %comStr%
345+
ECHO.
346+
%comStr%
347+
ECHO.
348+
ECHO COMPLETE
349+
ECHO.
350+
IF "%fld%"=="0" ( GOTO processFileReturn ) ELSE ( exit /b )
351+
352+
:multiCancel
353+
:: Ends file if the user does not wish to continue.
354+
ECHO Operation cancelled.
355+
PAUSE
356+
GOTO :eof
357+
358+
:welcome
359+
ECHO Welcome to TechNobo's Video Transcoder %batVer%
360+
ECHO ------------------------
361+
ECHO Run with -h or --help to display help.
362+
ECHO Run with -i or --info to display info.
363+
ECHO ------------------------
364+
ECHO.
365+
GOTO welcomeReturn
366+
367+
:thanks
368+
ECHO Everything complete.
369+
ECHO Thanks for using TechNobo's Transcoder!
370+
ECHO ---------------------
371+
ECHO GitHub: https://github.com/TcNobo/TcNo-Transcoder
372+
ECHO YouTube: https://YouTube.com/TechNobo
373+
ECHO Web: https://tcno.co/
374+
IF NOT DEFINED multi ( GOTO thanksReturn ) ELSE ( GOTO thanksMultiReturn )
375+
::---------------------------------------

0 commit comments

Comments
 (0)