In my application, I allow users to record video in portrait mode. I use this in the application, and this is normal. However, I am implementing a feature for sharing videos on Instagram, where the video should be square.
Trimming the video into a square, say, the central part, is an option, however, since the user does not take this into account when shooting video, it usually turns out to be bad.
Therefore, I would like to export the square of the video, but with the aspect ratio and with two stripes left and right. Optimally, is there a way to determine the background color (either by code or by UIImage).
The closest thing I could find is this , however I can’t use it since I don’t understand how to set up the transformation.
Example (red frame only for marking image borders):

source
share