I am capturing live video within the app and saving it using PHAssetChangeRequest
However, the video is saving to the camera roll at very low resolution. If I take the same exact video (same phone) from within the camera app, it saves to the camera roll at a higher resolution.
From within the app a portrait is being saved at 360X480 while the same video taken from the camera app, is saved at 720X1200.
below is the code for how the video is being saved from my app. Why the resolution drop?
PHPhotoLibrary.shared().performChanges({
PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: self.sharedManager.videoFileLocalURL)
}, completionHandler: { (saved, error) in
if error != nil
{
print ("Asset Saving Error: \(error.debugDescription)")
}
if saved == true
{
print ("Asset saved to library")
let fetchOptions = PHFetchOptions()
fetchOptions.sortDescriptors = [NSSortDescriptor(key: "creationDate", ascending: true)]
if let fetchedAsset = PHAsset.fetchAssets(with: .video, options: fetchOptions).lastObject
{
self.sharedManager.newzInfoInDraft.videoCreateDate = Date()
self.processVideo(asset: fetchedAsset)
}
else
{
print ("Cannot fetch asset from library")
}
}
else
{
print ("Asset not saved to library")
}
})
}
Update: Call to capture video
let recordActionButton = UIAlertAction(title: "Record a video", style: .destructive)
{ _ in
self.imagePickerController.sourceType = .camera
self.imagePickerController.mediaTypes = [kUTTypeMovie as String]
self.imagePickerController.delegate = self
self.present(self.imagePickerController, animated: true, completion: nil)
}
Appreciate Leo Dabus putting a direction into my head as to the nature of the problem. The one-line of code that solved the problem is below. Not relying on the perceived default is a good lesson here....
self.imagePickerController.videoQuality = .typeHigh