Participate > Documentation & Tips
2.6 audio track switching in job.py
(1/1)
Jan Gruuthuse:
For those doing batch processing or loading job: our thoughtful developer already implemented the audiotrack settings in .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: ---#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
--- End code ---
this can also by called from the batch file:
Windows:
--- Code: ---for %%f in (*.mp4) do %avidemux% --force-alt-h264 --load "%%f" --run BRalpha.py --save "%%f.avi" --quit
--- End code ---
Linux:
--- Code: ---for FIL in `ls *mp4 | sort` ; do
/usr/bin/avidemux3_qt4 --force-alt-h264 --load "$FIL" --run BRalpha.py --save ${FIL%.*}.avi --quit
done
--- End code ---
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?
--- Code: ---adm.audioCodec(0, "copy");
adm.audioCodec(1, "copy");
adm.audioCodec(2, "copy");
--- End code ---
my guess the code should become:
--- Code: ---adm.audioCodec(2, "copy");
adm.audioCodec(1, "copy");
adm.audioCodec(0, "copy");
--- End code ---
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:
--- Code: ---adm.audioSetDrc(#, 0)
adm.audioSetShift(#, 0,0)
--- End code ---
Where # represents an audiotrack.
zaza:
--- Quote from: Jan Gruuthuse on April 01, 2012, 04:56:57 PM ---For those doing batch processing or loading job: our thoughtful developer already implemented the audiotrack settings in .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: ---#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
--- End code ---
this can also by called from the batch file:
Windows:
--- Code: ---for %%f in (*.mp4) do %avidemux% --force-alt-h264 --load "%%f" --run BRalpha.py --save "%%f.avi" --quit
--- End code ---
Linux:
--- Code: ---for FIL in `ls *mp4 | sort` ; do
/usr/bin/avidemux3_qt4 --force-alt-h264 --load "$FIL" --run BRalpha.py --save ${FIL%.*}.avi --quit
done
--- End code ---
--- End quote ---
Hi Jan,
This was helpful, thanks for sharing!
Navigation
[0] Message Index
Go to full version