PDA

View Full Version : how to set low priority for batch encode?


junglemike
12th May 2009, 01:02
I feel that this is terribly simple question but i didn't figure it out yet.
I encode multiple videos with this batch command :
for %f in (*.avs) do j:\x264.exe --crf 22 --ref 4 --mixed-refs --bframes 3 --b-adapt 2 --b-pyramid --weightb --deblock -1:-1 --trellis 2 --partitions all --8x8dct --vbv-maxrate 25000 --me umh --threads auto --thread-input --progress --no-psnr --no-ssim --output "%f_crf22.mkv" "%f"
I can manually set the priority of x264 process to low in task manager, but after a while next file starts to be encoded, and priority goes to normal again, which is not good - since pc feels lagy. How can i resolve it so that all files are encoded with low priority?

TinTime
12th May 2009, 01:12
You need to use the start command. I use...

start "encode" /b /low /wait "j:\x264.exe" parameters

The "encode" bit is just the window title, but is needed if the x264 exe and path have quotes around them.

junglemike
12th May 2009, 01:16
Sorry , I can't understand that , what is "encode"? Can you give me the example of what i need to write in command line?

TinTime
12th May 2009, 02:35
The "encode" bit is, er, the window title. I don't know how else to describe it. See help start. It can be left blank though - x264 sets its own immediately anyway.

Your command line would be:
for %f in (*.avs) do start "" /b /low /wait "j:\x264.exe" --crf 22 --ref 4 --mixed-refs etc etc etc

juGGaKNot
12th May 2009, 07:26
Your command line would be:
for %f in (*.avs) do start "" /b /low /wait "j:\x264.exe" --crf 22 --ref 4 --mixed-refs etc etc etc

%f = ?

for %f in ("%mypath%\bin\@temp\%mymovie%.avs") do start "encode" /b /low /wait "%mypath%\bin\x264.exe" --crf %CQ% --stats "%mypath%\bin\@temp\%mymovie%.stats" --level 4.0 --ref 3 --bframes 3 --subme 6 --weightb --analyse all --8x8dct --qpmin 1 --qpstep 5 --merange 32 --me umh --threads auto --quiet --progress --no-psnr --output "%mypath%\bin\@temp\%mymovie%.264" "%mypath%\bin\@temp\%mymovie%.avs"

Crashes.

dat720
12th May 2009, 11:19
you are using that wrong, try:
start "encode" /b /low /wait "%mypath%\bin\x264.exe" --crf %CQ% --stats "%mypath%\bin\@temp\%mymovie%.stats" --level 4.0 --ref 3 --bframes 3 --subme 6 --weightb --analyse all --8x8dct --qpmin 1 --qpstep 5 --merange 32 --me umh --threads auto --quiet --progress --no-psnr --output "%mypath%\bin\@temp\%mymovie%.264" "%mypath%\bin\@temp\%mymovie%.avs"

the for %f is a loop that will substitute %f for each file found in the the current directory matching the specified filter *.avs...

you've removed the filter and attempted to replace it with a file name, this is not how that command works and will fail (not crash)

you need to do some research, google is a fantastic research tool, all the information is out there you just need to look for it....
http://www.robvanderwoude.com/for.php
http://jamesewelch.wordpress.com/2008/05/01/how-to-write-a-dos-batch-file-to-loop-through-files/

and for start:
http://www.robvanderwoude.com/ntstart.php

juGGaKNot
12th May 2009, 21:40
you are using that wrong, try:
start "encode" /b /low /wait "%mypath%\bin\x264.exe" --crf %CQ% --stats "%mypath%\bin\@temp\%mymovie%.stats" --level 4.0 --ref 3 --bframes 3 --subme 6 --weightb --analyse all --8x8dct --qpmin 1 --qpstep 5 --merange 32 --me umh --threads auto --quiet --progress --no-psnr --output "%mypath%\bin\@temp\%mymovie%.264" "%mypath%\bin\@temp\%mymovie%.avs"

the for %f is a loop that will substitute %f for each file found in the the current directory matching the specified filter *.avs...

you've removed the filter and attempted to replace it with a file name, this is not how that command works and will fail (not crash)

you need to do some research, google is a fantastic research tool, all the information is out there you just need to look for it....
http://www.robvanderwoude.com/for.php
http://jamesewelch.wordpress.com/2008/05/01/how-to-write-a-dos-batch-file-to-loop-through-files/

