Page 1 of 1
Get format profiles of all audio streams.
Posted: 18 Sep 2017, 23:32
by stephen147
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, with Codec_Formats: ";
for (iCnt = 0; iCnt < audio.size ; iCnt++){
sTotalString += audio[iCnt].Codec_Profile + ",";
}
sTotalString
//sTotalString.matches(/(?i).+Atmos.+/) ? "TrueHD+Atmos" : ""
}
Doesn't work. I grabbed it from
viewtopic.php?f=3&t=5286#p29946 and edited it. The problem seems to lie with changing:
Code: Select all
sTotalString += audio[iCnt].Codec_Profile + ",";
to:
Code: Select all
sTotalString += audio[iCnt].Codecid+ ",";
All I want to do is get all the audio streams e.g.
{audio[1].Format_Profile} where defined.
I know, rednoah, that you have given me one-liners before so maybe this is no different?

Re: Get format profiles of all audio streams.
Posted: 19 Sep 2017, 02:01
by rednoah
This will give you all the values for all the audio streams:
If you get null values from some streams, then you can remove them like so:
Code: Select all
audio.FormatProfile.findAll{ it != null }
or
Re: Get format profiles of all audio streams.
Posted: 19 Sep 2017, 14:17
by stephen147
Thanks again, for the one-liner.
Maybe a daily build has fixed the issue?
But with current stable build:
This works:
But this doesn't:
Re: Get format profiles of all audio streams.
Posted: 19 Sep 2017, 17:07
by rednoah
No idea. Have you tried to prototype this in the Format Editor? What does the warning message say?
Re: Get format profiles of all audio streams.
Posted: 19 Sep 2017, 19:58
by stephen147
Here's the screenshot of an example.
John wick- Chapter 2 (2017) which has 7 audio streams but still the problem occurs.
https://i.imgur.com/o1tLfAR.jpg
Re: Get format profiles of all audio streams.
Posted: 20 Sep 2017, 02:51
by rednoah
I see. You're still using the old legacy version of FileBot. I'm fairly sure this particular issue has been fixed with the latest release.

If you have donated previously, then I may be able to give you a promo code for the
Windows Store.
Re: Get format profiles of all audio streams.
Posted: 20 Sep 2017, 10:56
by stephen147
Ok, I'll probably get that then. I have donated before alright.
It says donor under my Nickname. How do I get the promo?
Will the 20$ be a one-off payment for future releases?
Re: Get format profiles of all audio streams.
Posted: 20 Sep 2017, 15:05
by rednoah
You can PM me your PayPal donation details and then I'll send you a promo code. Once you have a Windows Store license it's forever. They don't even support paid upgrades, so it's always a one-off thing for any app.
Re: Get format profiles of all audio streams.
Posted: 20 Sep 2017, 21:25
by stephen147
Cool. PM sent earlier.
Re: Get format profiles of all audio streams.
Posted: 21 Sep 2017, 02:56
by rednoah
Normally, 10 EUR donations only get you a promo code if that donation happened in or before 2014 to reward early supporters. I'll make an exception for you though.

Re: Get format profiles of all audio streams.
Posted: 21 Sep 2017, 12:55
by stephen147
Thank you. You'll be sure that I'll be donating again in the future. You deserve it.
Still having the same problem with binding:
I've uninstalled the old one and reinstalled the win store app twice with no luck.
I can upload the first 6 seconds of that file if that's OK.
Re: Get format profiles of all audio streams.
Posted: 21 Sep 2017, 13:24
by rednoah
If you could upload a small test file that would be much appreciated and make it much easier for me to give you a working format.

Re: Get format profiles of all audio streams.
Posted: 21 Sep 2017, 13:26
by kim
ALL the audio streams need to have "audio.FormatProfile" or you need to make your format compensate for this
Re: Get format profiles of all audio streams.
Posted: 21 Sep 2017, 13:53
by stephen147
Ah I see now. How would one go about that?
Re: Get format profiles of all audio streams.
Posted: 21 Sep 2017, 18:50
by kim
what you are trying to do is not easy and this took me some time to make:
Code: Select all
{
audio.collect { s ->
allOf
{any
{s.'CodecID/Hint'}
{s.'Codec'.contains('DTS-HD') ? s.'Codec': null}
{s.'Format'}
}
{s.'Format_Profile'}*.replaceAll('/ MA|/ Core|/ ES Matrix|/ TrueHD')*.replaceAll('AC-3', 'AC3').join('.')
}.flatten()*.trim().join(', ')
}
or
Code: Select all
{
audio.collect { s ->
allOf
{any
{s.'CodecID/Hint'}
{s.'Codec'.contains('DTS-HD') ? s.'Codec': null}
{s.'Format'}
}
{s.'Format_Profile'}*.replaceAll('/ MA|/ Core|/ ES Matrix|/ TrueHD')*.replaceAll('AC-3', 'AC3').join('.')
}.flatten()*.trim().unique().join(', ')
}
btw: check out
viewtopic.php?f=5&t=5285
Re: Get format profiles of all audio streams.
Posted: 22 Sep 2017, 03:15
by rednoah
I'd still like to have a sample of this file so I can run a few tests and see why it doesn't work as expected out of the box.

