Scripting Avidemux to Convert to iPod Format
This is a script to be used in conjunction with avidemux's command-line --run option (avidemux2_cli --run foo.js). Save it as mp4.js and try it with this shell script:
for input in "$@"; do
cp -v "$input" avidemux.input
yes | avidemux2_cli --run mp4.js
rm -v avidemux.input
mv -v avidemux.output "${input%.*}-$$.mp4"
donefunction processFile(app, filename, targetfile)
{
// Load the file
app.forceUnpack();
app.load(filename);
app.rebuildIndex();
//
//** Postproc **
app.video.setPostProc(3,3,0);
app.video.setFps1000(29970);
//
//** Filters **
app.video.addFilter("mpresize","w=320","h=240","algo=0");
//** Video Codec conf **
app.video.codec("XVID4","CBR=1024","500 06 00 00 00 01 00 00 00 fa 00 00 00 00 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.audio.reset();
app.audio.codec("aac",128,4,"80 00 00 00 ");
app.audio.normalizeMode = 0;
app.audio.normalizeValue = 0;
app.audio.delay=0;
//** Audio **
app.audio.mixer("NONE");
app.audio.scanVBR();
app.setContainer("MP4");
app.save(targetfile);
return 1;
}
processFile(new Avidemux(), "avidemux.input", "avidemux.output");