Most of my scripting is rather simplistic; I'm not trying to "find all files in folder X and process them", I'm simply repeating the same settings over multiple files, primarily for episodic animation and similar programs. So I'll start with a simple one, where everything is explicitly included in the command line:
Code: Select all
title %time% House S1 HD01 & "C:\Program Files\Handbrake\HandBrakeCLI.exe" -i "Z:\House\House S1 HD01.mkv" -t 1 -o "V:\tv series\House\Season1\House S1 HD01.m4v" -f mp4 -O -w 1920 --crop 0:0:0:0 --loose-anamorphic --modulus 2 -e x264 -q 20 --vfr -a 2,2 -E ac3,copy:dts -6 dpl2,none -R Auto,Auto -B 160,0 -D 0,0 --gain 0,0 --audio-fallback ac3 --encoder-preset=medium --encoder-profile=main --verbose=1
title %time% House S1 HD02 & "C:\Program Files\Handbrake\HandBrakeCLI.exe" -i "Z:\House\House S1 HD02.mkv" -t 1 -o "V:\tv series\House\Season1\House S1 HD02.m4v" -f mp4 -O -w 1920 --crop 0:0:0:0 --loose-anamorphic --modulus 2 -e x264 -q 20 --vfr -a 2,2 -E ac3,copy:dts -6 dpl2,none -R Auto,Auto -B 160,0 -D 0,0 --gain 0,0 --audio-fallback ac3 --encoder-preset=medium --encoder-profile=main --verbose=1
title %time% House S1 HD03 & "C:\Program Files\Handbrake\HandBrakeCLI.exe" -i "Z:\House\House S1 HD03.mkv" -t 1 -o "V:\tv series\House\Season1\House S1 HD03.m4v" -f mp4 -O -w 1920 --crop 0:0:0:0 --loose-anamorphic --modulus 2 -e x264 -q 20 --vfr -a 2,2 -E ac3,copy:dts -6 dpl2,none -R Auto,Auto -B 160,0 -D 0,0 --gain 0,0 --audio-fallback ac3 --encoder-preset=medium --encoder-profile=main --verbose=1
title %time% House S1 HD04 & "C:\Program Files\Handbrake\HandBrakeCLI.exe" -i "Z:\House\House S1 HD04.mkv" -t 1 -o "V:\tv series\House\Season1\House S1 HD04.m4v" -f mp4 -O -w 1920 --crop 0:0:0:0 --loose-anamorphic --modulus 2 -e x264 -q 20 --vfr -a 2,2 -E ac3,copy:dts -6 dpl2,none -R Auto,Auto -B 160,0 -D 0,0 --gain 0,0 --audio-fallback ac3 --encoder-preset=medium --encoder-profile=main --verbose=1
A slightly more complicated one, where multiple episodes are within a single file, and I want them split out:
Code: Select all
title %time% Rascal HD01 & "C:\Program Files\Handbrake\HandBrakeCLI.exe" -i "Z:\Rascal Does Not Dream\Rascal Does Not Dream HD01-04.mkv" -c 1-6 -o "V:\anime\subtitled\r\Rascal Does Not Dream\Rascal Does Not Dream HD01.mkv" -f mkv -w 1920 --crop 0:0:0:0 --loose-anamorphic --modulus 2 -e x264 -q 20 --vfr -a 1,1 -E ac3,fdk_aac -6 dpl2,dpl2 -R Auto,48 -B 160,160 -D 0,0 --gain 0,0 --audio-fallback ac3 --subtitle 1 --markers="C:\Users\jeffb\AppData\Local\Temp\Rascal Does Not Dream HD01-1-chapters.csv" --verbose=1
title %time% Rascal HD02 & "C:\Program Files\Handbrake\HandBrakeCLI.exe" -i "Z:\Rascal Does Not Dream\Rascal Does Not Dream HD01-04.mkv" -c 7-12 -o "V:\anime\subtitled\r\Rascal Does Not Dream\Rascal Does Not Dream HD02.mkv" -f mkv -w 1920 --crop 0:0:0:0 --loose-anamorphic --modulus 2 -e x264 -q 20 --vfr -a 1,1 -E ac3,fdk_aac -6 dpl2,dpl2 -R Auto,48 -B 160,160 -D 0,0 --gain 0,0 --audio-fallback ac3 --subtitle 1 --markers="C:\Users\jeffb\AppData\Local\Temp\Rascal Does Not Dream HD01-1-chapters.csv" --verbose=1
title %time% Rascal HD03 & "C:\Program Files\Handbrake\HandBrakeCLI.exe" -i "Z:\Rascal Does Not Dream\Rascal Does Not Dream HD01-04.mkv" -c 13-19 -o "V:\anime\subtitled\r\Rascal Does Not Dream\Rascal Does Not Dream HD03.mkv" -f mkv -w 1920 --crop 0:0:0:0 --loose-anamorphic --modulus 2 -e x264 -q 20 --vfr -a 1,1 -E ac3,fdk_aac -6 dpl2,dpl2 -R Auto,48 -B 160,160 -D 0,0 --gain 0,0 --audio-fallback ac3 --subtitle 1 --markers="C:\Users\jeffb\AppData\Local\Temp\Rascal Does Not Dream HD01-1-chapters.csv" --verbose=1
title %time% Rascal HD04 & "C:\Program Files\Handbrake\HandBrakeCLI.exe" -i "Z:\Rascal Does Not Dream\Rascal Does Not Dream HD01-04.mkv" -c 20-25 -o "V:\anime\subtitled\r\Rascal Does Not Dream\Rascal Does Not Dream HD04.mkv" -f mkv -w 1920 --crop 0:0:0:0 --loose-anamorphic --modulus 2 -e x264 -q 20 --vfr -a 1,1 -E ac3,fdk_aac -6 dpl2,dpl2 -R Auto,48 -B 160,160 -D 0,0 --gain 0,0 --audio-fallback ac3 --subtitle 1 --markers="C:\Users\jeffb\AppData\Local\Temp\Rascal Does Not Dream HD01-1-chapters.csv" --verbose=1
title %time% Rascal D01 & "C:\Program Files\Handbrake\HandBrakeCLI.exe" -i "Z:\Rascal Does Not Dream\Rascal Does Not Dream HD01-04.mkv" -c 1-6 -o "V:\anime\tablet\subtitled\r\Rascal Does Not Dream\Rascal Does Not Dream D01.m4v" -f mp4 -O -w 1280 --crop 0:0:0:0 --loose-anamorphic --modulus 2 -e x264 -q 22 --vfr -a 1,1 -E ac3,fdk_aac -6 dpl2,dpl2 -R Auto,48 -B 128,160 -D 0,0 --gain 0,0 --audio-fallback ac3 --subtitle 1 --subtitle-burned=1 --verbose=1
title %time% Rascal D02 & "C:\Program Files\Handbrake\HandBrakeCLI.exe" -i "Z:\Rascal Does Not Dream\Rascal Does Not Dream HD01-04.mkv" -c 7-12 -o "V:\anime\tablet\subtitled\r\Rascal Does Not Dream\Rascal Does Not Dream D02.m4v" -f mp4 -O -w 1280 --crop 0:0:0:0 --loose-anamorphic --modulus 2 -e x264 -q 22 --vfr -a 1,1 -E ac3,fdk_aac -6 dpl2,dpl2 -R Auto,48 -B 128,160 -D 0,0 --gain 0,0 --audio-fallback ac3 --subtitle 1 --subtitle-burned=1 --verbose=1
title %time% Rascal D03 & "C:\Program Files\Handbrake\HandBrakeCLI.exe" -i "Z:\Rascal Does Not Dream\Rascal Does Not Dream HD01-04.mkv" -c 13-19 -o "V:\anime\tablet\subtitled\r\Rascal Does Not Dream\Rascal Does Not Dream D03.m4v" -f mp4 -O -w 1280 --crop 0:0:0:0 --loose-anamorphic --modulus 2 -e x264 -q 22 --vfr -a 1,1 -E ac3,fdk_aac -6 dpl2,dpl2 -R Auto,48 -B 128,160 -D 0,0 --gain 0,0 --audio-fallback ac3 --subtitle 1 --subtitle-burned=1 --verbose=1
title %time% Rascal D04 & "C:\Program Files\Handbrake\HandBrakeCLI.exe" -i "Z:\Rascal Does Not Dream\Rascal Does Not Dream HD01-04.mkv" -c 20-25 -o "V:\anime\tablet\subtitled\r\Rascal Does Not Dream\Rascal Does Not Dream D04.m4v" -f mp4 -O -w 1280 --crop 0:0:0:0 --loose-anamorphic --modulus 2 -e x264 -q 22 --vfr -a 1,1 -E ac3,fdk_aac -6 dpl2,dpl2 -R Auto,48 -B 128,160 -D 0,0 --gain 0,0 --audio-fallback ac3 --subtitle 1 --subtitle-burned=1 --verbose=1
And I figured out the chapter numbers by playing the MKV in VLC and advancing through to each episode's opening sequence, so no fancy insight there.
If I have the entire series, I'll usually go with the explicit list like this. If it is something I'm getting over a longer period of time, I'll create a "called" batch file, that does the encoding:
Code: Select all
title %time% "%~n1 MP4" & "C:\Program Files\Handbrake\HandBrakeCLI.exe" -i "Z:\Star Trek\The Next Generation\%~n1.mkv" -t 1 -o "V:\TV Series\Star Trek\The Next Generation\%~n1.m4v" -f mp4 -O -w 1440 --crop 0:0:240:240 --loose-anamorphic --modulus 2 -e x264 -q 22 --vfr -a 1,1,3 -E fdk_haac,copy:dtshd,copy:ac3 -6 dpl2,none,none -R Auto,Auto,Auto -B 128,0,0 -D 0,0,0 --gain 0,0,0 --audio-fallback ac3 --subtitle 1 --subtitle-forced=1 --subtitle-burned=1 --verbose=1
title %time% "%~n1 MKV" & "C:\Program Files\Handbrake\HandBrakeCLI.exe" -i "Z:\Star Trek\The Next Generation\%~n1.mkv" -t 1 -o "V:\TV Series\Star Trek\The Next Generation\%~n1.mkv" -f mkv -w 1440 --crop 0:0:240:240 --loose-anamorphic --modulus 2 -e x264 -q 20 --vfr -a 1,1,3 -E ac3,copy:dtshd,copy:ac3 -6 dpl2,none,none -R Auto,Auto,Auto -B 160,0,0 -D 0,0,0 --gain 0,0,0 --audio-fallback ac3 --subtitle 1,1 --subtitle-forced=1 --markers="C:\Users\jeffb\AppData\Local\Temp\Star Trek TNG S1 E01-02 Encounter at Farpoint-1-chapters.csv" --verbose=1
Code: Select all
call z:\STTNG.bat "Star Trek TNG S1 E01-02 Encounter at Farpoint.mkv"
call z:\STTNG.bat "Star Trek TNG S1 E03 The Naked Now.mkv"