I've looked around and can't figure this out.
I want to resize an AVAsset
using AVExportSession
to an given width, height.
I've looked into AVMutableVideoComposition.renderSize
and using a scaling transform on AVMutableVideoCompositionLayerInstruction
but neither of these produce expected results (stretching/cropping the final output in weird ways).
For example:
- I have a source video that is
640x320
and I want to scale it down to320x160
. - I set the renderSize to
CGSizeMake(320.0, 160.0)
- I set the transform to
CGAffineTransformMakeScale(0.5, 0.5)
- I get the following output where the video isn't scaled to the appropriate size (looks too big), stretched, and not centered (cropped).
Any idea what is going on?