Get format profiles of all audio streams.

Any questions? Need some help?
Post Reply
stephen147
Donor
Posts: 131
Joined: 01 Sep 2015, 22:40

Get format profiles of all audio streams.

Post 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? :)
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Get format profiles of all audio streams.

Post by rednoah »

This will give you all the values for all the audio streams:

Code: Select all

audio.FormatProfile
If you get null values from some streams, then you can remove them like so:

Code: Select all

audio.FormatProfile.findAll{ it != null }
or

Code: Select all

audio.FormatProfile - null
:idea: Please read the FAQ and How to Request Help.
stephen147
Donor
Posts: 131
Joined: 01 Sep 2015, 22:40

Re: Get format profiles of all audio streams.

Post by stephen147 »

Thanks again, for the one-liner.

Maybe a daily build has fixed the issue?

But with current stable build:

This works:

Code: Select all

{audio.codecid}
But this doesn't:

Code: Select all

{audio.FormatProfile}
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Get format profiles of all audio streams.

Post by rednoah »

No idea. Have you tried to prototype this in the Format Editor? What does the warning message say?
:idea: Please read the FAQ and How to Request Help.
stephen147
Donor
Posts: 131
Joined: 01 Sep 2015, 22:40

Re: Get format profiles of all audio streams.

Post 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
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Get format profiles of all audio streams.

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

:idea: If you have donated previously, then I may be able to give you a promo code for the Windows Store.
:idea: Please read the FAQ and How to Request Help.
stephen147
Donor
Posts: 131
Joined: 01 Sep 2015, 22:40

Re: Get format profiles of all audio streams.

Post 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?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Get format profiles of all audio streams.

Post 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.
:idea: Please read the FAQ and How to Request Help.
stephen147
Donor
Posts: 131
Joined: 01 Sep 2015, 22:40

Re: Get format profiles of all audio streams.

Post by stephen147 »

Cool. PM sent earlier.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Get format profiles of all audio streams.

Post 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. ;)
:idea: Please read the FAQ and How to Request Help.
stephen147
Donor
Posts: 131
Joined: 01 Sep 2015, 22:40

Re: Get format profiles of all audio streams.

Post 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:

Code: Select all

{audio.FormatProfile}
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.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Get format profiles of all audio streams.

Post 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. :)
:idea: Please read the FAQ and How to Request Help.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: Get format profiles of all audio streams.

Post by kim »

ALL the audio streams need to have "audio.FormatProfile" or you need to make your format compensate for this
stephen147
Donor
Posts: 131
Joined: 01 Sep 2015, 22:40

Re: Get format profiles of all audio streams.

Post by stephen147 »

Ah I see now. How would one go about that?
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: Get format profiles of all audio streams.

Post 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
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Get format profiles of all audio streams.

Post 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. ;)
:idea: Please read the FAQ and How to Request Help.
stephen147
Donor
Posts: 131
Joined: 01 Sep 2015, 22:40

Re: Get format profiles of all audio streams.

Post 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.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: Get format profiles of all audio streams.

Post 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) }
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: Get format profiles of all audio streams.

Post 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"
stephen147
Donor
Posts: 131
Joined: 01 Sep 2015, 22:40

Re: Get format profiles of all audio streams.

Post 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.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: Get format profiles of all audio streams.

Post 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(', ')
}
stephen147
Donor
Posts: 131
Joined: 01 Sep 2015, 22:40

Re: Get format profiles of all audio streams.

Post 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. :)
Post Reply