@echo off
color 70
cls
REM Initial Setup of any variables that are needed throughout
rem Set X86 Folder to run on both x86 and x64 in 32-bit mode. This assumes that no x64 software is used, only x64
set ProgRoot=%ProgramFiles%
if not "%ProgramFiles(x86)%" == "" set ProgRoot=%ProgramFiles(x86)%
rem echo %ProgRoot%
set ProgMSExpress=%ProgRoot%
set ProgRootVLC=%ProgRoot%
REM Initial Startup to Test if x64 software is there. This is still in Testing
if exist "%ProgramFiles%\Microsoft Expression\Encoder 2\Encoder" (
set ProgMSExpress=%ProgramFiles%
) else (
rem set ProgMSExpress=%ProgramFiles(x86)%
)
if exist "%ProgramFiles%\VideoLAN\VLC\vlc.exe" (
set ProgRootVLC=%ProgramFiles%
) else (
rem set ProgRootVLC=%ProgramFiles(x86)%
)
ECHO --------------------------------------
ECHO.
ECHO Welcome to DVDEncoder.bat
ECHO.
ECHO Written by
ECHO Shane Purcella
ECHO.
ECHO.
ECHO --------------------------------------
ECHO.
ECHO.
ECHO After Answering the following question, you may wish
ECHO to leave this running overnight until everything is done.
Rem Ask User Input for Title to Use
ECHO.
ECHO.
ECHO.
:input
set INPUT=
set /P INPUT=Type Title Number used by VLC to play DVD Movie: %=%
if "%INPUT%"=="" goto input
set DVDTITLE=%INPUT%
Rem Ask User Input if the user wishes to only encode a set amount of movie
:timeinput
ECHO.
ECHO.
ECHO.
ECHO TYPE AN INTEGER VALUE TO ONLY ENCODE A SET AMOUNT OF MOVIE
ECHO OTHERWISE INPUT ANY OTHER NON INTEGER LETTER
set INPUT=
set /P TIMEINPUT=Type an Integer value to only encode a set amount of movie: %=%
if "%TIMEINPUT%"=="" goto timeinput
if %TIMEINPUT% EQU +%TIMEINPUT% (
set EncodeTime= --stop-time=%TIMEINPUT%
) else (
set EncodeTime=
)
rem echo %EncodeTime%
rem if %TIMEINPUT% EQU +%TIMEINPUT% @echo Variable TIMEINPUT contains an integer.
rem --stop-time=30
cls
echo Using Title %INPUT%
ECHO.
ECHO ...
ECHO.
ECHO.
ECHO.
ECHO.
Echo Generate Time at end of file
rem created unique log filename, Bit like XP\2k : 26-11-2003@Wed@03_41_pm
rem or NT4 26-11-2003@Wed@03_41__
rem get date, make if file name friendly
FOR /F "tokens=1-4 delims=/ " %%i in ('date/t') do set d=%%j-%%k-%%l
rem get time, make if file name friendly
FOR /F "tokens=1-9 delims=:. " %%i in ('time/t') do set t=%%i_%%j_%%k%%l
set LOG=%d%%t%
rem echo YOUR FILE NAME IS : %log%
rem Echo Create File as will be created using Notepad
rem notepad "%~dp0NameMe %log%.wmv"
rem pause
set TEMPFILE=%~dp0FullDVD %log%.mp4
rem echo %tempfile%
set WMVFILE=%~dp0NameMe %log%.wmv
rem pause
color 73
color 84
color 78
cls
ECHO --------------------------------------
ECHO.
ECHO Encoding Starting
ECHO.
ECHO This will take a some time
ECHO.
ECHO.
ECHO --------------------------------------
ECHO.
ECHO ...
ECHO TEMPORARY FILE USED: %TEMPFILE%
ECHO WMV MOVIE FILE USED: %WMVFILE%
ECHO ...
ECHO.
ECHO All Temporary Files will be deleted at the end of this process
ECHO.
ECHO.
ECHO.
rem echo %ProgRootVLC%
rem echo %ProgMSExpress%
rem pause
rem Change to VLC Directory
cd "%ProgRootVLC%\VideoLAN\VLC"
echo Start encoding Movie to Temporary File where this Script was run from
echo Your Temporary File is located and called %tempfile%
vlc %EncodeTime% -vvv "dvd://D:\@%DVDTITLE%" --sout-ffmpeg-qscale 1 :sout=#transcode{vcodec=mp4v,vb=1024,scale=1,acodec=mp4a,ab=192,channels=2}:duplicate{dst=std{access=file,mux=mp4,dst="%TEMPFILE%"}} vlc://quit
ECHO.
ECHO ...
ECHO ...
ECHO.
ECHO.
ECHO.
rem Change to VLC Microsoft Expression Encoder 2 Directory
cd "%ProgMSExpress%\Microsoft Expression\Encoder 2"
echo Start encoding Movie from Temporary File to WMV Format
Encoder.exe /Source "%TEMPFILE%" /Target "%WMVFILE%" /FileOutputMode AsfSingleFile /AspectRatioMode Source
rem Previous Options used
rem /VideoComplexity Best --- Removed as this created really large files and took forever and a day to make
echo Delete Temporary File
del /F /Q "%TEMPFILE%"