Hi,
I am recording a video at 240 FPS within my application and saving it to the Photos app. The recorded video retains 240 FPS in the Photos app. However, after trimming the video using the Photos app and importing it back into my app, the FPS is reduced to 30 FPS.
Steps to Reproduce:
- Record a video inside the application at 240 FPS.
- Save the recorded video to the Photos app.
- Verify that the video retains 240 FPS in the Photos app.
- Trim the video using the built-in Photos app editor.
- Import the trimmed video back into the application.
- The FPS of the imported video is now reduced to 30 FPS.
Code Used for Importing Video:
I am using the following code to fetch the video from the Photos app:
let options: PHVideoRequestOptions = PHVideoRequestOptions()
options.version = .current // Using `.original` preserves FPS, but I need `.current` for other changes
options.deliveryMode = .highQualityFormat
options.isNetworkAccessAllowed = true
PHImageManager.default().requestAVAsset(forVideo: self, options: options) { (avAsset, audioMix, info) in
if let urlAsset = avAsset as? AVURLAsset {
completionHandler(urlAsset.url, self)
} else {
self.askForOriginal(completionHandler: completionHandler)
}
}
Observations:
- The original video retains 240 FPS until it is trimmed in the Photos app.
- After trimming, the FPS automatically drops to 30 FPS when imported back into the app.
- If I use
options.version = .original,
the FPS is preserved, but I need.current
to apply other modifications.
Questions:
- Is this an expected behavior of PHImageManager when requesting a video with
options.version = .current?
- Is there a way to preserve the original FPS while still using
.current?
- Are there any workarounds to extract the trimmed video without FPS reduction?
Any insights or solutions would be greatly appreciated. Thanks in advance!