Re: Get format profiles of all audio streams.
Posted: 22 Sep 2017, 12:11
by stephen147
Many thanks for your effort.
It worked perfectly.
Code: Select all
{
audio.collect { s ->
allOf
{any
{s.'CodecID/Hint'}
{s.'Codec'.contains('DTS-HD') ? s.'Codec': null}
{s.'Format'}
}
{s.'Format_Profile'}*.replaceAll('/ MA|/ Core|/ ES Matrix|/ TrueHD')*.replaceAll('AC-3', 'AC3').join('.')
}.flatten()*.trim().join(', ').matches(/(?i).*Atmos.*/) ? "TrueHD+Atmos" : ""
}
I've added:
Code: Select all
.matches(/(?i).*Atmos.*/) ? "TrueHD+Atmos" : ""
How would I assign the first block of code (after defining it) that you wrote to a global so I could then do anywhere beneath it?
Code: Select all
allAudioStringsVar.matches(/(?i).*Atmos.*/) ? "TrueHD+Atmos" : ""
Also, can this support arguments whereby in the code
{s.'Format_Profile'} could be givin an argument for
Format_Profile that can be passed down to a function to retrieve other things as well. This is purely for learning purposes but I'm also intrigued if it can.
Re: Get format profiles of all audio streams.
Posted: 22 Sep 2017, 16:06
by kim
you can only use a variable inside the same {bla bla bla}
so you need to define it outside of tmp1
Code: Select all
{def tmp2 = ' '
tmp1 { a- > tmp2 = a }
tmp2 (same)
}
{ tmp2 (diff./new) }
Re: Get format profiles of all audio streams.
Posted: 22 Sep 2017, 20:55
by kim
You don't want the Format_Profile for TrueHD ?
"TrueHD+Atmos" is the correct one, but maybe it looks better with only "Atmos" ?
try this:
Code: Select all
{
audio.collect { s ->
allOf
{any
{s.'CodecID/Hint'}
{s.'Codec'.contains('DTS-HD') ? s.'Codec': null}
{s.'Format'}
}
{s.'Format_Profile'}*.replaceAll('/ MA|/ Core|/ ES Matrix')*.replaceAll('AC-3', 'AC3')*.replaceAll('TrueHD[+]Atmos / TrueHD', 'Atmos').join('.')
}.flatten()*.trim().join(', ').replaceAll('DTS-HD.X', 'DTS-X')
}
from "TrueHD.TrueHD+Atmos" to "TrueHD.Atmos"
from "DTS-HD.X" to "DTS-X"
Re: Get format profiles of all audio streams.
Posted: 23 Sep 2017, 11:54
by stephen147
Not sure what this example is: (I've tried to get this implemented). Have you a simple working example of the same with bindings.
Code: Select all
{def tmp2 = ' '
tmp1 { a- > tmp2 = a }
tmp2 (same)
}
{ tmp2 (diff./new) }
Also, the full code outputs exactly what I need that I put
HERE with a small edit from rednoahs code, which is
TrueHD+Atmos and
BLANK if atmos doesn't exist in any of the
Format_Profile binding/s.
Re: Get format profiles of all audio streams.
Posted: 23 Sep 2017, 15:06
by kim
did you try my last format ?
it does write "TrueHD.Atmos" if atmos found and only TrueHD if not
if you want to rename it like so 'TrueHD+Atmos' just add the ".replaceAll('TrueHD.Atmos', 'TrueHD+Atmos')" part:
Code: Select all
{
def allAudioStringsVar = (audio.collect { s ->
allOf
{any
{s.'CodecID/Hint'}
{s.'Codec'.contains('DTS-HD') ? s.'Codec': null}
{s.'Format'}
}
{s.'Format_Profile'}*.replaceAll('/ MA|/ Core|/ ES Matrix')*.replaceAll('AC-3', 'AC3')*.replaceAll('TrueHD[+]Atmos / TrueHD', 'Atmos').join('.')
}.flatten()*.trim().join(', ').replaceAll('DTS-HD.X', 'DTS-X').replaceAll('TrueHD.Atmos', 'TrueHD+Atmos'))
}
Code: Select all
{
def allAudioStringsVar = (audio.collect { s ->
allOf
{any
{s.'CodecID/Hint'}
{s.'Codec'.contains('DTS-HD') ? s.'Codec': null}
{s.'Format'}
}
{s.'Format_Profile'}.join('.')
});
allAudioStringsVar.each{ it.matches(/(?i).*Atmos.*/) ? "TrueHD+Atmos" : "" }.join(', ')
}
Re: Get format profiles of all audio streams.
Posted: 24 Sep 2017, 02:48
by stephen147
Thanks. I'll try it as soon as I get my PC back up. PSU has just died. Thinking now of building a Threadripper 1950x build so it could be a week or more before that happens.
My intention was to just write 'TrueHD+Atmos' if it existed and that's it but I'll test your code when I can.
