Author Topic: Audio delay ignored while processing jobs with command line?  (Read 6305 times)

aka Stephen McPuppa

  • Newbie
  • *
  • Posts: 10
Audio delay ignored while processing jobs with command line?
« on: March 15, 2012, 11:58:15 AM »
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

  • Hero Member
  • *****
  • Posts: 6051
Re: Audio delay ignored while processing jobs with command line?
« Reply #1 on: March 15, 2012, 12:12:48 PM »
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:
Quote
do %avidemux% --force-alt-h264 --load "%%f" --run something.js --save "%%f.avi" --quit
are you including the path to the location of the .js?
Code: [Select]
--run C:\video\script\something.jsthe location is perhaps not seen where something.js sits?

aka Stephen McPuppa

  • Newbie
  • *
  • Posts: 10
Re: Audio delay ignored while processing jobs with command line?
« Reply #2 on: March 15, 2012, 01:41:34 PM »
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
Code: [Select]
//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
app.load("E:/temp/PVR/120215-2.mpg.idx");
//01 segments
app.clearSegments();
app.addSegment(0,120,2921);
app.markerA=0;
app.markerB=2920;
app.rebuildIndex();

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

app.video.fps1000 = 25000;

//** Filters **

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

//** Audio **
app.audio.reset();
app.audio.codec("Lame",128,20,"80 00 00 00 00 00 00 00 01 00 00 00 02 00 00 00 00 00 00 00 ");
app.audio.normalizeMode=0;
app.audio.normalizeValue=0;
[b]app.audio.delay=-300;[/b]
app.audio.mixer="NONE";
app.setContainer("AVI");
setSuccess(app.save("E:/temp/verify/120215.avi"));
//app.Exit();

//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.

__runAll.bat
Code: [Select]
for %%f in ("C:\Users\xy\Application Data\avidemux\jobs\*.js") do __runOne.bat "%%f"
__runOne.bat
Code: [Select]
if (%1)==() goto end
call "E:\progs\avidemux\avidemux2_cli" --run %1 --quit
move %1 "C:\Users\xy\Application Data\avidemux\jobs\ver"
:end

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

Code: [Select]
__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. :)

bye


Jan Gruuthuse

  • Hero Member
  • *****
  • Posts: 6051
Re: Audio delay ignored while processing jobs with command line?
« Reply #3 on: March 15, 2012, 02:36:07 PM »
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?
Code: [Select]
[b]app.audio.delay=-300;[/b] app.audio.delay=-300; 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

  • Newbie
  • *
  • Posts: 10
Re: Audio delay ignored while processing jobs with command line?
« Reply #4 on: March 15, 2012, 03:20:58 PM »
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
Code: [Select]
__runOne.bat "C:\Users\xy\Application Data\avidemux\jobs\120215.avi.js"

and the second (excluding controls) executes avidemux like this:
Code: [Select]
"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

  • Hero Member
  • *****
  • Posts: 6051
Re: Audio delay ignored while processing jobs with command line?
« Reply #5 on: March 15, 2012, 03:39:57 PM »
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.
Code: [Select]
"E:\progs\avidemux\avidemux2" --run "C:\Users\xy\Application Data\avidemux\jobs\120215.avi.js" --quit
« Last Edit: March 15, 2012, 03:42:10 PM by Jan Gruuthuse »

aka Stephen McPuppa

  • Newbie
  • *
  • Posts: 10
Re: Audio delay ignored while processing jobs with command line?
« Reply #6 on: March 16, 2012, 03:49:01 PM »
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

  • Hero Member
  • *****
  • Posts: 6051
Re: Audio delay ignored while processing jobs with command line?
« Reply #7 on: March 16, 2012, 04:42:53 PM »
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.
« Last Edit: March 16, 2012, 05:22:21 PM by Jan Gruuthuse »

aka Stephen McPuppa

  • Newbie
  • *
  • Posts: 10
Re: Audio delay ignored while processing jobs with command line?
« Reply #8 on: March 16, 2012, 05:18:55 PM »
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.

nibbles

  • Sr. Member
  • ****
  • Posts: 292
Re: Audio delay ignored while processing jobs with command line?
« Reply #9 on: March 16, 2012, 09:20:04 PM »
Now that you've defined the problem, please provide a small, reproducible test setup including script.