From f458021a0ff5d33ba386501618421c9700976e74 Mon Sep 17 00:00:00 2001 From: Danil Gontovnik Date: Thu, 4 Mar 2021 13:31:28 +0000 Subject: [PATCH] Fix scaling --- Sources/NextLevelSessionExporter.swift | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/Sources/NextLevelSessionExporter.swift b/Sources/NextLevelSessionExporter.swift index b56338f..3091e73 100644 --- a/Sources/NextLevelSessionExporter.swift +++ b/Sources/NextLevelSessionExporter.swift @@ -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()