7

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

sahara108
  • 2,829
  • 1
  • 22
  • 41

3 Answers3

1

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.

agressen
  • 459
  • 1
  • 5
  • 17
1

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

Community
  • 1
  • 1
cesar
  • 141
  • 1
  • 3
0

If you are using methods insertTimeRanges or insertTimeRange, you need to ensure that the input time ranges are valid. To be more specific, you should not use the asset's duration for this, you need to get the accurate time ranges from individual asset tracks.

Use command ffprobe -show_frames path_to_file to inspect your video files, which sometimes may be very helpful.

ZLN
  • 41
  • 4