AVAssetReader memory pressure

Hi there,


I am currently running into an issue, I have been using a code to reverse an AVAsset by using an AVAssetReader and an AVAssetWriter, first using a typical

while let sampleBuffer = assetReaderOutput.copyNextSampleBuffer() { ... }

..however, with my iPhone 5S, using I believe a 10-to-20s video, I run into a memory issue with that code, which just crash the app.

I am not sure what would be a proper way of performing that task of reversing my asset. Would I have to do it by steps with several small reverse versions that I then adds up? What would I base the "small step"?

Thanks in advance for your help.

Accepted Reply

I did find a solution and it seems to be working find : I manage my own presentation times starting with zero, and only collect sample buffers by segments of 1 second (or less for edge case) starting by the end of the video, and once append into my asset writer input, reading the previous segments and so on.

Replies

I did find a solution and it seems to be working find : I manage my own presentation times starting with zero, and only collect sample buffers by segments of 1 second (or less for edge case) starting by the end of the video, and once append into my asset writer input, reading the previous segments and so on.

I have the same problem. Can you show me some sample code?