fix rotation of generated video
This commit is contained in:
1 parent
dd902d2c30
commit
fb8bd7f26e
1 file changed
+3
-2
@@ -102,7 +102,8 @@ class VideoHandler {
|
|||||||
print("Failed to get video track")
|
print("Failed to get video track")
|
||||||
throw AVError(.decodeFailed)
|
throw AVError(.decodeFailed)
|
||||||
}
|
}
|
||||||
let size = track.naturalSize.applying(track.preferredTransform)
|
let preferredTransform = track.preferredTransform
|
||||||
|
let size = track.naturalSize.applying(preferredTransform)
|
||||||
let width = Int(abs(size.width))
|
let width = Int(abs(size.width))
|
||||||
let height = Int(abs(size.height))
|
let height = Int(abs(size.height))
|
||||||
let fps = track.nominalFrameRate
|
let fps = track.nominalFrameRate
|
||||||
@@ -145,7 +146,7 @@ class VideoHandler {
|
|||||||
let filePathName = "assets/\(name)"
|
let filePathName = "assets/\(name)"
|
||||||
UIApplication.shared.change(title: NSLocalizedString("Generating Video...", comment: ""), body: String(format: NSLocalizedString("Creating %@...", comment: "the message for the current image that is being generated"), filePathName))
|
UIApplication.shared.change(title: NSLocalizedString("Generating Video...", comment: ""), body: String(format: NSLocalizedString("Creating %@...", comment: "the message for the current image that is being generated"), filePathName))
|
||||||
|
|
||||||
let ciImage = CIImage(cvPixelBuffer: imageBuffer)
|
let ciImage = CIImage(cvPixelBuffer: imageBuffer).transformed(by: preferredTransform)
|
||||||
let context = CIContext()
|
let context = CIContext()
|
||||||
if let cgImage = context.createCGImage(ciImage, from: ciImage.extent) {
|
if let cgImage = context.createCGImage(ciImage, from: ciImage.extent) {
|
||||||
if let img = cgImage.jpg {
|
if let img = cgImage.jpg {
|
||||||
|
|||||||
Reference in new issue
Block a user