News:

--

Main Menu

Batch to Resize an avi file.

Started by RamPc, June 28, 2013, 05:44:56 PM

Previous topic - Next topic

RamPc

Hello people,

I have a batch file with below code:

set avidemux="C:\Program Files\Avidemux 2.5\avidemux2.exe"
set videocodec=x264
set audiocodec=AAC
set outputformat=mp4
for %%f in (*.avi) do %avidemux% --force-alt-Xvid --load "%%f" --output-format MP4 --video-codec %videocodec% --audio-normalize --audio-codec %audiocodec% --save "%%f.mp4" --quit

And I was wondering if there is a way to resize the file in the convert process.

Could anyone have an idea how to do this?

Thanks.

Jan Gruuthuse

try with save a project as:
load video, set audio video codec with their settings.
In Video:Filters Apply Resize Filter:
Set parameters in Resize Window:
Main Menu: Save Project As: Resize.js

Now edit Resize.js:
//AD  <- Needed to identify//
//--automatically built--
//--Project: /home/jan/Videos/Resize.js

var app = new Avidemux();

//** Video **
// 01 videos source
app.load("/Videos/myvideo.vob.idx");
//01 segments
app.clearSegments();
app.addSegment(0,0,6274);
app.markerA=0;
app.markerB=6273;
app.rebuildIndex();

//** Postproc **
app.video.setPostProc(0,0,0);

app.video.fps1000 = 25000;

//** Filters **
app.video.addFilter("resize","w=320","h=256","algo=2");

//** Video Codec conf **
app.video.codecPlugin("92B544BE-59A3-4720-86F0-6AD5A2526FD2", "Xvid", "AQ=26", "(null)");

//** Audio **
app.audio.reset();
app.audio.codec("Faac",128,4,"80 00 00 00 ");
app.audio.normalizeMode=1;
app.audio.normalizeValue=0;
app.audio.delay=0;
app.audio.mixer="STEREO";
app.audio.resample=48000;
app.setContainer("MP4");
setSuccess(1);
//app.Exit();

//End of script


Delete these lines:
app.load("/Videos/myvideo.vob.idx");
app.clearSegments();
app.addSegment(0,0,6274);
app.markerA=0;
app.markerB=6273;
app.rebuildIndex();

You did remove the reference to the actual loaded video. Should somewhat look like this:
//AD  <- Needed to identify//
//--automatically built--
//--Project: /home/jan/Videos/Resize.js

var app = new Avidemux();

//** Video **
// 01 videos source
//01 segments

//** Postproc **
app.video.setPostProc(0,0,0);

app.video.fps1000 = 25000;

//** Filters **
app.video.addFilter("resize","w=320","h=256","algo=2");

//** Video Codec conf **
app.video.codecPlugin("92B544BE-59A3-4720-86F0-6AD5A2526FD2", "Xvid", "AQ=26", "(null)");

//** Audio **
app.audio.reset();
app.audio.codec("Faac",128,4,"80 00 00 00 ");
app.audio.normalizeMode=1;
app.audio.normalizeValue=0;
app.audio.delay=0;
app.audio.mixer="STEREO";
app.audio.resample=48000;
app.setContainer("MP4");
setSuccess(1);
//app.Exit();

//End of script


you should now be able to use this:
set avidemux="C:\Program Files\Avidemux 2.5\avidemux2.exe"
for %%f in (*.avi) do %avidemux% --load "%%f" --run "C:\Resize.js" --save "%%f.mp4" --quit


You should change --run "C:\Resize.js" to reflect your location/used name.
source: Combination of command-line and JS scripting