Resize with only one value

Use this forum to request features. Maybe you'll get lucky!
video_m
Posts: 22
Joined: Fri Dec 17, 2021 6:07 pm

Resize with only one value

Post by video_m »

Hello,

it's it posible to use the resize tool and give only the width a value? so that the computer itself determines the height based on the aspect ratio?

Thank in advance!

Kr,
Mkz
User avatar
FranceBB
Posts: 258
Joined: Sat Jun 25, 2016 3:43 pm
Contact:

Re: Resize with only one value

Post by FranceBB »

If by "resize tool" you mean the resize filter that you can use after the A/V decoder, that's not aspect ratio aware (unless something changed in the last few years), so if you put an arbitrary resolution, it will always shrink. On the other hand, the resize inside the encoding nodes goes through the filter builder and it's aspect ratio aware.
Anyway, to accomplish this, instead of the resizing node, I can easily write a custom Avisynth Script for you.
I'm currently on my mobile 'cause I'm in the UK and not in the office, but if you can wait till the end of the week, I'll come back with one.
Out of curiosity, do you have a particular resolution in mind?
admin
Site Admin
Posts: 1680
Joined: Sat Feb 08, 2014 10:39 pm

Re: Resize with only one value

Post by admin »

Hi video_m,

You can sort of easily do the computation yourself by storing the calculated width or height in a variable.
For example, if you want to resize 1080 video to 720 you can do the following in the Populate node.

%i_my_digit% = (%i_width%/%i_height%)*720

The result of this would be 1280 if source was 1920x1080. %i_my_digit% being just some arbitrary variable you create yourself and you use it as input for the resize width in the Resize node.
populate.jpg
populate.jpg (30.49 KiB) Viewed 8147 times
resize.jpg
resize.jpg (22.82 KiB) Viewed 8147 times
Hope this helps.

-steinar
emcodem
Posts: 1753
Joined: Wed Sep 19, 2018 8:11 am

Re: Resize with only one value

Post by emcodem »

Additionally i want to mention that using the resize processor (in combination with the A/V decoder) is only needed in certain special cases e.g. you want to select the resize algorithm or you want to do further filtering after the resize. You could instead just specify the new width and height in each and every encoder processor directly.

If @momocampo answers as well, you have repsone from the whole team, congrats :D
emcodem, wrapping since 2009 you got the rhyme?
video_m
Posts: 22
Joined: Fri Dec 17, 2021 6:07 pm

Re: Resize with only one value

Post by video_m »

FranceBB wrote: Mon Aug 01, 2022 7:32 pm Anyway, to accomplish this, instead of the resizing node, I can easily write a custom Avisynth Script for you.
I'm currently on my mobile 'cause I'm in the UK and not in the office, but if you can wait till the end of the week, I'll come back with one.
Out of curiosity, do you have a particular resolution in mind?
Thank you, For now have i a special project where everything must be 800px with.

Thank you @steinar and emcodem. i will try your solution!
video_m
Posts: 22
Joined: Fri Dec 17, 2021 6:07 pm

Re: Resize with only one value

Post by video_m »

admin wrote: Mon Aug 01, 2022 8:26 pm Hi video_m,

You can sort of easily do the computation yourself by storing the calculated width or height in a variable.
For example, if you want to resize 1080 video to 720 you can do the following in the Populate node.

%i_my_digit% = (%i_width%/%i_height%)*720

The result of this would be 1280 if source was 1920x1080. %i_my_digit% being just some arbitrary variable you create yourself and you use it as input for the resize width in the Resize node.

populate.jpg
resize.jpg

Hope this helps.

-steinar
Hello Steinar,

I have try this solution but i get back a error back. "Could not get value for %i_my_digit%!
Did you know what i do wrong?

Thank you.

Kr,
video_m
Posts: 22
Joined: Fri Dec 17, 2021 6:07 pm

Re: Resize with only one value

Post by video_m »

Here also me template
Last edited by video_m on Mon Aug 08, 2022 8:17 pm, edited 1 time in total.
emcodem
Posts: 1753
Joined: Wed Sep 19, 2018 8:11 am

Re: Resize with only one value

Post by emcodem »

Aye Kr,

sorry but i cannot imagine how you come to the error message "Could not get value for %i_my_digit%"!
Aside from that, you need to insert a stills decoder processor after the monitor or better before the resize.
emcodem, wrapping since 2009 you got the rhyme?
video_m
Posts: 22
Joined: Fri Dec 17, 2021 6:07 pm

Re: Resize with only one value

Post by video_m »

i found the mistake. i forgot the av-media deencode :)
video_m
Posts: 22
Joined: Fri Dec 17, 2021 6:07 pm

Re: Resize with only one value

Post by video_m »

Hello All,

I will change the workflow to a another computer. but now get i the error: Watermark@DESKTOP-LG01KEO: Validate: Unknown error occured.
Did somebody what i can do?

Kind regards,
MKZ
Post Reply