View Full Version : Maintaining / Calculating Aspect Ratios
lightsout
09-14-2006, 05:46 PM
(Sorry, posted this is the wrong forum before...)
Hello,
Wondering what math people are using to lock aspects ratios when converting files...
Say, I have a 578x269 file I want to convert down to a 480 width...I need to figure out the new height I guess...so all will be playable in a 480x360 player.
Any help is greatly appreciated!
Thanks in advance.
kerrizor
09-16-2006, 06:26 PM
Heh.. I'm looking into this as well. I'd love to be able to automagically "letterbox" 16:9 videos such that they play in a player that fills a 4:3 space.
What I do at the moment is do the math in my transcoding script to figure out the correct ratio between the source width and the output width, and apply that transform to the source height to detirmine the output height.
dfgrumpy
10-26-2006, 11:24 AM
for those that need it here is the formula to calcuate the size based on a max width.
aspect = flxEngine.GetInputVideoProperties().getImageWidth() / flxEngine.GetInputVideoProperties().getImageHeight();
width = 320;
height = round(width/aspect);
rdeman
01-21-2007, 07:18 PM
so I understand that I can calculate the max width for scaling, but how would I add the black bars for letterboxing?
LukeB
06-13-2007, 05:05 AM
Is there any solution to the previous posted question (How to get the black bars for letterboxing..) ?? I also need letterboxing and appreciate any help on that..
regards
Luke
jschaf01
06-13-2007, 12:29 PM
I don't think you can add black bars to the video itself. The Flash Player takes care of letterboxing the video. You create your flash player with certain dimensions. When the video plays in the flash player, if you maintain the aspect ratio of the video in the player, it will add black bars around the sides and/or top/bottom based on the size of the stage and the size of the video.
LukeB
06-14-2007, 03:50 AM
this is another way of solving the problem, but it might make sense to control the letterboxing in the flash-player. in my case unfortunately this is not possible, because the player cannot be changed (it will be used at many places on the portal for different media..). however, thanks for the tip
LukeB
06-20-2007, 05:09 AM
in my case i have videos, they have all max. 320 width and max. 240 height, but any size smaller, e.g. 320x130, 310x140, 320x180 ...
how can i now maintain the aspect ratio of the video in the player. do you have an example (action-script?)
jschaf01
06-20-2007, 12:15 PM
I use Peldi's FlashPlayer. It has a some actionscript in a file called UIManager.as which does the calculations on the video size vs the player size and based on the setting in the skin file (topleft, center, or stretch). I use the stretch mode which uses the aspect ratio calculation to resize the video up or down to the stage size and letterboxes the video if necessary.
Use that code as a guide for calculating and resizing things so that it appears correctly in your player.
vBulletin v3.5.1, Copyright ©2000-2010, Jelsoft Enterprises Ltd.