Alessio Stramacci
Alessio Stramacci

Reputation: 63

AVAssetExport fails "cannot decode"

Hi I am facing an issue with AVAssetEXport. I am trying to combine many videos one after another, let's say 20 - 30, adding each asset as a track of VideoMutableCompositon with insertTimeFrame:

|video1|video2| ... |videoi| ... |videoN|

If I exceed 15 - 16 videos and I export,I get the following error:

failed: Error Domain=AVFoundationErrorDomain Code=-11839 "Cannot Decode" UserInfo={NSLocalizedDescription=Cannot Decode, NSUnderlyingError=0x1c8044620 {Error Domain=NSOSStatusErrorDomain Code=-12913 "(null)"}, NSLocalizedRecoverySuggestion=Stop any other actions that decode media and try again., NSLocalizedFailureReason=The decoder required for this media is busy.}

I am sure that this is not a RAM issue since I am using iphone8 plus and also xcode show a low RAM activity. If I reduce the number of videos to 5 - 8 everything works great...

Is there a limit on adding video tracks? Can anyone help me to achieve this goal?

Upvotes: 0

Views: 1303

Answers (1)

Alessio Stramacci
Alessio Stramacci

Reputation: 63

Finally I found out the cause and was my bad! The problem was that I was looping through AVMutableCompositionTrack. So that each video was on a different track and probably that caused a lack of resources. Right now I created only 2 tracks: 1 for video and 1 for audio. All my videos are stitched with time ranges.

Thank you guys!!!!

Upvotes: 1

Related Questions