Avidemux Forum

Participate => Documentation & Tips => Topic started by: Jan Gruuthuse on April 01, 2012, 03:56:57 PM

Title: 2.6 audio track switching in job.py
Post by: Jan Gruuthuse on April 01, 2012, 03:56:57 PM
For those doing batch processing or loading job: our thoughtful developer already implemented the audiotrack settings in python script .js script. Useful if you have a lot of similar processing to do either manual or with batch processing. If you have to do this on a regular basis for certain TV channel, you can give it the name of the station (BR alpha in this example).
Load and append the complete video track and the run the job.
Edit and remove the video loading and marker settings from a saved script,  as they differ for each clip. Save it with the correct settings you want.
Note the Postprec is set 0,0,0, post processing switched off. This is normally set on by default.
#PY  <- Needed to identify#
#--automatically built--
#--Project: /home/jan/Videos/BRalpha.py

adm=Avidemux()
#** Video **

#** Postproc **
adm.setPostProc(0,0,0)

#** Video Codec conf **
adm.videoCodec("Copy")

#** Filters **

#** Audio **
adm.audioClearTracks()

#** Track 0 **
adm.audioAddTrack(2)
adm.audioCodec(0,"copy");
adm.audioSetPal2Film(0,0)
adm.audioSetFilm2Pal(0,0)
adm.audioSetNormalize(0,0,0)

#** Track 1 **
adm.audioAddTrack(1)
adm.audioCodec(1,"copy");
adm.audioSetPal2Film(1,0)
adm.audioSetFilm2Pal(1,0)
adm.audioSetNormalize(1,0,0)

#** Track 2 **
adm.audioAddTrack(0)
adm.audioCodec(2,"copy");
adm.audioSetPal2Film(2,0)
adm.audioSetFilm2Pal(2,0)
adm.audioSetNormalize(2,0,0)

#** Muxer **
adm.setContainer("ffTS","acceptNonCompliant=False","vbr=True","muxRateInMBits=10")

#End of script


this can also by called from the batch file:
Windows:
for %%f in (*.mp4) do %avidemux% --force-alt-h264 --load "%%f" --run BRalpha.py --save "%%f.avi" --quit
Linux:
for FIL in `ls *mp4 | sort` ; do
  /usr/bin/avidemux3_qt4 --force-alt-h264 --load "$FIL" --run BRalpha.py --save ${FIL%.*}.avi --quit
done

Title: Re: 2.6 audio track switching in job.py
Post by: davidrnewman on September 22, 2012, 01:54:36 PM
How do you do the same in an ECMAscript (i.e. not using Python)?

When I load saved ECMAscripts, the audio settings are ignored, so Avidemux defaults to copy (not the Faac I had set).
Title: Spidermonkey ignores audito track selection!
Post by: Jan Gruuthuse on September 22, 2012, 02:32:31 PM
For now you can't. Developers may have a look at this?
adm.audioCodec(0, "copy");
adm.audioCodec(1, "copy");
adm.audioCodec(2, "copy");

my guess the code should become:
adm.audioCodec(2, "copy");
adm.audioCodec(1, "copy");
adm.audioCodec(0, "copy");

But even when you edit and save: the run project ignore the track selecting settings?
Title: Re: 2.6 audio track switching in job.py
Post by: Jan Gruuthuse on January 11, 2013, 01:04:14 PM
If you're using Tinypy scripts for audio, best you re-save these in avidemux. These 2 are now in use for each separate audio track:
adm.audioSetDrc(#, 0)
adm.audioSetShift(#, 0,0)

Where # represents an audiotrack.