Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 7: Strange AVAssetExportSession bug

I have used AVAssetExportSession to join 2 video files. It works fine in iOS 6 but has very strange bug in iOS 7. Let me explain this bug. I have 2 video files, the first video is 8 seconds duration and the second is 81 seconds duration. In iOS7, it will be fine if I do the second + the first. But if I do the first + the second, it will be error:

Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo=0x176cb5c0 {NSLocalizedDescription=The operation could not be completed, NSUnderlyingError=0x176ca000 "The operation couldn’t be completed. (OSStatus error -12633.)", NSLocalizedFailureReason=An unknown error occurred (-12633)}

I have checked exportPresetsCompatibleWithAsset and supportedFileTypes. There is no problem with it. Could anyone tell how to fix this? Any help would be appreciated.

Does anyone know this bug :(. I provide 2mp4 files which cause the bug: test 1, test 2. Do join "test 2" + "test 1" is fine, but do "test 1" + "test 2" will cause an error. It only happens in iOS7

like image 273
sahara108 Avatar asked Dec 18 '13 04:12

sahara108


Video Answer


2 Answers

I found that you can replace AVAssetExportSession with SDAVAssetExportSession. You can then specify settings instead of using presets which provide different results across different devices.

I had to change __weak typeof(self) wself = self; to __weak SDAVAssetExportSession * wself = self; on line 172 of SDAVAssetExportSession.m.

like image 113
agressen Avatar answered Oct 14 '22 03:10

agressen


I had an "unknown error occurred (-12633)" message.

Found the answer to be adding two samples with same timestamp.

Apparently error -12633 is an InvalidTimestamp.

See this SO post -> AVAssetWriter unknown error

like image 36
cesar Avatar answered Oct 14 '22 02:10

cesar