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
tutorial:batch_processing [2011/01/08 18:48]
agent_007 more additions part III
tutorial:batch_processing [2012/11/11 08:51] (current)
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 25: Line 25:
 You can copy that text to new text file, then rename the text file to **something.bat** and move it to the folder where you want to process the files. Then just double click the **something.bat** and processing should start. You can copy that text to new text file, then rename the text file to **something.bat** and move it to the folder where you want to process the files. Then just double click the **something.bat** and processing should start.
  
-If you want to force certain bitrate for audio and video, do following ​+For Linux/​Unixes using Bash shell similar script would be 
 +<code bash> 
 +#​!/​bin/​bash 
 +VIDEOCODEC="​Xvid"​ 
 +AUDIOCODEC="​MP3"​ 
 +for FIL in `ls *mp4 | sort` ; do 
 +  avidemux2 --video-codec $VIDEOCODEC --audio-codec $AUDIOCODEC --force-alt-h264 --load "​$FIL"​ --save ${FIL%.*}.avi --quit 
 +done 
 +</​code>​  
 +(this will create **something.avi** from **something.mp4**) 
 + 
 + 
 +If you want to force certain bitrate for audio and video with Win32, do following ​
 <​code>​ <​code>​
 set avidemux="​C:​\softa\avidemux_r6854\avidemux2.exe"​ set avidemux="​C:​\softa\avidemux_r6854\avidemux2.exe"​
Line 35: Line 47:
 </​code>​ </​code>​
  
-==== JS scripting only batch processing ==== +For Linux/​Unixes using Bash shell similar script would be 
-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.+<code bash> 
 +#​!/​bin/​bash 
 +VAR="​batchfiles.txt"​ 
 +VIDEOCODEC="​Xvid"​ 
 +AUDIOCODEC="​MP3"​ 
 +VIDEOBITRATE="​cbr=512"​ 
 +AUDIOBITRATE="​64"​ 
 +for FIL in `ls *mp4 | sort` ; do 
 +  avidemux2 --video-codec $VIDEOCODEC --video-conf $VIDEOBITRATE --audio-codec $AUDIOCODEC --audio-bitrate $AUDIOBITRATE --force-alt-h264 --load "​$FIL"​ --save ${FIL%.*}.avi --quit 
 +done 
 +</​code>​  
 +(this will create **something.avi** from **something.mp4**) 
 + 
 +==== 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 one can also use additional GUI elements (file folder select ​dialog) which helps if you must make newbie friendly scripts.+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**+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 47: Line 73:
   and loads all .xyz files and encodes them to Xvid+MP3 AVI   and loads all .xyz files and encodes them to Xvid+MP3 AVI
   The resulting file is put in destDir directory   The resulting file is put in destDir directory
-  ​+ 
   Using new directorySearch API   Using new directorySearch API
 */ */
Line 55: Line 81:
 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 = "/";​
 var sep = "​\\";​ var sep = "​\\";​
Line 63: Line 88:
 var pickedExt; var pickedExt;
 var dstPath; var dstPath;
 + 
 var filesDone = 0; var filesDone = 0;
 var filesSkip = 0; var filesSkip = 0;
 var filesErrd = 0; var filesErrd = 0;
- +  
-displayInfo("​Pick any file in the source directory. All files of that type will be processed. Filename will be ignored but the file extension will be used! \r\n\r\ne.g. If you want to process AVIs, be sure to pick any AVI!"); +displayInfo("​Pick any file in the source directory. All files of that type (.xyz) ​will be processed. Filename will be ignored but the file extension will be used! \r\n\r\ne.g. If you want to process AVIs, be sure to pick any .avi file!"); 
 + 
 //pop up a dialog asking for a source file. We will remove the file name leaving just the dir //pop up a dialog asking for a source file. We will remove the file name leaving just the dir
 srcDir = fileReadSelect();​ srcDir = fileReadSelect();​
 + 
 //run the extReg regex designed to pull out just the extension of this file //run the extReg regex designed to pull out just the extension of this file
 pickedExt = srcDir.replace(extReg,​ "​$1"​).toLowerCase();​ pickedExt = srcDir.replace(extReg,​ "​$1"​).toLowerCase();​
 + 
 displayInfo(pickedExt + "Pick the destination directory and enter a random filename. Filename will be ignored"​);​ displayInfo(pickedExt + "Pick the destination directory and enter a random filename. Filename will be ignored"​);​
 + 
 //pop up a dialog asking for a destination file. We will remove the file name leaving just the dir  //pop up a dialog asking for a destination file. We will remove the file name leaving just the dir 
 dstDir = fileWriteSelect();​ dstDir = fileWriteSelect();​
 + 
 //extract just the path part of each picked file //extract just the path part of each picked file
 srcDir = pathOnly(srcDir);​ srcDir = pathOnly(srcDir);​
 dstDir = pathOnly(dstDir);​ dstDir = pathOnly(dstDir);​
 + 
 //if the path ends with a directory separator characters, remove them //if the path ends with a directory separator characters, remove them
 //it shouldnt be more than one, but a while loop will cater for any number of them //it shouldnt be more than one, but a while loop will cater for any number of them
Line 94: Line 119:
   dstDir=dstDir.replace(reg,""​);​   dstDir=dstDir.replace(reg,""​);​
 } }
 + 
 //initalise the directory search by telling it the directory //initalise the directory search by telling it the directory
 if(ds.Init(srcDir)) if(ds.Init(srcDir))
Line 105: Line 130:
     //pull the filename out (no path)     //pull the filename out (no path)
     dstPath=ds.GetFileName();​     dstPath=ds.GetFileName();​
