- Jul 6, 2005
- 922
- 0
- 0
My goal is to locate files over 750mb and convert them with handbrake to mkv. Handbrake has a Import option for xml file. In my code its going to movie.queue. Currently using toconvert.bat to convert one by one; but this option takes forever.
This is what I have so far.
Have a problem with the xml file its including the double quotes. And will not run the script with out the quotes. Thanks for any input.
See [post=30717285]post[/post] for resolved batch file.
This is what I have so far.
Code:
@ECHO off
setLocal EnableDelayedExpansion
SET WorkingPath=%CD%
SET filesize=750000000
SET J=1
SET FileExt=*.avi
SET "PathToHandbrake=C:\Program Files (x86)\Handbrake\HandBrakeCLI.exe"
SET "HandbrakeArgs=-f mkv --strict-anamorphic -e x264 -S 700 -a 1 -E faac -6 dpl2 -R 48 -B 160 -D 0.0 --subtitle scan -x ref=2:bframes=2:subq=6:mixed-refs=0:weightb=0:8x8dct=0:trellis=0 -C 2 -v 1"
ECHO %time% - Batch Converter Started > toconvert.txt
ECHO %time% - Batch Converter Started > toremove.txt
echo "<?xml version="1.0"?>" > movie.queue
echo " <ArrayOfJob xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">" >> movie.queue
FOR /R "%WorkingPath%" %%a IN (%FileExt%) DO (
IF %%~za GTR %filesize% (
ECHO "%PathToHandbrake%" -i "%%~dpa%%~nxa" -t 1 -c 1 -o"%%~dpa%%~na.mkv" %HandbrakeArgs% >> toconvert.bat
ECHO REN "%%~dpa%%~nxa" "%%~dpa%%~na.delete" >> toremove.txt
echo " <Job>" >> movie.queue
echo " <Id>!J!</Id>" >> movie.queue
echo " <Query>-i "%%~dpa%%~nxa" -t 1 -c 1 -o "%%~dpa%%~na.mkv" %HandbrakeArgs% </Query>" >> movie.queue
echo " <CustomQuery>false</CustomQuery>" >> movie.queue
echo " <Source>"%%~dpa%%~nxa"</Source>" >> movie.queue
echo " <Destination>"%%~dpa%%~na.mkv"</Destination>" >> movie.queue
echo " </Job>" >> movie.queue
SET /A J+=1
)
)
echo "</ArrayofJob>" >> movie.queue
ECHO %time% - Batch Converter Ended >> toconvert.txt
ECHO %time% - Batch Converter Ended >> toremove.txt
PAUSE
Have a problem with the xml file its including the double quotes. And will not run the script with out the quotes. Thanks for any input.
See [post=30717285]post[/post] for resolved batch file.
Last edited: