Get the default audio even if it is not [0] and check all streams

Any questions? Need some help?
Post Reply
Cutha
Posts: 13
Joined: 21 Aug 2017, 09:16

Get the default audio even if it is not [0] and check all streams

Post by Cutha »

I like to have the audio information in the file name. It took me a bit to figure out how to do this so I thought others might appreciate seeing how I did it.

Code: Select all

{
//Get index # that the default audio is using (only expecting 1 default audio)
int DefAudIndex = 0;
audio.eachWithIndex{ a, idx -> if(call{a.default} == "Yes") DefAudIndex = idx};
"(DefAudIndex:" + DefAudIndex + ")(Channels:" + self.audio[DefAudIndex].channels + ") (codec:" + self.audio[DefAudIndex].codec + ")";
}
In the Preset Editor this was the result of the above (the output is obviously not intended for production just for illustration):
(DefAudIndex:1)(Channels:6) (codec:AC3)
Cutha
Posts: 13
Joined: 21 Aug 2017, 09:16

Re: Get the default audio even if it is not [0] and check all streams

Post by Cutha »

Code: Select all

{
def GetFPSafe = {if(self.audio[it].FormatProfile != null) audio[it].FormatProfile else "NoFormatProfile"};
def sTotalString = "";

//Check all audio streams, show info
sTotalString = "There are " + audio.size + " audio streams ";
for (iCnt = 0; iCnt < audio.size ; iCnt++){
sTotalString += "(Index:" + iCnt + " >> Codec:" + self.audio[iCnt].codec + " >> FormatProfile:" + GetFPSafe(iCnt) + " >> Channels:" + self.audio[iCnt].channels + ") ";
}
sTotalString;
}
In the Preset Editor this was the result of the above (the output is obviously not intended for production just for illustration):
There are 3 audio streams (Index:0 >> Codec:TrueHD >> FormatProfile:TrueHD+Atmos/TrueHD >> Channels:Object Based/8) (Index:1 >> Codec:AC3 >> FormatProfile:NoFormatProfile >> Channels:6) (Index:2 >> Codec:AC3 >> FormatProfile:NoFormatProfile >> Channels:6)
stephen147
Donor
Posts: 131
Joined: 01 Sep 2015, 22:40

Re: Get the default audio even if it is not [0] and check all streams

Post by stephen147 »

Hi, thanks for your work.

I'm getting an error on all files.

Code: Select all

Binding "FormatProfile": undefined
Changing it and worked: (Changed FormatProfile >> Format_Commercial)

Code: Select all

{
def GetFPSafe = {if(self.audio[it].Format_Commercial != null) audio[it].Format_Commercial else "NoFormatProfile"};
def sTotalString = "";

//Check all audio streams, show info
sTotalString = "There are " + audio.size + " audio streams ";
for (iCnt = 0; iCnt < audio.size ; iCnt++){
sTotalString += "(Index:" + iCnt + " >> Codec:" + self.audio[iCnt].codec + " >> FormatProfile:" + GetFPSafe(iCnt) + " >> Channels:" + self.audio[iCnt].channels + ") ";
}
sTotalString;
}
What I was hoping to do was search that string you output for TrueHD+Atmos and insert that into the new Name. Thanks in advance.
Cutha
Posts: 13
Joined: 21 Aug 2017, 09:16

Re: Get the default audio even if it is not [0] and check all streams

Post by Cutha »

stephen147 wrote: 18 Sep 2017, 22:35
What I was hoping to do was search that string you output for TrueHD+Atmos and insert that into the new Name. Thanks in advance.
Hi,

So you want to use a custom string in your file name if any of the audio tracks have TrueHD+Atmos?
stephen147
Donor
Posts: 131
Joined: 01 Sep 2015, 22:40

Re: Get the default audio even if it is not [0] and check all streams

Post by stephen147 »

Cutha, my question has been answered.

Thanks.

Thread here :
viewtopic.php?f=8&t=5337
Post Reply