0

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?

  • When you say "merge" do you mean overlay (i.e. multiple clips on top of each other) or do you mean "stitch" - laying clips end to end. I've successfully stitched 100's of clips, but never tried merging (overlaying) more than about 5 or 6. – Tim Bull Oct 17 '17 at 22:55
  • Check out [this answer](https://stackoverflow.com/a/45257875). It seems there is a limit. – jpetrichsr Oct 18 '17 at 02:08
  • @TimBull thank you for you answer. What I am trying to do is to process all of those N videos one after another, adding them as tracks of AVVideoCompositon using insertTimeRange and defining instructions. |video1|video2|videoi|...|videoN if N = 5 - 8 everything is allright and AVAssetExport does its job great, but if N increase I can see a weird behivour since the exporter.progress goes up and down. If N goes above 17 - 18 I receive that error before even trying to start... Any idea about the cause? Can you please clarify me the right procedure to approach this goal? – Alessio Stramacci Oct 18 '17 at 08:31
  • @jpetrichsr I don't see any connections between AVPlayer and my issue. Don't you agree? – Alessio Stramacci Oct 18 '17 at 09:13
  • @AlessioStramacci, no - take a look - it says "each instance of AVMutableCompositionTrack also uses up one of these render pipelines." – jpetrichsr Oct 18 '17 at 13:58
  • @AlessioStramacci Did you solve this? same exact issue over here – Roi Mulia Jul 24 '19 at 18:52

1 Answers1

1

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!!!!