2.6 audio track switching in job.py

Started by Jan Gruuthuse, April 01, 2012, 03:56:57 PM

Previous topic - Next topic

Jan Gruuthuse

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.
  • BR alpha has 3 audio tracks: stereo, stereo, AC3 by default. I want this to be AC3, stereo, stereo. So player starts playing dolby instead of stereo track.
  • So track 0 loads audio stream 2 (AC3) and track 2 loads audio stream 0 (Stereo). Track 1 keeps its default stream 1.
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


davidrnewman

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

Jan Gruuthuse

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?

Jan Gruuthuse

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.