and for start:
http://www.robvanderwoude.com/ntstart.php

aaa i see, thnx.

cheers.

junglemike
13th May 2009, 12:26
Thanks guys. This method works great. Low priority, at last :)

juGGaKNot
19th May 2009, 07:32
Thanks guys. This method works great. Low priority, at last :)

Yes works great, THNX :

FOR /F "tokens=*" %%A IN ('TIME/T') DO SET Now=%%A
echo Encoding Audio :
echo.
start "encode" /b /low /max /wait "%myfiles%\faac.exe" -q 0.5 -o "%mypath%\@temp\%mymovie%.m4a" "%mypath%\%mymovie%.wav"
start "encode" /b /low /max /wait "%myfiles%\faac.exe" -q 0.5 -o "%mypath%\@temp\%mymovie%2.m4a" "%mypath%\%mymovie%2.wav"
echo.
echo Encoding X264 :
echo.
start "encode" /b /low /max /wait "%myfiles%\x264.exe" --pass 1 --bitrate %btrate% --stats "%mypath%\@temp\%mymovie%.stats" --level 4.1 --ref 4 --mixed-refs --bframes 4 --b-adapt 2 --weightb --direct auto --deblock 1:1 --subme 9 --trellis 2 --psy-rd 0:0 --partitions p8x8,b8x8,i4x4,i8x8 --8x8dct --qpmin 3 --ipratio 1.1 --pbratio 1.1 --vbv-bufsize 24000 --vbv-maxrate 24000 --qcomp 1 --me esa --merange 32 --threads auto --aq-mode 0 --sar 1:1 --progress --no-psnr --no-ssim --output NUL "%mypath%\@temp\%mymovie%.avs"
start "encode" /b /low /max /wait "%myfiles%\x264.exe" --pass 2 --bitrate %btrate% --stats "%mypath%\@temp\%mymovie%.stats" --level 4.1 --ref 4 --mixed-refs --bframes 4 --b-adapt 2 --weightb --direct auto --deblock 1:1 --subme 9 --trellis 2 --psy-rd 0:0 --partitions p8x8,b8x8,i4x4,i8x8 --8x8dct --qpmin 3 --ipratio 1.1 --pbratio 1.1 --vbv-bufsize 24000 --vbv-maxrate 24000 --qcomp 1 --me esa --merange 32 --threads auto --aq-mode 0 --sar 1:1 --progress --no-psnr --no-ssim --output "%mypath%\@temp\%mymovie%.264" "%mypath%\@temp\%mymovie%.avs"
echo.
start "encode" /b /low /max /wait "%myfiles%\MP4box.exe" -itags "genre=PS3/XboX 360 Compatible":tempo="666":encoder="Movie Encoded Using juGGaKNot's X264 .exe ALPHA":comment="Visit Us At www.AdvanceFX.org, Visit Me At www.AirWalk-Media.com" -add "%mypath%\@temp\%mymovie%.264" -add "%mypath%\@temp\%mymovie%.m4a" -fps %myfps% -new "%mypath%\Final_Movie_X264.mp4" -tmp "%mypath%\@temp"
start "encode" /b /low /max /wait "%myfiles%\MP4box.exe" -itags "genre=PS3/XboX 360 Compatible":tempo="666":encoder="Movie Encoded Using juGGaKNot's X264 .exe ALPHA":comment="Visit Us At www.AdvanceFX.org, Visit Me At www.AirWalk-Media.com" -add "%mypath%\@temp\%mymovie%.264" -add "%mypath%\@temp\%mymovie%.m4a" -add "%mypath%\@temp\%mymovie%2.m4a" -fps %myfps% -new "%mypath%\Final_Movie_X264_2_Audio_Tracks.mp4" -tmp "%mypath%\@temp"
echo.
if EXIST "%mypath%\Final_Movie_X264_2_Audio_Tracks.mp4" del "%mypath%\Final_Movie_X264.mp4"
echo.
echo Done, temp folder is still there if you need the raw files, press any key to exit and delete the it.
rmdir /S /Q "%mypath%\@temp"
FOR /F "tokens=*" %%A IN ('TIME/T') DO SET Now2=%%A
echo.
echo.
echo Encoding Started At %now% AND Finished At %now2%