How i will setup ratio in video swift?

 

var composition = AVMutableComposition()
let vidtrack = composition.tracks(withMediaType: .video)[0]
let sz = vidtrack.naturalSize

//set ration here
let rect = AVMakeRect(aspectRatio: CGSize(width: 16, height: 9), insideRect: CGRect(origin: .zero, size: CGSize(width: sz.width, height: sz.height)))
  • Facebook: 16:9 or 9:16 (max upload 4k – 3840 x 2160)
  • Instagram: 16:9 or 9:16 (max upload 1080p)
  • Twitter: 16:9 (max upload 1080p)
  • Snapchat: 9:16 (1080 x 1920)
  • YouTube: 16:9 (max upload 4k – 3840 x 2160)

27 thoughts on “How i will setup ratio in video swift?

Leave a Reply

Your email address will not be published. Required fields are marked *