Difference between revisions of "Batch Encoding"
From SDA Knowledge Base
Ballofsnow (Talk | contribs) m (→The batch files: pre tag fixed for other browsers... hopefully.) |
Ballofsnow (Talk | contribs) m (→The batch files: Q17 for lq/mq) |
||
Line 54: | Line 54: | ||
@echo off | @echo off | ||
− | call :2pass level1_mq.avs level1_lq 128 64000 | + | call :2pass level1_mq.avs level1_lq 128 64000 17 1 1 |
− | call :2pass level1_mq.avs level1_mq 512 64000 | + | call :2pass level1_mq.avs level1_mq 512 64000 17 1 1 |
call :2pass level1_hq.avs level1_hq 2048 128000 19 1 1 | call :2pass level1_hq.avs level1_hq 2048 128000 19 1 1 | ||
call :2pass level1_hq.avs level1_iq 5000 320000 19 1 1 | call :2pass level1_hq.avs level1_iq 5000 320000 19 1 1 |
Revision as of 21:00, 24 April 2007
Contents
Introduction
This guide assumes you are familiar with encoding through CLI or you are comfortable with MeGUI.
Why encode with batch files? This is a good question. When you are encoding many videos, you tend to use the same configuration settings for H.264 and AAC. You may have even created your own profiles already. Once you are comfortable with MeGUI and realize how easy it is to use, you start getting annoyed of repeatedly clicking the same options. You already know what you want from the start, so why not simplify the process?
However, there are some disadvantages to batch file encoding that you should know. In MeGUI you are able to postpone/delete jobs without interrupting the current encoding job. You can even stop the current job and the program will continue on with the rest. With batch files you'll have to stop the whole process cold, edit encode.bat and then run it again.
Setup
Choose a folder where you will do all your operations and place the following files inside. If you have MeGUI installed you probably already have the first three files; look in the megui/tools directory.
- x264.exe
- neroaacenc.exe
- mp4box.exe
- BePipe.exe
- Your avisynth scripts and source files (if your script uses relative paths)
The batch files
Create a batch file by first creating a text document and changing the extension to bat.
Parameter list - 2pass.bat
- %1 - avisynth script
- %2 - output file name without mp4 extension
- %3 - video bitrate
- %4 - audio bitrate
- %5 - minimum quantizer - 17 should be used for 320x240 resolution, 19 for 640x480 or higher.
- %6 - delete stats file after encoding, 0=off, 1=on
- %7 - delete elementary streams after muxing, 0/blank=off, 1=on
Parameter list - 1pass.bat
- %1 - avisynth script
- %2 - output file name without mp4 extension
- %3 - audio bitrate
- %4 - quantizer - 17 should be used for 320x240 resolution, 19 for 640x480 or higher.
- %5 - delete elementary streams after muxing, 0/blank=off, 1=on
runatlow.bat - This will run encode.bat in low priority mode like MeGUI does. It will let you run other things while the encoding is taking place without computer lag, though doing other things will slow down the encoding.
start /LOW /B encode.bat
encode.bat - The main batch file. The call lines are how you set up your jobs. Everything below that you'll change maybe once. Look at the parameter list to see what the values correspond to. As you can see, starting from the left, %1 refers to level1_mq.avs and you keep going to the right, ending with %7 referring to the value 1 which means the elementary streams will be deleted after being multiplexed.
You need to configure the lines with x264 to your liking. If you are using MeGUI and already have your own profiles, you can look at the command line by clicking on config and looking at the bottom part of the window. Or don't change anything, the settings here are quite reasonable.
@echo off call :2pass level1_mq.avs level1_lq 128 64000 17 1 1 call :2pass level1_mq.avs level1_mq 512 64000 17 1 1 call :2pass level1_hq.avs level1_hq 2048 128000 19 1 1 call :2pass level1_hq.avs level1_iq 5000 320000 19 1 1 call :1pass level1_hq.avs level1_qp19_iq 320000 19 1 echo Finished! pause GOTO :EOF :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :2pass x264.exe --pass 1 --bitrate %3 --stats "%2.stats" --ref 8 --mixed-refs --no-fast-pskip --bframes 5 --b-rdo --bime --weightb --subme 7 --trellis 1 --analyse p8x8,b8x8,i4x4,p4x4 --qpmin %5 --me umh --threads auto --thread-input --progress --no-psnr --no-ssim --output NUL "%1" x264.exe --pass 2 --bitrate %3 --stats "%2.stats" --ref 8 --mixed-refs --no-fast-pskip --bframes 5 --b-rdo --bime --weightb --subme 7 --trellis 1 --analyse p8x8,b8x8,i4x4,p4x4 --qpmin %5 --me umh --threads auto --thread-input --progress --no-psnr --no-ssim --output "%2_video.mp4" "%1" bepipe.exe --script "DirectShowSource(^%1^).Normalize" | "neroAacEnc.exe" -br %4 -lc -if - -of "%2_audio.mp4" MP4Box.exe -new -add "%2_video.mp4" -add "%2_audio.mp4" "%2.mp4" if "%6" == "1" del %2.stats if "%7" == "1" del %2_video.mp4 | del %2_audio.mp4 GOTO :EOF :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :1pass x264.exe --qp %4 --ref 8 --mixed-refs --no-fast-pskip --bframes 5 --b-rdo --bime --weightb --nf --subme 7 --analyse p8x8,b8x8,i4x4,p4x4 --threads auto --thread-input --progress --no-psnr --no-ssim --output "%2_video.mp4" "%1" bepipe.exe --script "DirectShowSource(^%1^).Normalize" | "neroAacEnc.exe" -br %3 -lc -if - -of "%2_audio.mp4" MP4Box.exe -new -add "%2_video.mp4" -add "%2_audio.mp4" "%2.mp4" if "%5" == "1" del %2_video.mp4 | del %2_audio.mp4 GOTO :EOF
Encoding
Most of the work is in setting up encode.bat, starting the encoding is as simple as running runatlow.bat or encode.bat itself.
Return to the front page.