iPhone XR/XS: AVAssetExportSession status failed with error

721 Views Asked by At

I'm using AVAssetExportSession to rexport a video edited by Adobe Premiere CC, It's specific on iPhone XR/XS, I have exportSession.status failed with error :

Error Domain=AVFoundationErrorDomain Code=-11821 “Cannot Decode” UserInfo={NSLocalizedFailureReason=The media data could not be decoded. It may be damaged., NSLocalizedDescription=Cannot Decode, NSUnderlyingError=0x28338c4e0 {Error Domain=NSOSStatusErrorDomain Code=-16977 “(null)“}}

The video can be well played on native iPhone Player. On the others device (iPhone X, 6, 7, 8) no export error problem

2

There are 2 best solutions below

1
On

I got similar problem. But my video was download from web.

In my code, I change the quality setting "presetName:" from "AVAssetExportPresetMediumQuality" to "AVAssetExportPresetPassthrough".

Hope this helps.

0
On

I've encountered the same problem, with exactly the same combination of hardware & software (iPhone XS (& iPad Pro 11'') / video exported by Adobe Premier).

It's not much, but during testing possible solutions I've found that it's the very end of the video that's AVAssetExportSession has troubles encoding.

So, for example, if I'd shorten export time range by 4 frames (or ~0.17 seconds on 24 fps), then the video would be exported without an issue. Shortening by 3 frames seems to work in some cases, but not reliable. Shortening by 2 - doesn't work.

It's an awful solution, but I didn't find anything better yet.