Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions Sources/NextLevelSessionExporter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -529,22 +529,6 @@ extension NextLevelSessionExporter {
}
videoComposition.renderSize = naturalSize

// center the video

var ratio: CGFloat = 0
let xRatio: CGFloat = targetSize.width / naturalSize.width
let yRatio: CGFloat = targetSize.height / naturalSize.height
ratio = min(xRatio, yRatio)

let postWidth = naturalSize.width * ratio
let postHeight = naturalSize.height * ratio
let transX = (targetSize.width - postWidth) * 0.5
let transY = (targetSize.height - postHeight) * 0.5

var matrix = CGAffineTransform(translationX: (transX / xRatio), y: (transY / yRatio))
matrix = matrix.scaledBy(x: (ratio / xRatio), y: (ratio / yRatio))
transform = transform.concatenating(matrix)

// make the composition

let compositionInstruction = AVMutableVideoCompositionInstruction()
Expand Down