User Tools

Site Tools


tutorial:batch_processing

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
tutorial:batch_processing [2011/01/08 19:00]
agent_007 more additions part IV
tutorial:batch_processing [2011/01/09 16:22]
agent_007 some tips
Line 7: Line 7:
 ===== Short introduction to different methods ===== ===== Short introduction to different methods =====
  
-Since AVIdemux supports both Command-line processing ([[using:​command_line_usage]]) and JS scripting ([[using:​Scripting]]) possibilities,​ there are multiple ways to batch process your files: +Since AVIdemux supports both Command-line processing ([[using:​command_line_usage]]) and JS scripting ​(ECMAScript) ​([[using:​Scripting]]) possibilities,​ there are multiple ways to batch process your files: 
-1. Command-line only processing with bash script/.bat file or similar. +  ​- ​Command-line only processing with bash script/.bat file or similar. 
-2. JS scripting only processing +  ​- ​JS scripting ​(ECMAScript) ​only processing 
-3. Combination of command-line and JS scripting+  ​- ​Combination of command-line and JS scripting
  
 ==== Command-line only batch processing ==== ==== Command-line only batch processing ====
Line 35: Line 35:
 </​code>​ </​code>​
  
-==== JS scripting only batch processing ==== 
-Since AVIdemux supports JS scripting, you can create scripts with it also. These scripts can be loaded from command-line (**--run**) or from GUI (**File -> Load/Run project...**). Because environment is same on all platforms, the scripts are quite portable. Only problematic part is slashing since some operating systems assume **/** is the proper one and few systems think **\** is the right one. 
  
-With JS scripts one can also use additional GUI elements (file folder select dialog) which helps if you must make newbie friendly scripts. 
  
-First the actual script you can save as **something.js**,​ when you run it, it will ask input folder and filetype (first dialog) + output folder and filename (second dialog). Script picks are all files of same type from first folder and save them as XviD+MP3 AVI to second folder.+==== JS scripting (ECMAScript) only batch processing ==== 
 +Since AVIdemux supports JS scripting (ECMAScript),​ you can create scripts with it also. These scripts can be loaded from command-line (**--run**) or from GUI (**File -> Load/Run project...**). Because environment is same on all platforms, the scripts are quite portable. Only problematic part is slashing since some operating systems assume **/** is the proper one and few systems think **\** is the right one. 
 + 
 +With JS scripts (ECMAScripts) one can also use additional GUI elements (file and folder select dialogs) which helps if you must make newbie friendly scripts. 
 + 
 +First the actual script you can save as **something.js**,​ when you run it, it will ask input folder and filetype (first dialog) + output folder and filename (second dialog). Script picks all files of same type from first folder and saves them as XviD+MP3 AVI to second folder.
 <code javascript>​ <code javascript>​
 //AD  <- //AD  <-
Line 55: Line 57:
 var dstDir; var dstDir;
 var reg = new RegExp("​.$"​);​ var reg = new RegExp("​.$"​);​
-var extReg = new RegExp("​.*[.](.+)$"​);​ +var extReg = new RegExp("​.*[.](.+)$"​); ​
- +
    
 //this is the directory separator char for WINDOWS! for *nix, it should be: sep = "/";​ //this is the directory separator char for WINDOWS! for *nix, it should be: sep = "/";​
