pub unsafe static kVTCompressionPropertyKey_MultiPassStorage: &'static CFStringVTCompressionProperties only.Expand description
Enables multi-pass compression and provides storage for encoder-private data.
Some video encoders support multi-pass encoding. To determine whether a VTCompressionSession supports multi-pass encoding, you can inspect the dictionary returned by VTSessionCopySupportedPropertyDictionary to see if it contains kVTCompressionPropertyKey_MultiPassStorage.
To enable multi-pass encoding, set the kVTCompressionPropertyKey_MultiPassStorage property to a VTMultiPassStorage object, which you can create by calling VTMultiPassStorageCreate. Then make one or more passes over the source frames. Bracket each pass with a call to VTCompressionSessionBeginPass at the beginning and VTCompressionSessionEndPass at the end.
In the first pass of multi-pass encoding, call VTCompressionSessionEncodeFrame for every source frame (just as in single-pass encoding). At the end of every pass, call VTCompressionSessionEndPass. This may take some time as the video encoder determines whether it can improve the encoding by performing another pass. If the user cancels encoding during this time, call VTCompressionSessionInvalidate to interrupt the processing. VTCompressionSessionEndPass will indicate via the furtherPassesRequestedOut argument whether the video encoder would like to perform another pass. There is no particular bound on the number of passes the video encoder may request, but the client is free to disregard this request and use the last-emitted set of frames.
If *furtherPassesRequestedOut is set to true and you want to perform another pass, call VTCompressionSessionGetTimeRangesForNextPass to determine the time ranges for the next pass. Only the source frames within these time ranges need to be passed to VTCompressionSessionEncodeFrame; the video encoder is satisfied with the already-emitted compressed frames outside these ranges and they can be kept for the final output.
In second and successive passes, you must pass identical source frames, frame properties and timestamps to VTCompressionSessionEncodeFrame as in the first pass, with the exception that frames not in the requested time ranges should be skipped.
You can create and use a VTFrameSilo object to merge sequences of compressed frames across passes during multi-pass encoding.
See also Appleās documentation