I'm trying to export a series of JPG images into a H264 movie (ideally it would be a motion JPEG movie, but unfortunately out AVAssetWriter
does not support this codec). The images originate from a professional surveillance camera with VFR (variable frame rate), hence I compute the CMTime
based on the time they have been captured, which results in a non-constant frame rate.
When I do this, the AVAssetWriter always fails to render the movie:
Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo={NSLocalizedFailureReason=An unknown error occurred (-16364), NSLocalizedDescription=The operation could not be completed, NSUnderlyingError=0x604000245a90 {Error Domain=NSOSStatusErrorDomain Code=-16364 "(null)"}}
When I change the CMTime instances to be e.g.
CMMakeTime( frameIndex * 150, 600 )
it works, albeit resulting in a slightly wrong output.
Any idea how I could fix this? Is AVAssetWriter supposed to support that scenario?