This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Next revision Both sides next revision | ||
tutorial:batch_processing [2011/01/09 16:22] agent_007 some tips |
tutorial:batch_processing [2011/01/09 16:30] agent_007 linux examples |
||
---|---|---|---|
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 | ||
+ | VAR="batchfiles.txt" | ||
+ | VIDEOCODEC="Xvid" | ||
+ | AUDIOCODEC="MP3" | ||
+ | ls *.mp4 | sort > $VAR # Collect the files in the current directory | ||
+ | cat $VAR | while read line; do # Loop read the filenames from the file | ||
+ | INPUT=$(echo ${line}) # Grab the next new filename | ||
+ | OUTPUT=${INPUT%.*4} # Remove shortest match of characters between the '. ' and the '4' at end of string | ||
+ | OUTPUT+=".avi" # Append new extension | ||
+ | avidemux2 --video-codec $VIDEOCODEC --audio-codec $AUDIOCODEC --force-alt-h264 --load "$INPUT" --save "$OUTPUT" --quit | ||
+ | done | ||
+ | rm $VAR # Remove the text file with the file names | ||
+ | </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 53: | ||
</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" | ||
+ | ls *.mp4 | sort > $VAR # Collect the files in the current directory | ||
+ | cat $VAR | while read line; do # Loop read the filenames from the file | ||
+ | INPUT=$(echo ${line}) # Grab the next new filename | ||
+ | OUTPUT=${INPUT%.*4} # Remove shortest match of characters between the '. ' and the '4' at end of string | ||
+ | OUTPUT+=".avi" # Append new extension | ||
+ | avidemux2 --video-codec $VIDEOCODEC --video-conf $VIDEOBITRATE --audio-codec $AUDIOCODEC --audio-bitrate $AUDIOBITRATE --force-alt-h264 --load "$INPUT" --save "$OUTPUT" --quit | ||
+ | done | ||
+ | rm $VAR # Remove the text file with the file names | ||
+ | </code> | ||
+ | (this will create **something.avi** from **something.mp4**) | ||
==== JS scripting (ECMAScript) only batch processing ==== | ==== JS scripting (ECMAScript) only batch processing ==== |