Aspect ratio

If you need help on how to use the program
Post Reply
al0203
Posts: 72
Joined: 2013-02-27 05:24:17

Aspect ratio

Post by al0203 »

I would like to make a custom field with the aspect ratio of the movies, Frame width/Frame height. AMC gives you the resolution but I don't know the functions to get the width and the height separately. Some movies has a very bad ratio and I would like to know it, to be able to correct it.
This is not a question of AMC, but maybe someone can help me. Does anyone know how can I change the details information of a file?. I found out that sometimes the information of the frame size is not correct, but I don´t know how can I change it. Thank you.
antp
Site Admin
Posts: 9629
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

Hi,
Such field can be filled by script :

program NewScript;
uses StringUtils1;
var
s : string;
w, h: Integer;
begin
s := GetField(fieldResolution);
w := StrToInt(TextBefore(s, 'x', ''), 1);
h := StrToInt(TextAfter(s, 'x'), 1);
SetCustomField('Ratio', FloatToStr( w / h));
end.

assuming here that the custom Ratio fiend is a text field with a tag = 'Ratio'.
You could also set a float field with a fixed number of decimal, in such case you can remove the 'FloatToStr' function call.
al0203
Posts: 72
Joined: 2013-02-27 05:24:17

Post by al0203 »

antp wrote:Hi,
Such field can be filled by script :

program NewScript;
uses StringUtils1;
var
s : string;
w, h: Integer;
begin
s := GetField(fieldResolution);
w := StrToInt(TextBefore(s, 'x', ''), 1);
h := StrToInt(TextAfter(s, 'x'), 1);
SetCustomField('Ratio', FloatToStr( w / h));
end.

assuming here that the custom Ratio fiend is a text field with a tag = 'Ratio'.
You could also set a float field with a fixed number of decimal, in such case you can remove the 'FloatToStr' function call.
Thank you.

Another small question, where can I find the catalog of all the functions like the exponencial? Sqrt works but I don't know how to put a power like 5^3.
antp
Site Admin
Posts: 9629
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

Power(5, 3)
Like in Pascal/Delphi. Not all functions are documented, when they are basic Pascal functions.
al0203
Posts: 72
Joined: 2013-02-27 05:24:17

Post by al0203 »

antp wrote:Power(5, 3)
Like in Pascal/Delphi. Not all functions are documented, when they are basic Pascal functions.
I already tried power (5,3) and it gives me error "unknown identifier: POWER in line 17". I wrote

ponde:= power(5,3);

and ponde is a real variable.
antp
Site Admin
Posts: 9629
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

I guess that the function isn't linked to the script engine then.
Only solution would be a for-loop ...

for i := 1 to Exponent do
begin
Value := Value * Base;
end;
Post Reply