Author Topic: 2.6 audio track switching in job.py  (Read 12346 times)

Jan Gruuthuse

  • Hero Member
  • *****
  • Posts: 6060
2.6 audio track switching in job.py
« 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.
  • 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.
Code: [Select]
#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:
Code: [Select]
for %%f in (*.mp4) do %avidemux% --force-alt-h264 --load "%%f" --run BRalpha.py --save "%%f.avi" --quitLinux:
Code: [Select]
for FIL in `ls *mp4 | sort` ; do
  /usr/bin/avidemux3_qt4 --force-alt-h264 --load "$FIL" --run BRalpha.py --save ${FIL%.*}.avi --quit
done
« Last Edit: June 05, 2017, 07:44:40 AM by Jan Gruuthuse »

davidrnewman

  • Newbie
  • *
  • Posts: 6
Re: 2.6 audio track switching in job.py
« Reply #1 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).

Jan Gruuthuse

  • Hero Member
  • *****
  • Posts: 6060
Spidermonkey ignores audito track selection!
« Reply #2 on: September 22, 2012, 02:32:31 PM »
For now you can't. Developers may have a look at this?
Code: [Select]
adm.audioCodec(0, "copy");
adm.audioCodec(1, "copy");
adm.audioCodec(2, "copy");
my guess the code should become:
Code: [Select]
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

  • Hero Member
  • *****
  • Posts: 6060
Re: 2.6 audio track switching in job.py
« Reply #3 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:
Code: [Select]
adm.audioSetDrc(#, 0)
adm.audioSetShift(#, 0,0)
Where # represents an audiotrack.