AVAssetWriter append reverse

Hello there,


Given an implementation of AVCaptureVideoDataOutputSampleBufferDelegate appending an AVAssetWriterInput, or even an AVAssetWriterInputPixelBufferAdaptor to write to an AVAssetWriter :

I am trying to have a second writer to live-record a reverse copy of the recording session.

In order to do that, I am assuming that there is a maximum recording duration of, let's say 10 seconds, and I attempt to append from time t=10 to time t=0, I don't need more. However, wether it is changing the CMSampleBuffer's timing info or appending with the pixelBuffer adaptor at a specific time, appending late times before earlier times does not seem to work. Any idea if that is possible?


When calling "finishWriting" on the reverse-writer, here is the error I get:


Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed"
UserInfo={
  NSUnderlyingError=0x174058e40 { Error Domain=NSOSStatusErrorDomain Code=-16364 "(null)" },
  NSLocalizedFailureReason=An unknown error occurred (-16364),
  NSLocalizedDescription=The operation could not be completed
}
Answered by Media Engineer in 194518022

Sorry, you can't append to asset writer in reverse order, just as you can't play a QuickTime movie that goes backward in time. The underlying error you are seeing is InvalidTimeStamp.

Accepted Answer

Sorry, you can't append to asset writer in reverse order, just as you can't play a QuickTime movie that goes backward in time. The underlying error you are seeing is InvalidTimeStamp.

Thanks for your reply @bford, and I am sorry I am just replying a few month later even though read it back then.

I am then facing an memory issue keeping the way I was doing it, if you don't mind checking this topic https://forums.developer.apple.com/message/208134#208134

AVAssetWriter append reverse
 
 
Q