Fill and Fit video transformation
See original GitHub issueIt looks to be not really obvious how to transform video size to Fill or Fit the new requested frame size. Will appreciate any guidance on how it’s possible to do that in a proper way.
For example, I have a video with the following params:
sourceWidth = 2160
sourceHeight = 3840
rotation = -0.0
and I’m willing to transform it to the following size and fill the frame:
width = 1080
height = 592
This code will work for me:
Transform(
PointF(1 + sourceWidth.toFloat() % width, (sourceHeight.toFloat() / height) / (sourceWidth / width)),
PointF(0.5f, 0.5f),
rotation,
)
However, the same logic won’t work for:
sourceWidth = 720
sourceHeight = 1280
rotation = -90.0
Even assuming we are rotating the video from 90 to 0 degrees I’ve tried to replace x with y, but still no luck. The frame is being stretched.
There are many different scenarios of transformation I need to handle such:
- Square video (FILL/FIT)
- Portrait video 16/9 (FILL/FIT)
- Landscape video 9/16 (FILL/FIT)
- Original video size (FILL/FIT) where initial size is determined by the first uploaded video. All these options could be applied for video sets with different video sizes, so I need some generic logic here to calculate the final transformation.
Issue Analytics
- State:
- Created a year ago
- Comments:12 (4 by maintainers)
Top Results From Across the Web
How to Make your Clips Fit to Frame, Fit to Width & Height in ...
In this video tutorial, I show you how to make your clips or images fit the frame of the viewing window automatically for...
Read more >Video Resizer Online - Clideo
Change video dimensions for free with ready presets for Instagram, Facebook, YouTube, Twitter, Snapchat, LinkedIn, and Pinterest.
Read more >Dynamically Resizing and Cropping Videos - Cloudinary
Resize and crop mode examples; fill; fill_pad; crop; scale; fit ... Resizing the video to 200 x 200 pixels, using crop, scale, fill...
Read more >How to Change the Aspect Ratio of your Videos for Free?
How to Change Aspect Ratio in Windows 10. Step 1: Open Animotica; Step 2: Change Your Aspect Ratio; Step 3: Apply Fit/Fill; Step...
Read more >Resize, move, and rotate clips in Final Cut Pro - Apple Support
In Final Cut Pro, use the Transform effect to resize, rotate, and move video or still-image clips.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, please close it.
On Mon, Nov 7, 2022, 4:52 PM Izzat Bahadirov @.***> wrote:
@izzytwosheds thanks for the explanation! I guess it works for me when I’m setting rotation to 0 in the target track object. I’ll keep testing and will let you know if something won’t work as expected.