`creationRequestForAssetFromVideo(url:)` fails for high FPS videos on iPhone SE

We have gotten reports of issues with recording slow motion videos in our application. We have tested the issue on iPhone X, iPhone 6, and iPhone SE. The 6 and the X both work fine, but the SE fails when attempting to add the recorded video to Photos.


The video file to be added to Photos:

  • h.264 with recommended settings
  • Quicktime (.mov)
  • 120/200/240 FPS
  • No custom metadata
  • AAC audio with recommended settings


Our code adding the video:


PHPhotoLibrary.shared().performChanges {
    PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: url)
}


The returned error doesn't provide much useful information, which appears to be a recurring issue when working with Photos.


Error Domain=NSCocoaErrorDomain Code=-1 "(null)"


We apply an aspect ratio to the videos using the encoder setting's clean aperture parameters. Apparently, changing the video aspect ratio affects the result (see the list at the bottom).



We have tried:

  • Because the aspect ratio affected the result, we thought the issue might be related to the amount of data to be stored. Reducing the bitrate/file size did not change anything
  • Perhaps something was still using the file? We waited a few seconds before adding the file, but were awarded the same errors
  • Scoured the docs, this forum, SO, blogs, and general google to no avail


Once again - everything works fine on iPhone X and 6.



We're stuck, and the deadline is closing fast. Have you got any clue what the issue might be?



- Oyvind




The resolution-fps-ratio combinations and the result:


1080p

  • 120@16:9 - Error
  • 120@2.35 - Error
  • 120@1:1 - OK


720p

  • 240@16:9 - Error
  • 240@2.35 - Error
  • 240@1:1 - OK
  • 200@16:9 - Error
  • 200@2.35 - OK
  • 200@1:1 - OK
  • 120@16:9 - OK
  • 120@2.35 - OK
  • 120@1:1 - OK

Replies

Similar issue with iPhone X.


OK: 24@1080p, 24@4K, 30@1080p, 30@4K, 60@1080p, 60@4K, 120@1080p

Error every time: 240@1080p