Line 186: Line 187:
 } }
 </​code>​ </​code>​
 +
 +
 +
 +==== Combination of command-line and JS scripting ====
 +Last option is to combine best of both worlds. Usually the best situation for this is to create automated script (no dialogs) that you will run for all files.
 +
 +Short Win32 example below, first the script (again save it as **something.js**)
 +<code javascript>​
 +//AD  <- Needed to identify//
 +var app = new Avidemux();
 +//** Postproc **
 +app.video.setPostProc(3,​3,​0);​
 +
 +//** Filters **
 +
 +//** Video Codec conf **
 +app.video.codecPlugin("​92B544BE-59A3-4720-86F0-6AD5A2526FD2",​ "​Xvid",​ "​2PASSBITRATE=1000",​ "<?​xml version='​1.0'?><​XvidConfig><​XvidOptions><​threads>​0</​threads><​vui><​sarAsInput>​false</​sarAsInput><​sarHeight>​1</​sarHeight><​sarWidth>​1</​sarWidth></​vui><​motionEstimation>​high</​motionEstimation><​rdo>​dct</​rdo><​bFrameRdo>​false</​bFrameRdo><​chromaMotionEstimation>​true</​chromaMotionEstimation><​qPel>​false</​qPel><​gmc>​false</​gmc><​turboMode>​false</​turboMode><​chromaOptimiser>​false</​chromaOptimiser><​fourMv>​false</​fourMv><​cartoon>​false</​cartoon><​greyscale>​false</​greyscale><​interlaced>​none</​interlaced><​frameDropRatio>​0</​frameDropRatio><​maxIframeInterval>​300</​maxIframeInterval><​maxBframes>​2</​maxBframes><​bFrameSensitivity>​0</​bFrameSensitivity><​closedGop>​false</​closedGop><​packed>​false</​packed><​quantImin>​1</​quantImin><​quantPmin>​1</​quantPmin><​quantBmin>​1</​quantBmin><​quantImax>​31</​quantImax><​quantPmax>​31</​quantPmax><​quantBmax>​31</​quantBmax><​quantBratio>​150</​quantBratio><​quantBoffset>​100</​quantBoffset><​quantType>​h.263</​quantType><​intraMatrix><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value><​value>​8</​value></​intraMatrix><​interMatrix><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value><​value>​1</​value></​interMatrix><​trellis>​true</​trellis><​singlePass><​reactionDelayFactor>​16</​reactionDelayFactor><​averagingQuantiserPeriod>​100</​averagingQuantiserPeriod><​smoother>​100</​smoother></​singlePass><​twoPass><​keyFrameBoost>​10</​keyFrameBoost><​maxKeyFrameReduceBitrate>​20</​maxKeyFrameReduceBitrate><​keyFrameBitrateThreshold>​1</​keyFrameBitrateThreshold><​overflowControlStrength>​5</​overflowControlStrength><​maxOverflowImprovement>​5</​maxOverflowImprovement><​maxOverflowDegradation>​5</​maxOverflowDegradation><​aboveAverageCurveCompression>​0</​aboveAverageCurveCompression><​belowAverageCurveCompression>​0</​belowAverageCurveCompression><​vbvBufferSize>​0</​vbvBufferSize><​maxVbvBitrate>​0</​maxVbvBitrate><​vbvPeakBitrate>​0</​vbvPeakBitrate></​twoPass></​XvidOptions></​XvidConfig>"​);​
 +
 +//** Audio **
 +app.audio.reset();​
 +app.audio.codec("​Lame",​128,​20,"​80 00 00 00 00 00 00 00 01 00 00 00 02 00 00 00 00 00 00 00 ");
 +app.audio.normalizeMode=0;​
 +app.audio.normalizeValue=0;​
 +app.audio.delay=0;​
 +app.audio.mixer="​STEREO";​
 +app.setContainer("​AVI"​);​
 +setSuccess(1);​
 +//​app.Exit();​
 +
 +//End of script
 +</​code>​
 +
 +Win32 example (.bat file) that will convert all .mp4 files in current folder to .avi (XviD+MP3). Original files aren't modified. New files are named like **something.mp4.avi**
 +<​code>​
 +set avidemux="​C:​\Program Files\Avidemux 2.5\avidemux2.exe"​
 +for %%f in (*.mp4) do %avidemux% --force-alt-h264 --load "​%%f"​ --run something.js --save "​%%f.avi"​ --quit
 +</​code>​
 +
 +If you create your own combine batch settings, make sure order of command-line parameters is always --load something, --run something and --save something (AVIdemux will run these options in give order).
 +
 +
 +==== Tips ====
 +  * You can replace **avidemux2** with **avidemux2_cli** if you want to process files via GUI
 +  * You can use **--nogui** option in case you want to suppress all dialogs (it must be first option!)
tutorial/batch_processing.txt · Last modified: 2012/11/11 08:51 (external edit)