If I have a video of size:
width: 640
height: 480
and a screen of size:
width: 1280
height: 720
what is the equation to find the max width and height I can stretch the video too and keep its ratio.
I can calculate the ratio like:
ratio = width / height
video ratio: 1.3
screen ratio: 1.7
that's about as far as I can work out :-(
Divide the corresponding measurements by each other: screen width by video width, screen height by video height. Then take the smaller of the two ratios, and that's the amount you can stretch the video by.
In this example, we have $$\frac{\text{screen width}}{\text{video width}} = \frac{1280}{640} = 2$$ $$\frac{\text{screen height}}{\text{video height}} = \frac{720}{480} = 1.5$$ So you can stretch the video by a factor of $1.5$, making it $960\times720.$