`PHAssetChangeRequest.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, dev forum, SO, blogs, and general google to no avail

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

The resolution-fps-ratio combinations and their 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

Have you got any clue what the issue might be?

EDIT #4

Ok this one came back to bite me again, and I probably spent another two hours trying to figure out how it regressed since the code was not touched and previously confirmed working. I initially thought it had to be device or encoding related. I ended up "fixing" it, but it makes zero sense to me. The issue was resolved after I appended .mov to the local file that was being used to store the remote video after downloading. Why appending an arbitrary extension to the file path makes a difference is beyond me.

let documentsURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0]
let temporaryFilename = "\(ProcessInfo().globallyUniqueString).mov"
let fileURL = documentsURL.appendingPathComponent(temporaryFilename)

`creationRequestForAssetFromVideo(url:)` fails |Apple Developer , We have tested the issue on iPhone X, iPhone 6, and iPhone SE. The. `​creationRequestForAssetFromVideo(url:)` fails for high FPS videos on iPhone SE​. 1361 Views 1 Reply performChanges {; PHAssetChangeRequest. 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

I had this issue as well. I solved it by couching the request inside an authorization block. Once the user has responded to the prompt, your performChanges block will be invoked and it should succeed:

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

fails for high FPS videos on iPhone SE, `PHAssetChangeRequest.creationRequestForAssetFromVideo(url:)` fails for high FPS videos on iPhone SE. 2018-01-13 20:33 Oyvindkg imported from  I've also tried running the videos through qt-faststart and MP4Box to no avail. The behaviour happens in both iOS Chrome and Safari, both just show video box with a playbutton and a line throught it, in the event I get it to not show the line through it it attempts to load QuickTime and fails with "Operation could not be completed".

I have been battling with this obscure error for a while, and just found the solution.

What fixed it was: I had to make sure that the Width x Height of the exported image I was using to compose the video through: AVAssetExportSession, matched the quality setting which was used. My code was resizing the images to 1200 x 1920 (which is an incorrect resolution for my purposes). The video dimensions being produced were 1080 x 1920. So it the AVAssetExportSession was able to export the images with the wrong resolution just fine, but that video would not be savable to the gallery, resulting in this generic error. As soon as I used the correct resolution images (1080w x 1920h), the export using PHPhotoLibrary.shared().performChanges works just fine on the iPhone 5s and other phones.

iOS 13.2 finally lets you change video resolution in the camera app , In a iOS app, how to share photos with another iCloud user without sharing the full UIImage, having The edited media are saved with calls to PHAssetChangeRequest. creationRequestForAssetFromVideo(url:)` fails for high FPS videos on iPhone SE We have tested the issue on iPhone X, iPhone 6, and iPhone SE. Get the most out of your Galaxy S9 or S9 Plus right out of the box when you adjust settings for the display, home screen, battery and more.

ios, Apple finally has added the option to change the resolution and frame rate of video recordings in the camera app in iOS 13.2, fixing one of the  Video on devices like the iPod, iTouch and iPhone look great because of their MPEG-4 H.264 format. The good news is that there are tons of videos that you can purchase from the iTunes store, but

How to Play, Record, and Merge Videos in iOS and Swift , Am primit rapoarte de probleme cu înregistrarea video slow motion în aplicația noastră. Am testat problema pe iPhone X, iPhone 6 și iPhone SE. Cele 6 și X  More tech news and reviews at -- http://www.yugatech.com Get YugaTech Merch here! -- https://c.lazada.com.ph/t/c.wKK?url=https%3A%2F%2Fwww.lazada.com.ph%2Fsh

one hot related queries in StackoverflowXchanger, Learn the basics of working with videos on iOS with AV Foundation in You'll play, record, and even do some light video editing! You get the media type of the selected media and URL. saved" : "Video failed to save" let alert = UIAlertController(title: title, performChanges({ PHAssetChangeRequest. The video itself isn't shot in "slomo", so to speak. Rather, it's shot at 120 frames per second, a typically higher frame rate than normal video recording. This is significant because if you were to playback that video at 30 fps, the videos would appear to be playing in smooth slow motion because there is 4 times the frames to display.

Comments
  • Sounds odd enough (and reproducible enough) to report to Apple?
  • I am getting this problem on all high FPS video files exported. Did you ever find a solution for this?
  • We're still looking into it. If we consider both confirmed and unconfirmed error reports, it looks like the issue is present on SE, 6, 6+, and 6S+. If we also assume that 6S is affected, it occurs on all models older than 7. We're currently trying to figure out what changed between 6 and 7 to locate potential perpetrators (e.g. new wide colour space).
  • I am seeing this same function fail to store a video if the call to creationRequestForAssetFromVideo prompts an authorization message.
  • For me this issue occurs on an iPhone 5s Simulator. I tried about 10 different solutions so far. Dispatch, video quality export setting, video length, different video contents, permission wrapper around the block. The same video works on other simulators or real devices - but not reliably. Other videos fail on other devices.... Note, my video is produced by AVExportSession so that adds a whole layer of complexity in regards what could be wrong with it.
  • This was it! Thank you ❤️