# Calculte new width and height of the video based on the original width, height and ratio

after searching through - I wasn't able to find the answer so I'll give it a shot here.

I need to resize desktop video in order to feet it on mobile screen, let's say original width of the video was $1915$ and original height was $1075$, I calculated aspect ratio:

$\text{aspectRatio} = \dfrac{\text{width}}{\text{height}}$;

$\text{aspectRatio} = 1.78$;

Now my mobile screen resolution is: $\text{height}= 1609$, $\text{width}= 1080$.

How can I properly resize my video in order to keep the same aspect ratio??

Thank you

Well, you want to keep the aspect ratio the same, and presumably you want the biggest image possible. This mean that you need $1.78=\dfrac{w_n}{h_n}$ where $w_n$ is the new width and $h_n$ is the new height. Additionally, you'd like at least one of $w_n=1080$ or $h_n=1609$ to be true so that you have the biggest image possible. Now, on your desktop the width was greater than the height, but on your phone, the height is greater. This means that we can make $w_n=1080$, giving us $h_n=\dfrac{1080}{1.78}\approx 607$. This does keep the aspect ratio the same, but notice that you using less than half the potential height. Maybe you should try rotating the phone!