This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
tutorial:batch_processing [2011/01/09 15:53] agent_007 more additions part VI |
tutorial:batch_processing [2012/11/11 08:51] (current) |
||
|---|---|---|---|
| Line 8: | Line 8: | ||
| 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: | 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: | ||
| - | - Ordered List Item1. Command-line only processing with bash script/.bat file or similar. | + | - Command-line only processing with bash script/.bat file or similar. |
| - | - Ordered List Item2. JS scripting (ECMAScript) only processing | + | - JS scripting (ECMAScript) only processing |
| - | - Ordered List Item3. 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 34: | Line 46: | ||
| for %%f in (*.mp4) do %avidemux% --video-codec %videocodec% --video-conf %videobitrate% --audio-codec %audiocodec% --audio-bitrate %audiobitrate% --force-alt-h264 --load "%%f" --save "%%f.avi" --quit | for %%f in (*.mp4) do %avidemux% --video-codec %videocodec% --video-conf %videobitrate% --audio-codec %audiocodec% --audio-bitrate %audiobitrate% --force-alt-h264 --load "%%f" --save "%%f.avi" --quit | ||
| </code> | </code> | ||
| + | |||
| + | For Linux/Unixes using Bash shell similar script would be | ||
| + | <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 ==== | ==== JS scripting (ECMAScript) only batch processing ==== | ||
| Line 185: | 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 ==== | ==== Combination of command-line and JS scripting ==== | ||
| Line 192: | Line 220: | ||
| <code javascript> | <code javascript> | ||
| //AD <- Needed to identify// | //AD <- Needed to identify// | ||
| + | var app = new Avidemux(); | ||
| //** Postproc ** | //** Postproc ** | ||
| app.video.setPostProc(3,3,0); | app.video.setPostProc(3,3,0); | ||
| - | |||
| - | app.video.fps1000 = 29970; | ||
| //** Filters ** | //** Filters ** | ||
| Line 219: | Line 246: | ||
| <code> | <code> | ||
| set avidemux="C:\Program Files\Avidemux 2.5\avidemux2.exe" | set avidemux="C:\Program Files\Avidemux 2.5\avidemux2.exe" | ||
| - | set videocodec=Xvid | ||
| - | set audiocodec=MP3 | ||
| for %%f in (*.mp4) do %avidemux% --force-alt-h264 --load "%%f" --run something.js --save "%%f.avi" --quit | for %%f in (*.mp4) do %avidemux% --force-alt-h264 --load "%%f" --run something.js --save "%%f.avi" --quit | ||
| </code> | </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!) | ||