-   + 
     //only process valid files that are not directories     //only process valid files that are not directories
     if(!ds.isNotFile && !ds.isDirectory && !ds.isSingleDot && !ds.isDoubleDot)     if(!ds.isNotFile && !ds.isDirectory && !ds.isSingleDot && !ds.isDoubleDot)
Line 111: Line 136:
       //we want to do some work with the extension so pull it out now       //we want to do some work with the extension so pull it out now
       ext=ds.GetExtension();​       ext=ds.GetExtension();​
-      ​+ 
       //is the extension of this file the same as the one we picked?       //is the extension of this file the same as the one we picked?
       if(ext.toLowerCase() == pickedExt)       if(ext.toLowerCase() == pickedExt)
Line 121: Line 146:
           dstPath = dstDir + sep + ds.GetFileName() + "​.avi";​           dstPath = dstDir + sep + ds.GetFileName() + "​.avi";​
         }         }
-        ​+ 
         //build the source file path         //build the source file path
         srcPath = srcDir + sep + ds.GetFileName();​         srcPath = srcDir + sep + ds.GetFileName();​
 + 
         //we set this option first. If Avidemux loads a file it thinks need unpacking/​time mapping         //we set this option first. If Avidemux loads a file it thinks need unpacking/​time mapping
         //then setting this option now will ensure that operation is done when we load         //then setting this option now will ensure that operation is done when we load
         app.forceUnpack();​         app.forceUnpack();​
 + 
         //load the file. this action also purges all the video filters and codec settings         //load the file. this action also purges all the video filters and codec settings
         app.load(srcPath);​         app.load(srcPath);​
 + 
         //see if the audio is VBR. if it is, this builds a time map. if it is not, this does nothing         //see if the audio is VBR. if it is, this builds a time map. if it is not, this does nothing
-        app.audio.scanVBR(); +        app.audio.scanVbr(); 
 + 
         //this might not need doing if forceUnpack has been stated. I dont think it can be done         //this might not need doing if forceUnpack has been stated. I dont think it can be done
         //twice though so its safe to repeat here         //twice though so its safe to repeat here
         app.rebuildIndex();​         app.rebuildIndex();​
 + 
         //all the code in this section was generated by the app. if you want to write a script and use filters         //all the code in this section was generated by the app. if you want to write a script and use filters
         //you can get the app to do the hard work by:         //you can get the app to do the hard work by:
Line 145: Line 170:
         // on file menu, pick Save Project as (note: NOT save avi file!!)         // on file menu, pick Save Project as (note: NOT save avi file!!)
         //the job file you save will have a section detailing the filters. copy it         //the job file you save will have a section detailing the filters. copy it
- +  
-        //re-encode to xvid 2 pas, bitrate = 1000 (plus 64 for audio = 1064 kbps, 478.megs per hour)+        //re-encode to xvid 2 pass, bitrate = 1000 (plus 128 for audio = 1128 kbps, 507.megs per hour)
         //all options are set to simple, no GMC, no Qpel etc so that standalone simple players are ok         //all options are set to simple, no GMC, no Qpel etc so that standalone simple players are ok
-       ​app.video.codec("XVID4","​2PASSBITRATE=1000","​500 06 00 00 00 01 00 00 00 fa 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 01 00 00 00 00 00 00 00 02 00 00 00 02 00 00 00 02 00 00 00 1f 00 00 00 1f 00 00 00 1f 00 00 00 00 00 00 00 01 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 05 00 00 00 05 00 00 00 05 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 96 00 00 00 64 00 00 00 01 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "); +       ​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>​");
  
  app.audio.reset();​  app.audio.reset();​
- app.audio.codec("​lame",128,16,"00 00 00 00 01 00 00 00 07 00 00 00 00 00 00 00 ");+ 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.normalizeMode=0;​
  app.audio.normalizeValue=0;​  app.audio.normalizeValue=0;​
        ​app.audio.delay=0;​        ​app.audio.delay=0;​
-       ​app.audio.mixer("​STEREO"​)+       ​app.audio.mixer="​STEREO";​ 
-       ​+ 
        ​app.setContainer("​AVI"​);​        ​app.setContainer("​AVI"​);​
 + 
         //write that file         //write that file
         app.save(dstPath);​         app.save(dstPath);​
 + 
       } else{ //we decide not to process this file       } else{ //we decide not to process this file
         //some diagnostic info incase you wonder why a whole dir of files arent processing         //some diagnostic info incase you wonder why a whole dir of files arent processing
Line 178: Line 202:
         if(ds.isDoubleDot)         if(ds.isDoubleDot)
           whyNot += "it is a meta-ref to the parent dir (..), ";           whyNot += "it is a meta-ref to the parent dir (..), ";
-        ​+ 
         //whats that reason now?  ​         //whats that reason now?  ​
         print(whyNot);​         print(whyNot);​
Line 187: Line 211:
 } }
 </​code>​ </​code>​
 +
 +You can create scripts quite easily by yourself. You can apply needed settings via GUI and then use **File -> Save Project As...** to create text file that contains all settings. Then you can open that file in text editor and copy+paste needed stuff to new script (or replaces parts of other script).
 +
 +==== 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>​
 +
 +For Linux/​Unixes using Bash shell similar script would be
 +<code bash>
 +#!/bin/bash
 +for FIL in `ls *mp4 | sort` ; do
 +  avidemux2 --force-alt-h264 --load "​$FIL"​ --run something.js --save ${FIL%.*}.avi --quit
 +done
 +</​code> ​
 +(this will create **something.avi** from **something.mp4**)
 +
 +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 given order).
 +==== Tips ====
 +  * You can replace **avidemux2** with **avidemux2_cli** if you want to process files without GUI
 +  * You can use **--nogui** option in case you want to suppress all dialogs (it must be first option!)
tutorial/batch_processing.1294508915.txt.gz · Last modified: 2012/11/11 08:51 (external edit)