August 12, 2020, 09:42:00 am



Audio delay ignored while processing jobs with command line?

Started by aka Stephen McPuppa, March 15, 2012, 11:58:15 am

Previous topic - Next topic

aka Stephen McPuppa

Hi everybody

I use Avidemux to crop and re-encode cartoons for my sons from an mpg stream recorded by a digital tuner.
I usually use the GUI interface to cut and prepare jobs and add them to the job list; after that I run a batch that encodes all the jobs in the directory.
Sometimes happens that I need to adjust the delay of the audio, but if I manually edit the .js file and re-run the batch it seems to me that the audio delay is not considered, but if I run the same job from the GUI it works correctly.
It happens only to me?

thanks in advance.

Jan Gruuthuse

the .js you're editing is the one with the avidemux settings? And when running the batch file that one is past on to avidemux with:
Quotedo %avidemux% --force-alt-h264 --load "%%f" --run something.js --save "%%f.avi" --quit
are you including the path to the location of the .js?
--run C:\video\script\something.js
the location is perhaps not seen where something.js sits?

aka Stephen McPuppa

Yes, the .js is the one saved by the avidemux GUI. Just for example I saved and modified one, it cuts from x to y and encode to xvid 1500 2-pass and mp3.

I encrypted some names and deleted some paths to simplify the view, so if something is not coherent maybe it's for that changes I made.

this is the .js file
//AD  <- Needed to identify//
//--automatically built--
//--Project: C:\Users\xyz\AppData\Roaming\avidemux\jobs\/120215.avi.js

var app = new Avidemux();

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

//** Postproc **,3,0); = 25000;

//** Filters **

//** Video Codec conf **"92B544BE-59A3-4720-86F0-6AD5A2526FD2", "Xvid", "2PASSBITRATE=1500", "<?xml version='1.0'?><XvidConfig><presetConfiguration><name>.............");

//** Audio **;"Lame",128,20,"80 00 00 00 00 00 00 00 01 00 00 00 02 00 00 00 00 00 00 00 ");;;

//End of script

The batches I run are the following (something very simple). The first cycles for all the .js files in jobs directory and calls the second to encode. The second also move the .js file in a sub-directory to not loop on always the same jobs.

for %%f in ("C:\Users\xy\Application Data\avidemux\jobs\*.js") do __runOne.bat "%%f"

if (%1)==() goto end
call "E:\progs\avidemux\avidemux2_cli" --run %1 --quit
move %1 "C:\Users\xy\Application Data\avidemux\jobs\ver"

When I run the first batch, the call of the second batch (with the parameters substituted by job names) is

__runOne.bat "C:\Users\xy\Application Data\avidemux\jobs\120215.avi.js"
if ("C:\Users\xy\Application Data\avidemux\jobs\120215.avi.js") == () goto end
call "E:\progs\avidemux\avidemux2_cli" --run "C:\Users\xy\Application Data\avidemux\jobs\120215.avi.js" --quit

I hope I explained all the things. :)


Jan Gruuthuse

Been a long time I watched batch files. Far more complex what you're doing that what I'm used to. Nested levels, ...
Check that parameters are past from master batch to the called batch file(s)? Using echo in batch to visualize variables passed on. Just in case?
[b];[/b]; was just to highlight here and is not in the .js file?
Could be problematic: 120215.avi.js ? Is it necessary to use this format .avi.js, guess it would be safer to use 120215avi.js? Myself I keep folders as close as possible to \ , like C:\script, D:\avi, D:\mp4, ...

aka Stephen McPuppa

It's not so difficult as it seems :) the first batch cycles a for each file.js calls the second passing as parameter (%1) the name of the file for that cycle.

In this case the first batch calls the second like this

__runOne.bat "C:\Users\xy\Application Data\avidemux\jobs\120215.avi.js"

and the second (excluding controls) executes avidemux like this:

"E:\progs\avidemux\avidemux2_cli" --run "C:\Users\xy\Application Data\avidemux\jobs\120215.avi.js" --quit

if I use "echo %1" to show what is passed to the second batch I'll see C:\Users\xy\Application Data\avidemux\jobs\120215.avi.js

The bold tags in the .js file were added by me to show you the parameter, they are not really in the job file.

I could try to not use the .avi.js extension, but I don't think the problem is here, because the job starts correctly.

I think is more simple if you try to encode a piece of movie using a big delay like -1000 (that is 1 second of delay) and see what happens.

Jan Gruuthuse

March 15, 2012, 03:39:57 pm #5 Last Edit: March 15, 2012, 03:42:10 pm by Jan Gruuthuse
If it works in the GUI with the audio delay, substitute avidemux2_cli.exe with the avidemux2.exe. This does not cause any problems in Ubuntu, calling the avidemux GUI, will not look nice on your desktop. But this way you could rule out there is a difference between GUI and CLI operation.
"E:\progs\avidemux\avidemux2" --run "C:\Users\xy\Application Data\avidemux\jobs\120215.avi.js" --quit

aka Stephen McPuppa

I try with 3 jobs, one without delay, one with +1000ms of delay and one with -1000ms.
The three jobs run with command interface are identical, then I modify the batch as you told (calling the avidemux2.exe instead of avidemux2_cli) and they are out of sync as expected.
Maybe the command line expect the delay on a command parameter instead of the one in the job file?

Jan Gruuthuse

March 16, 2012, 04:42:53 pm #7 Last Edit: March 16, 2012, 05:22:21 pm by Jan Gruuthuse
Perhaps here at bottom of this page: Avidemux audio functions: delay if not others: one of the developers or program savvy person(s) should be able to give more info.

aka Stephen McPuppa

From that page it seems that the parameter is used. If no answer will arrive I'll try to debug the command line parser. :D
Thank you for now.


Now that you've defined the problem, please provide a small, reproducible test setup including script.