Batch Encoding

From SDA Knowledge Base

Revision as of 15:11, 20 August 2006 by Ballofsnow (Talk | contribs)

Jump to: navigation, search

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? Actually, one thing that Megui can't do is queue multiplexing jobs before the video and audio files are finished and sitting on your hard drive. So that's a big plus for batch encoding.


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.


The batch files

Parameter list

  •  %1 - avisynth script
  •  %2 - output file name without mp4 extension
  •  %3 - video bitrate
  •  %4 - audio bitrate
  •  %5 - minimum quantizer
  •  %6 - 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 I don't suggest playing cpu intensive games...


start /LOW /B encode.bat


encode.bat - The main batch file where you do most of the editing. Look at the parameter list to see what the values correspond to.


call 2pass.bat Seg1_MQ.avs GodOfWar_god_21623_part01 512 64000 17 1

call 2pass.bat Seg1_MQ.avs GodOfWar_god_21623_LQ_part01 128 64000 17 1

call 2pass.bat Seg1_HQ.avs GodOfWar_god_21623_HQ_part01 2048 128000 19 1

call 2pass.bat Seg1_HQ.avs GodOfWar_god_21623_IQ_part01 5000 320000 19 1

call 1pass.bat Seg1_MQ.avs GodOfWar_god_21623_part01_test 64000 17 0


2pass.bat - This gets the parameters from encode.bat and does the actual encoding. You need to configure this 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 clicking the "show commandline" checkbox at the bottom left.


x264.exe --pass 1 --bitrate %3 --stats ".stats" --ref 8 --mixed-refs --no-fast-pskip --bframes 3 --b-rdo --bime --weightb --subme 7 --trellis 1 --analyse p8x8,b8x8,i4x4,p4x4 --qpmin %5 --me umh --progress --no-psnr --output NUL "%1"

x264.exe --pass 2 --bitrate %3 --stats ".stats" --ref 8 --mixed-refs --no-fast-pskip --bframes 3 --b-rdo --bime --weightb --subme 7 --trellis 1 --analyse p8x8,b8x8,i4x4,p4x4 --qpmin %5 --me umh --progress --no-psnr --output "%2_video.mp4" "%1"

del .stats

bepipe.exe --script "DirectShowSource(^%1^).Normalize" | "neroAacEnc.exe" -br %4 -lc -if - -of "%2_audio.mp4"

MP4Box.exe -add "%2_video.mp4" -add "%2_audio.mp4" "%2.mp4"

if "%6" == "1" del %2_video.mp4 | del %2_audio.mp4


1pass.bat - Same as 2pass except the code has only one line to call x264.exe since it is doing a single-pass constant quantizer encoding.


x264.exe --qp %4 --ref 8 --mixed-refs --no-fast-pskip --bframes 3 --b-rdo --bime --weightb --nf --subme 7 --analyse p8x8,b8x8,i4x4,p4x4 --me umh --progress --no-psnr --output "%2_video.mp4" "%1"

bepipe.exe --script "DirectShowSource(^%1^).Normalize" | "neroAacEnc.exe" -br %3 -lc -if - -of "%2_audio.mp4"

MP4Box.exe -add "%2_video.mp4" -add "%2_audio.mp4" "%2.mp4"

if "%5" == "1" del %2_video.mp4 | del %2_audio.mp4

Personal tools