iosswiftavfoundationmetalavassetwriter

Does anyone know why the video file written using MTLTextures is not readable by AVAsset classes


I am trying to use MTLTextures to render a video using AVAssetWriter. but some how the file is getting corrupt. can someone help me how to fix this. The reference to the code I am using is here and I am able to see the file is being written and has some data in it.. for 5 seconds of recording 9.6 MB, so something is being written to it but Its not being able to be read by any way. here are the errors I see image showing errors I hope someone can help me soon on this. thanks in advance


Solution

  • The issue was regarding buffers missing out the sequence of execution due to asynchronous calls, thats why I made everything in sync using synchronous dispatch queues and also used semaphores to take extra control over situation when needed