[Update 4 - July 18 2006:
Thanks to Charlie for info on the Panasonic DMR-EH50. New line in Section 3 for recorders that show
the correct number of programs in vstrip.
Added a log file for program output and error data.
[Update 3 - June 14 2006:
Thanks to mimwdv for his suggestions. The improvements are as follows:
1) Autodetection of ntsc and pal
2) Allow for a custom menu background
3) Fixed bug found by mimwdv
4) Main menu text is now anti-aliased
5) Better support for AC3 recordings
6) Uses a dummy button so that no menu selection is highlighted by default (this follows from number 4 above).
[Update 2 - June 1 2006 12:47: IMPORTANT NOTE:
When copying and pasting the text below, watch out for trailing spaces at the ends of the lines. The trailing spaces will break the batch file.]
[Update 1- May 6 2006 10:23: Correct font usage]
Hello everyone,
I don't know if anyone is interested, but I created a batch file for a friend with a standalone DVD recorder. He records one or more programs onto DVD rewritables and then runs this batch file to create a new DVD (with crude menus and chapter cuts) with the commercials removed by Comskip and Cuttermaran. Instructions for making any changes are in the comments of the file. Here it is:
Code:
@ECHO OFF
::USER INSTRUCTIONS
::This Batch File is designed to take a DVD home recording from a standalone home recorder
::with one or more recordings on it, remove the commercials from it and record it onto a new DVD with menus.
::PLEASE NOTE - MAY NOT BE COMPATIBLE WITH AC3 SOUND RECORDINGS
::Requirements:
:: OS:
:: Windows XP
:: Programs:
:: Comskip
:: DVDDecrypter
:: Cuttermaran
:: ImageMagick
:: DVDAuthor
:: MKISOFS
:: vStrip
::The programs are all available from http://www.videohelp.com
::The batch file is divided into sections. There are two sections where the user may need to make
::some changes. The first is the Declaratations section. In that section you will see a number of
::programs that need to be installed. Do a Google search or search on Videohelp.com to find them.
::Change the declarations section if your programs are in a different location. As well, you need to
::change the location on the hard drive that the movies will be processed on and your DVD drive.
::The second section to be modified is Section 3. This section has been written for use in Cyberhome 1600 DVD home
::recorders. This unit records X programs under VTS01 and shows 2(X+1) PGC entries under VTS01. Your
::unit may be different. If you have trouble getting the correct number of programs with this batch
::file, run the following command at a command prompt:
::"C:\program files\vstrip\vstrip.exe Z:\video_ts\vts_01_1.vob -iZ:\video_ts\vts_01_0.ifo -w1 > vstrip_out.txt
::(Replace Z: with your dvd drive in the command and the correct location of vstrip.)
::Send a PM to "peliopoulos" at the comskip forum (http://mk.kaashoek.com/comskip/index.php) with the following
::information:
::A) Your make and model of DVD recorder
::B) The information in vstrip_out.txt
::C) The number of programs that were recorded on the DVD.
::I will try to customize the results to match your standalone recorder.
::----------
::Update July 18 2006 An optional line has been included for other recorders that show the correct number of shows.
::Please see section 3 for details.
::----------
::Optionally, you can also make changes to the look of the menu and the buttons on it. However, that will
::be left as an exercise for the reader. You can start with changing the declarations for font color, background color etc.
::Finally, run Cuttermaran once with an mpg file, make some cuts, go to Edit; Cut Audio/Video and change the
::folders under the Common and Muxing tabs to the same folder as the WORKINGDIR variable below.
::---------------------
::Start Declarations Section
::Set locations of local files and initialize variables
::---------------------
setlocal
set WORKINGDIR="X:\Recording\"
set DVDDRIVE=Z:
::Change this block to the desired drives and folders.
set DVDDECRYPTER="C:\Program Files\DVD Decrypter\DVDDecrypter.exe"
set COMSKIP="C:\Program Files\Comskip\Comskip.exe"
set CUTTERMARAN="C:\Program Files\Cuttermaran\Cuttermaran.exe"
set DVDAUTHORDIR="C:\Program Files\dvdauthor"
set MKISOFS="C:\Program Files\mkisofs\mkisofs.exe"
set VSTRIP="C:\Program Files\vStrip\vStrip.exe"
set IMAGEMAGICKDIR="C:\Program Files\ImageMagick"
set FONTDIR="C:\Windows\Fonts"
set MENUBACKGROUND="C:\Pictures\DVD Menu Background.jpg"
set LOGFILE="\dvdcomskip.log"
::Change this block as required; keep all quotation marks
set MPLEX="%DVDAUTHORDIR:~1,-1%\mplex.exe"
set DVDAUTHOR="%DVDAUTHORDIR:~1,-1%\dvdauthor.exe"
set JPEG2YUV="%DVDAUTHORDIR:~1,-1%\jpeg2yuv.exe"
set PNG2YUV="%DVDAUTHORDIR:~1,-1%\png2yuv.exe"
set MPEG2ENC="%DVDAUTHORDIR:~1,-1%\mpeg2enc.exe"
set SPUMUX="%DVDAUTHORDIR:~1,-1%\spumux.exe"
set CONVERT="%IMAGEMAGICKDIR:~1,-1%\convert.exe"
set MONTAGE="%IMAGEMAGICKDIR:~1,-1%\montage.exe"
set COMPOSITE="%IMAGEMAGICKDIR:~1,-1%\composite.exe"
::Do not change this block unless you really know what you are doing
set MAINFONTCOLOR=PaleTurquoise1
set ACTIONFONTCOLOR=green1
set HIGHLIGHTFONTCOLOR=blue
set BACKGROUNDCOLOR=gray11
set FONT=Arial.ttf
set FONT=%FONTDIR:~1,-1%\%FONT%
::Text and background colors for DVD menus
::List of Colors is available in %imagemagick%/config/colors.xml or use hex values in the form: #FF0000
::Get the name of the font from the TTF file in the font path
set BUTTONHEIGHT=40
set BUTTONBUFFER=10
set /A BUTTONBUFFER_HALF=%BUTTONBUFFER%/2
::Default values for button height and the distance between buttons measured in pixels
::Don't set the button buffer too low or you will lose the menu links
set VIDEOFORMAT=
::Change to "VIDEOFORMAT=ntsc" or "VIDEOFORMAT=pal" otherwise vstrip will detect automatically
set MAXMENUWIDTH=580
::Do not change these values; they ensure that your DVD menu is viewable on your TV screen
set AUDIO=PCM
::Change to AC3 if required
IF %AUDIO% EQU PCM (SET AUDIOFORMAT=MPEG1 & SET AUDIOEXTENSION=mp2) ELSE (SET AUDIOFORMAT=AC3 & SET AUDIOEXTENSION=ac3)
set FRAMERATE=
set SCREENHEIGHT=
set PGCNUMBER=
set NUMPROGS=
set LABEL=
set DVDLABEL=
set SHOWNAME=
set NUMCOLS=
set NUMROWS=
set BUTTONWIDTH=
set MENU_YPOSITION_TOP=
DATE /T >%LOGFILE%
TIME /T >>%LOGFILE
::---------------------
::End Declarations Section
::---------------------
::\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
::---------------------
::Start Section 1
::Check to see if Comskip is set to output Cuttermaran files
::---------------------
ECHO Section 1 1>>%LOGFILE%
FINDSTR "output_cuttermaran=1" %Comskip:~0,-4%ini" 1>>%LOGFILE% 2>>%LOGFILE%
IF %ERRORLEVEL% EQU 0 GOTO :COMSKIPCHECKPASS
:COMSKIPCHECKFAIL
ECHO Comskip is not configured to output Cuttermaran files.
ECHO Please change the line "output_cuttermaran=0" to "output_cuttermaran=1"
ECHO in %Comskip:~0,-4%ini"
GOTO :EOF
:COMSKIPCHECKPASS
::---------------------
::End Section 1
::---------------------
::\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
::---------------------
::Start Section 2
::Create Working Directory and make it the active directory
::---------------------
ECHO Section 2 >> %LOGFILE%
IF NOT EXIST %WORKINGDIR% mkdir %WORKINGDIR% 1>>%LOGFILE% 2>>%LOGFILE%
cd /d %WORKINGDIR% 1>>%LOGFILE% 2>>%LOGFILE%
:: Change working directory to WORKINGDIR
::---------------------
::End Section 2
::---------------------
::\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
::---------------------
::Start Section 3
::Use vstrip to (a) detect NTSC or PAL and (b) get the number of recorded programs on DVD
::---------------------
ECHO Section 3 >> %LOGFILE%
:: The algorithm below is set up for use with the Cyberhome 1600 DVD Recorder.
:: Other recorders may use different formats.
%VSTRIP% %DVDDRIVE%\video_ts\vts_01_1.vob -i%DVDDRIVE%\video_ts\vts_01_0.ifo -w1 > vstrip_out.txt
:: Output vstrip information to vstrip_out.txt
IF DEFINED VIDEOFORMAT GOTO :CONTINUE
FIND "NTSC" vstrip_out.txt 1>>%LOGFILE% 2>>%LOGFILE%
IF ERRORLEVEL 0 (SET VIDEOFORMAT=ntsc) ELSE (SET VIDEOFORMAT=pal)
:CONTINUE
IF %VIDEOFORMAT% EQU ntsc (set FRAMERATE=29.97 & set SCREENHEIGHT=480) ELSE (set FRAMERATE=25.00 & set SCREENHEIGHT=576)
set /A MAXMENUHEIGHT=%SCREENHEIGHT%-110
::Check for NTSC or PAL
FOR /F "tokens=6 delims= " %%A IN ('findstr %AUDIOFORMAT% vstrip_out.txt') DO ECHO %%A > audio_streams.txt
:: Search for line that contains the number of audio streams and output that line to audio_streams.txt
:: For the Cyberhome 1600 the line contains the following field
:: [0,1,2,3,4,5,6,7,8,9]
:: when there are four programs.
:: Other recorders (e.g. the Panasonic DMR-EH50) show the proper number of programs, e.g.
:: [0,1,2,3]
:: when there are four programs.
FOR /L %%G in (100,-1,2) DO CMD /C FOR /F "tokens=%%G delims=," %%H in (audio_streams.txt) DO @ECHO %%H >> separated_streamnums.txt
:: Treat the commas in the field as field separators, start at 100 and work downwards and start separating the fields into individual lines
:: e.g. the field [0,1,2,3,4,5,6,7,8,9]
:: will be output as:
:: 9]
:: 8
:: 7
:: etc.
:: in the separated_streamnums.txt file
FOR /F "tokens=1 delims=]" %%H in ('findstr "]" separated_streamnums.txt') DO SET /A NUMPROGS=(%%H-1)/2
:: Find the line in the separated_streamnums.txt file that has the "]" character and extract the number from it.
:: Then calculate the number of programs from it.
:: From the example above, the line "9]" in the separated_streamnums.txt file is found, the number "9" extracted,
:: and the number of programs calculated is 4.
::If your recorder shows the correct number of programs (e.g. the Panasonic DMR-EH50) just remove two colons in front of the following line
::FOR /F "tokens=1 delims=]" %%H in ('findstr "]" separated_streamnums.txt') DO SET /A NUMPROGS=%%H+1
ECHO.
ECHO.
ECHO The number of programs detected on this DVD is %NUMPROGS%
::---------------------
::End Section 3
::---------------------
::\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
::---------------------
::Start Section 4
::Get DVD label from User
::---------------------
ECHO Section 4 >> %LOGFILE%
ECHO.
ECHO.
ECHO Type a name for your new DVD (maximum 32 characters, no " marks)
SET /P DVDLABEL=and press ENTER ^>
:: Get user input for DVD Label
IF "%DVDLABEL%"=="" SET DVDLABEL=Recorded DVD
ECHO.
ECHO.
ECHO The new DVD will use the label "%DVDLABEL%"
::---------------------
::End Section 4
::---------------------
::\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
::---------------------
::Start Section 5
::Rip Programs
::---------------------
ECHO Section 5 >> %LOGFILE%
ECHO.
ECHO.
ECHO.
ECHO.
ECHO.
ECHO Ripping recorded DVD using DVDDecrypter
::************
SET PGCNUMBER=1
:LOOPDECRYPT
%DVDDECRYPTER% /MODE IFO /SRC "%DVDDRIVE%" /DEST %WORKINGDIR% /VTS 1 /PGC %PGCNUMBER% /DEMUX 0xE0 0xC0 /START /CLOSE /OVERWRITE YES /SPLIT NONE
:: Use DVDDecrypter to rip recorded DVD to separate files
for %%A in (VTS*.M2V) DO RENAME "%%A" temp%PGCNUMBER%.m2v 1>>%LOGFILE% 2>>%LOGFILE%
for %%B in (VTS*.MP2) DO RENAME "%%B" temp%PGCNUMBER%.%AUDIOEXTENSION% 1>>%LOGFILE% 2>>%LOGFILE%
del VTS*.* /F /Q 1>>%LOGFILE% 2>>%LOGFILE%
:: Rename the ripped files tempX.m2v and tempX.mp2 (or tempX.ac3)
SET /A PGCNUMBER=%PGCNUMBER%+1
IF %PGCNUMBER% LEQ %NUMPROGS% GOTO :LOOPDECRYPT
::************
::---------------------
::End Section 5
::---------------------
::\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
::---------------------
::Start Section 6
::Combine m2v and mp2 (or ac3) files to create an mpg file for use by Comskip
::---------------------
ECHO Section 6 >> %LOGFILE%
ECHO.
ECHO.
ECHO.
ECHO.
ECHO.
ECHO Combining ripped files for use in Comskip
::************
SET PGCNUMBER=1
:LOOPMUX1
%MPLEX% -f 8 -M -v 0 -o temp%PGCNUMBER%.mpg temp%PGCNUMBER%.m2v temp%PGCNUMBER%.%AUDIOEXTENSION% 1>>%LOGFILE% 2>>%LOGFILE%
:: Combine tempX.m2v and tempX.mp2 (or tempX.ac3) into a single file: tempX.mpg
SET /A PGCNUMBER=%PGCNUMBER%+1
IF %PGCNUMBER% LEQ %NUMPROGS% GOTO :LOOPMUX1
::************
::---------------------
::End Section 6
::---------------------
::\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
::---------------------
::Start Section 7
::Run Comskip on tempX.mpg
::---------------------
ECHO Section 7 >> %LOGFILE%
ECHO.
ECHO.
ECHO.
ECHO.
ECHO.
ECHO Detecting commercials using Comskip
::************
SET PGCNUMBER=1
:LOOPCOMSKIP
%COMSKIP% -v 0 "temp%PGCNUMBER%.mpg" 1>>%LOGFILE% 2>>%LOGFILE%
:: Run ComSkip on tempX.mpg
SET /A PGCNUMBER=%PGCNUMBER%+1
IF %PGCNUMBER% LEQ %NUMPROGS% GOTO :LOOPCOMSKIP
::************
del *.mpg /F /Q 1>>%LOGFILE%
::---------------------
::End Section 7
::---------------------
::\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
::---------------------
::Start Section 8
::Run Cuttermaran and to automatically cut commercials detected by Comskip
::---------------------
ECHO Section 8 >> %LOGFILE%
ECHO.
ECHO.
ECHO.
ECHO.
ECHO.
ECHO Cutting detected commercials using Cuttermaran
::************
SET PGCNUMBER=1
:LOOPCUTTERMARAN1
%CUTTERMARAN% "temp%PGCNUMBER%.cpf"
:: Run Cuttermaran to cut the commercials identified by ComSkip
if exist temp%PGCNUMBER%_clean ren temp%PGCNUMBER%_clean temp%PGCNUMBER%_clean.m2v 1>>%LOGFILE% 2>>%LOGFILE%
::Comskip's cpf does not have .m2v extension for Cuttermaran version 1.67
del temp%PGCNUMBER%.m2v /F /Q 1>>%LOGFILE% 2>>%LOGFILE%
del temp%PGCNUMBER%.%AUDIOEXTENSION% /F /Q 1>>%LOGFILE% 2>>%LOGFILE%
SET /A PGCNUMBER=%PGCNUMBER%+1
IF %PGCNUMBER% LEQ %NUMPROGS% GOTO :LOOPCUTTERMARAN1
::************
::---------------------
::End Section 8
::---------------------
::\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
::---------------------
::Start Section 9
::Run Cuttermaran to allow for additional cuts
::---------------------
ECHO Section 9 >> %LOGFILE%
ECHO *
ECHO *
ECHO *
ECHO ***********************************************************************
ECHO * Cuttermaran will now start so you can make additional edits. *
ECHO * Please save the file using the default name in the %WORKINGDIR% *
ECHO * If you don't want to make additional edits, simply exit the program.*
ECHO ***********************************************************************
ECHO *
ECHO *
PAUSE
::************
SET PGCNUMBER=1
:LOOPCUTTERMARAN2
ECHO ^<?xml version="1.0" standalone="yes"?^> > movie%PGCNUMBER%.cpf
ECHO ^<StateData xmlns="http://cuttermaran.kickme.to/StateData.xsd"^> >> movie%PGCNUMBER%.cpf
ECHO ^<usedVideoFiles FileID="0" FileName="temp%PGCNUMBER%_clean.m2v" /^> >> movie%PGCNUMBER%.cpf
ECHO ^<usedAudioFiles FileID="1" FileName="temp%PGCNUMBER%_clean.%AUDIOEXTENSION%" StartDelay="0" /^> >> movie%PGCNUMBER%.cpf
ECHO ^<CurrentFiles refVideoFiles="0"^> >> movie%PGCNUMBER%.cpf
ECHO ^<currentAudioFiles refAudioFiles="1" /^> >> movie%PGCNUMBER%.cpf
ECHO ^</CurrentFiles^> >> movie%PGCNUMBER%.cpf
ECHO ^<CmdArgs OutFile="temp%PGCNUMBER%_clean.m2v" cut="false" unattended="false" muxResult="true" snapToCutPoints="true" closeApp="false" /^> >> movie%PGCNUMBER%.cpf
ECHO ^</StateData^> >> movie%PGCNUMBER%.cpf
:: Create cpf file for Cuttermaran
%CUTTERMARAN% "movie%PGCNUMBER%.cpf"
:: Run Cuttermaran to make new edits to the video
ECHO.
ECHO.
ECHO.
::Create Show Names
ECHO Please type a name for this program (maximum 64 characters, no " marks)
SET /P SHOWNAME=and press ENTER ^>
ECHO %SHOWNAME%> SHOWNAME%PGCNUMBER%.txt
FOR /F "delims=`" %%T IN (SHOWNAME%PGCNUMBER%.txt) DO SET NAMEPROG%PGCNUMBER%=%%T
IF "%SHOWNAME%"=="" SET NAMEPROG%PGCNUMBER%=Program %PGCNUMBER%#
::Get user input for name of show
ECHO.
ECHO.
IF "%SHOWNAME%"=="" (ECHO Show number %PGCNUMBER% will be labelled "Program %PGCNUMBER%") ELSE (ECHO Show number %PGCNUMBER% will be labelled "%SHOWNAME:~0,-1%")
ECHO.
ECHO.
SET SHOWNAME=
SET /A PGCNUMBER=%PGCNUMBER%+1
IF %PGCNUMBER% LEQ %NUMPROGS% GOTO :LOOPCUTTERMARAN2
::************
::---------------------
::End Section 9
::---------------------
::\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
::---------------------
::Start Section 10
::Run mplex to combine initial Cuttermaran output files if no changes were made.
::---------------------
ECHO Section 10 >> %LOGFILE%
::************
SET PGCNUMBER=1
:LOOPMUX2
IF NOT EXIST movie%PGCNUMBER%_cut.mpg ECHO.
IF NOT EXIST movie%PGCNUMBER%_cut.mpg ECHO.
IF NOT EXIST movie%PGCNUMBER%_cut.mpg ECHO.
IF NOT EXIST movie%PGCNUMBER%_cut.mpg ECHO.
IF NOT EXIST movie%PGCNUMBER%_cut.mpg ECHO.
IF NOT EXIST movie%PGCNUMBER%_cut.mpg ECHO No additional edits for Program %PGCNUMBER% selected
IF NOT EXIST movie%PGCNUMBER%_cut.mpg ECHO Muxing Program %PGCNUMBER% from initial cuts
IF NOT EXIST movie%PGCNUMBER%_cut.mpg %MPLEX% -f 8 -M -v 0 -o movie%PGCNUMBER%_cut.mpg temp%PGCNUMBER%_clean.m2v temp%PGCNUMBER%_clean.%AUDIOEXTENSION% 1>>%LOGFILE% 2>>%LOGFILE%
:: If no cuts were made using Cuttermaran, use tempX_clean files to make movieX_cut.mpg
SET /A PGCNUMBER=%PGCNUMBER%+1
IF %PGCNUMBER% LEQ %NUMPROGS% GOTO :LOOPMUX2
::************
del *.%AUDIOEXTENSION% /F /Q 1>>%LOGFILE% 2>>%LOGFILE%
del *.m2v /F /Q 1>>%LOGFILE% 2>>%LOGFILE%
::---------------------
::End Section 10
::---------------------
::\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
::---------------------
::Start Section 11
::Create images and menus for DVD
::---------------------
ECHO Section 11 >> %LOGFILE%
ECHO.
ECHO.
ECHO.
ECHO.
ECHO.
ECHO Creating DVD structure
:: Create transparent background for Main Menu
%CONVERT% -size 720x%SCREENHEIGHT% xc:transparent menubackground.png
:: Calculate the maximum number of rows of buttons based on row height and buffer distance
SET /A MAXROWS=(%MAXMENUHEIGHT%+%BUTTONBUFFER%)/(%BUTTONHEIGHT%+%BUTTONBUFFER%)
:: Calculate the Number of Columns
SET /A NUMCOLS=%NUMPROGS%/%MAXROWS%
SET /A TEMP1=%MAXROWS%*%NUMCOLS%
IF %NUMPROGS% GTR %TEMP1% SET /A NUMCOLS=%NUMCOLS%+1
:: Calculate the number of rows
SET /A NUMROWS=%NUMPROGS%/%NUMCOLS%
SET /A TEMP2=%NUMCOLS%*%NUMROWS%
IF %NUMPROGS% GTR %TEMP2% SET /A NUMROWS=%NUMROWS%+1
:: Calculate the button width
SET /A BUTTONWIDTH=(%MAXMENUWIDTH%+%BUTTONBUFFER%-%BUTTONBUFFER%*%NUMCOLS%)/%NUMCOLS%
::************
::Create Buttons
FOR /L %%n IN (1,1,%NUMPROGS%) DO (call :LOOPCREATEBUTTONS %%n)
GOTO :CONTINUE1
:LOOPCREATEBUTTONS
SET LABEL=NAMEPROG%1
CALL SET LABEL=%%%LABEL%%%
SET LABEL=%LABEL:~0,-1%
IF %1 LSS 10 (SET TEXTPROGNUM=0%1) ELSE (SET TEXTPROGNUM=%1)
%CONVERT% -size %BUTTONWIDTH%x%BUTTONHEIGHT% -gravity center -background transparent -fill %MAINFONTCOLOR% -antialias -font "%FONT%" label:"%LABEL%" mainbutton%TEXTPROGNUM%.png
%CONVERT% -size %BUTTONWIDTH%x%BUTTONHEIGHT% -gravity center -background transparent -fill %ACTIONFONTCOLOR% +antialias -font "%FONT%" label:"%LABEL%" actionbutton%TEXTPROGNUM%.png
%CONVERT% -size %BUTTONWIDTH%x%BUTTONHEIGHT% -gravity center -background transparent -fill %HIGHLIGHTFONTCOLOR% +antialias -font "%FONT%" label:"%LABEL%" highlightbutton%TEXTPROGNUM%.png
GOTO :EOF
:CONTINUE1
::************
::Create Menu Images
IF %NUMPROGS% LSS 10 (SET TEXTNUMPROGS=0%NUMPROGS%) ELSE (SET TEXTNUMPROGS=%NUMPROGS%)
%MONTAGE% mainbutton*.png -tile 1x%NUMROWS% -background transparent -geometry +%BUTTONBUFFER_HALF%+%BUTTONBUFFER_HALF% maintemp.png
%MONTAGE% maintemp*.png -tile x1 -background transparent -geometry +0+0 main_temp.png
%CONVERT% main_temp.png -size 720x%SCREENHEIGHT% xc:transparent +swap -gravity center -composite MainMenu1.png
if exist %MENUBACKGROUND% (%CONVERT% %MENUBACKGROUND% -resize 720x%SCREENHEIGHT%! menubackground_pic.png) ELSE (%CONVERT% -size 720x%SCREENHEIGHT% xc:%BACKGROUNDCOLOR% menubackground_pic.png)
::Inserts background picture or plain color
%COMPOSITE% MainMenu1.png menubackground_pic.png MainMenu.png
%MONTAGE% actionbutton*.png -tile 1x%NUMROWS% -background transparent -geometry +%BUTTONBUFFER_HALF%+%BUTTONBUFFER_HALF% actiontemp.png
%MONTAGE% actiontemp*.png -tile x1 -background transparent -geometry +0+0 action_temp.png
%CONVERT% action_temp.png -size 720x%SCREENHEIGHT% xc:transparent +swap -gravity center -composite ActionMenu.png
%MONTAGE% highlightbutton*.png -tile 1x%NUMROWS% -background transparent -geometry +%BUTTONBUFFER_HALF%+%BUTTONBUFFER_HALF% highlighttemp.png
%MONTAGE% highlighttemp*.png -tile x1 -background transparent -geometry +0+0 highlight_temp.png
%CONVERT% highlight_temp.png -size 720x%SCREENHEIGHT% xc:transparent +swap -gravity center -composite HighlightMenu.png
::Create MainMenuSpu.xml file for use in menu
ECHO ^<subpictures^> >MainMenuSpu.xml
ECHO ^<stream^> >>MainMenuSpu.xml
ECHO ^<spu start="00:00:00.0" >>MainMenuSpu.xml
ECHO highlight="HighlightMenu.png" >>MainMenuSpu.xml
ECHO select="ActionMenu.png" >>MainMenuSpu.xml
ECHO force="yes" >>MainMenuSpu.xml
ECHO autoorder="rows"^> >>MainMenuSpu.xml
ECHO ^<button name="DUMMYBUTTON" x0="1" y0="1" x1="2" y1="2"/^> >>MainMenuSpu.xml
::Need dummy button so that first menu item is not highlighted by default
::The highlight and action fonts are not antialiased, while the menu font is antialiased.
::When the menu items are highlighted the antialias-ing of the menu font appears around
::the highlighted font and can look awful. This way the menu looks nicer on first loading
::with the antialiased font.
::************
FOR /L %%n IN (1,1,%NUMPROGS%) DO (call :LOOPCREATESPUMUXFILE %%n %BUTTONWIDTH% %NUMROWS% %NUMCOLS%)
GOTO :CONTINUE2
:LOOPCREATESPUMUXFILE
SET PROGRAMNUM=%1
SET BUTTONWIDTH=%2
SET NUMROWS=%3
SET NUMCOLS=%4
SET /A MENU_YPOSITION_TOP=(%SCREENHEIGHT%-(%NUMROWS%*(%BUTTONHEIGHT%+%BUTTONBUFFER%)))/2
SET /A COLUMNNUM=%PROGRAMNUM%/%NUMROWS%
SET /A TEMP3=%COLUMNNUM%*%NUMROWS%
IF %PROGRAMNUM% GTR %TEMP3% SET /A COLUMNNUM=%COLUMNNUM%+1
SET /A ROWNUM=%PROGRAMNUM%-(%NUMROWS%*(%COLUMNNUM%-1))
SET LABEL=NAMEPROG%1
CALL SET LABEL=%%%LABEL%%%
SET LABEL=%LABEL:~0,-1%
SET /A BUTTON_YPOSITION_TOP=%MENU_YPOSITION_TOP%+%BUTTONBUFFER%/2+(%ROWNUM%-1)*(%BUTTONHEIGHT%+%BUTTONBUFFER%)
SET /A BUTTON_YPOSITION_BOTTOM=%BUTTON_YPOSITION_TOP%+%BUTTONHEIGHT%
SET /A BUTTON_XPOSITION_LEFT=(720-%MAXMENUWIDTH%)/2+%BUTTONBUFFER%/2+(%COLUMNNUM%-1)*(%BUTTONWIDTH%+%BUTTONBUFFER%)
SET /A BUTTON_XPOSITION_RIGHT=BUTTON_XPOSITION_LEFT+%BUTTONWIDTH%
ECHO ^<button name="%LABEL%" x0="%BUTTON_XPOSITION_LEFT%" y0="%BUTTON_YPOSITION_TOP%" x1="%BUTTON_XPOSITION_RIGHT%" y1="%BUTTON_YPOSITION_BOTTOM%"/^> >>MainMenuSpu.xml
GOTO :EOF
:CONTINUE2
::************
ECHO ^</spu^> >>MainMenuSpu.xml
ECHO ^</stream^> >>MainMenuSpu.xml
ECHO ^</subpictures^> >>MainMenuSpu.xml
::Create MPEG movies for menus
%PNG2YUV% -n 1 -I p -L 0 -f %FRAMERATE% -j "menubackground.png" 2>>%LOGFILE% | %MPEG2ENC% -f 8 -I 0 -h -q 1 -b 7000 -a 2 -n n -o "MenuBackground.m2v" 1>>%LOGFILE% 2>>%LOGFILE%
%MPLEX% -f 8 -o "MenuBackground.mpg" "MenuBackground.m2v" 1>>%LOGFILE% 2>>%LOGFILE%
%PNG2YUV% -n 1 -I p -L 0 -f %FRAMERATE% -j "MainMenu.png" 2>NUL | %MPEG2ENC% -f 8 -I 0 -h -q 1 -b 7000 -a 2 -n n -o "MainMenuBackground.m2v" 1>>%LOGFILE% 2>>%LOGFILE%
%MPLEX% -f 8 -o "MainMenuBackground.mpg" "MainMenuBackground.m2v" 1>>%LOGFILE% 2>>%LOGFILE%
::Merge Files using spumux
%SPUMUX% "MainMenuSpu.xml" <"MainMenuBackground.mpg" > "MainMenu.mpg" 2>>%LOGFILE%
::Delete temporary PNG files
del *.png /F /Q 1>>%LOGFILE% 2>>%LOGFILE%
::Create dvdauthor xml file
ECHO ^<?xml version="1.0" encoding="utf-8"?^> > dvd.xml
ECHO ^<dvdauthor dest="%WORKINGDIR:~1,-1%DVD"^> >> dvd.xml
ECHO ^<vmgm^> >> dvd.xml
ECHO ^<menus^> >> dvd.xml
ECHO ^<video format="%VIDEOFORMAT%"^>^</video^> >> dvd.xml
ECHO ^<pgc^> >> dvd.xml
ECHO ^<pre^> { {button = 1024;} } ^</pre^> >> dvd.xml
ECHO ^<vob file="MainMenu.mpg" pause="inf"/^> >> dvd.xml
ECHO ^<button name="DUMMYBUTTON"^>g1=1;jump title 1;^</button^> >> dvd.xml
::************
FOR /L %%n IN (1,1,%NUMPROGS%) DO (call :LOOPCREATEDVDAUTHORFILE %%n)
GOTO :CONTINUE3
:LOOPCREATEDVDAUTHORFILE
SET LABEL=NAMEPROG%1
CALL SET LABEL=%%%LABEL%%%
SET LABEL=%LABEL:~0,-1%
SET /A G1VALUE=%1+1
ECHO ^<button name="%LABEL%"^>g1=%G1VALUE%;jump title %1;^</button^> >> dvd.xml
GOTO :EOF
:CONTINUE3
::************
ECHO ^</pgc^> >> dvd.xml
ECHO ^</menus^> >> dvd.xml
ECHO ^</vmgm^> >> dvd.xml
ECHO ^<titleset^> >> dvd.xml
ECHO ^<menus^> >> dvd.xml
ECHO ^<video format="ntsc"^>^</video^> >> dvd.xml
ECHO ^<pgc^> >> dvd.xml
ECHO ^<vob file="MenuBackground.mpg" /^> >> dvd.xml
ECHO ^<post^>jump vmgm menu 1;^</post^> >> dvd.xml
ECHO ^</pgc^> >> dvd.xml
ECHO ^</menus^> >> dvd.xml
ECHO ^<titles^> >> dvd.xml
::************
SET PGCNUMBER=1
:LOOPXML2
ECHO ^<pgc^> >> dvd.xml
ECHO ^<vob file="movie%PGCNUMBER%_cut.mpg" chapters= "00:00:00,00:10:00,00:20:00,00:30:00,00:40:00,00:50:00,01:00:00,01:10:00,01:20:00,01:30:00,01:40:00,01:50:00,02:00:00,02:10:00,02:20:00,02:30:00,02:40:00,02:50:00,03:00:00"/^> >> dvd.xml
ECHO ^<post^>call vmgm menu 1;^</post^> >> dvd.xml
ECHO ^</pgc^> >> dvd.xml
SET /A PGCNUMBER=%PGCNUMBER%+1
IF %PGCNUMBER% LEQ %NUMPROGS% GOTO :LOOPXML2
::************
ECHO ^</titles^> >> dvd.xml
ECHO ^</titleset^> >> dvd.xml
ECHO ^</dvdauthor^> >> dvd.xml
::---------------------
::End Section 11
::---------------------
::\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
::---------------------
::Start Section 12
::Create DVD File structure using DVDAuthor
::---------------------
ECHO Section 12 >> %LOGFILE%
:: Convert movies into DVD format on the hard drive
%DVDAUTHOR% -x dvd.xml 1>>%LOGFILE% 2>>%LOGFILE%
::---------------------
::End Section 12
::---------------------
::\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
::---------------------
::Start Section 13
::Create ISO file from DVD File structure
::---------------------
ECHO Section 13 >> %LOGFILE%
ECHO.
ECHO.
ECHO.
ECHO.
ECHO.
ECHO Creating ISO file
%MKISOFS% -dvd-video -V "%DVDLABEL%" -o movie.iso ./dvd 1>>%LOGFILE% 2>>%LOGFILE%
:: Create an ISO image file from the DVD format created above
::---------------------
::End Section 13
::---------------------
::\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
::---------------------
::Start Section 14
::Burn DVD using DVDDecrypter
::---------------------
ECHO Section 14 >> %LOGFILE%
ECHO.
ECHO.
ECHO.
ECHO.
ECHO.
ECHO Burning edited DVD
ECHO *
ECHO *
ECHO *
ECHO ***************************************************************
ECHO * Please Insert A New Blank Recordable DVD Now *
ECHO ***************************************************************
ECHO *
ECHO *
ECHO *
PAUSE
%DVDDECRYPTER% /MODE ISOWRITE /SRC "MOVIE.ISO" /DEST "%DVDDRIVE%" /OVERWRITE YES /START /CLOSE
:: Burn Disc using ISO file
::---------------------
::End Section 14
::---------------------
::\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
::---------------------
::Start Section 15
::Remove files created in this process
::---------------------
ECHO Section 15 >> %LOGFILE%
::This is an optional step. To allow deletion of temporary files, simply delete the "::" marks
::del %WORKINGDIR%\*.* /F /Q /S 1>>%LOGFILE% 2>>%LOGFILE%
::rmdir %WORKINGDIR%\dvd /F /Q 1>>%LOGFILE% 2>>%LOGFILE%
::---------------------
::End Section 15
::---------------------
::\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
::---------------------
::Start Section 16
::Advise User that process is complete
::---------------------
ECHO Section 16 >> %LOGFILE%
ECHO.
ECHO.
ECHO.
ECHO.
ECHO.
ECHO The new edited DVD has now been burned. Please remove the DVD from the drive.
ECHO The program will now exit.
ECHO.
ECHO.
ECHO.
ECHO.
PAUSE
::---------------------
::End Section 16
::---------------------
::\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
endlocal
EXIT