Unable to export slow mo video with hevc1920x1080 preset and AVExportSession

Hello,

I'm implementing video export for uploading to the server and I'm using AVExportSession for achieving it. The session is using AVAssetExportPresetHEVC1920x1080 for all videos. The issue, I'm facing, is the failure to export with the AVFoundation -11800 Unknown error, when I'm trying to export slow motion video to the URL.

The export URL has a defined file extension and it is guaranteed, that there is no file at the URL.

The AVAsset (AVComposition) for export is requested using the Photos framework with the following video export options:

let videoOptions = PHVideoRequestOptions()

videoOptions.isNetworkAccessAllowed = true
videoOptions.version = .current
videoOptions.deliveryMode = .highQualityFormat

return videoOptions

The only workaround, I found is to export with the AVAssetExportPresetMediumQuality or AVAssetExportPreset1920x1080. None of these approaches suits me, because both presets will encode video to H.264 format, which doesn't make a lot of sense since the video is originally encoded in HEVC format.

Is there something, what I'm missing or is it a system bug?

Thanks

Can you print the full error object? That will show us the underlying error, which will give more of a clue as to what went wrong.

Hi,

here is the session

Optional(<AVAssetExportSession: 0x2816e4af0, asset = <AVComposition: 0x2814dda40 tracks = (

    "<AVCompositionTrack: 0x2814db940 trackID = 1, mediaType = vide, editCount = 13>",

    "<AVCompositionTrack: 0x2814a8800 trackID = 2, mediaType = soun, editCount = 13>"

)>, presetName = AVAssetExportPresetHEVC1920x1080, outputFileType = public.mpeg-4)

and here is the the error

Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo={NSLocalizedFailureReason=An unknown error occurred (-16364), NSLocalizedDescription=The operation could not be completed, NSUnderlyingError=0x281b0c8a0 {Error Domain=NSOSStatusErrorDomain Code=-16364 "(null)"}}

I have found this thread with the same error code, that the issue can be connected with timeRange. Hence, I have tested export without specifying the timeRange property of AVExportSession. It fails with the same error.

If you can package this into a test app and send it to us, please file a bug report using the feedback assistant. At the very least, I'd expect a more specific error from AVAssetExportSession.

Unable to export slow mo video with hevc1920x1080 preset and AVExportSession
 
 
Q