VTCompressionSession
An object that compresses video data.
Overview
A compression session supports the compression of a sequence of video frames. Here’s the workflow:
Create a compression session using VTCompressionSessionCreate(allocator:width:height:codecType:encoderSpecification:imageBufferAttributes:compressedDataAllocator:outputCallback:refcon:compressionSessionOut:).
Optionally, configure the session with your desired Compression Properties by calling VTSessionSetProperty(_:key:value:) or VTSessionSetProperties(_:propertyDictionary:).
Encode video frames using VTCompressionSessionEncodeFrame(_:imageBuffer:presentationTimeStamp:duration:frameProperties:sourceFrameRefcon:infoFlagsOut:) and receive the compressed video frames in the session’s VTCompressionOutputCallback.
To force the completion of some or all pending frames, call VTCompressionSessionCompleteFrames(_:untilPresentationTimeStamp:).
When you finish with the compression session, call VTCompressionSessionInvalidate(_:) to invalidate it and CFRelease to free its memory.
Topics
Creating a Session
Configuring a Session
Encoding Frames
VTCompressionSessionGetPixelBufferPool(_:)VTCompressionSessionPrepareToEncodeFrames(_:)VTCompressionSessionEncodeFrame(_:imageBuffer:presentationTimeStamp:duration:frameProperties:sourceFrameRefcon:infoFlagsOut:)VTCompressionSessionEncodeFrame(_:imageBuffer:presentationTimeStamp:duration:frameProperties:infoFlagsOut:outputHandler:)VTCompressionSessionCompleteFrames(_:untilPresentationTimeStamp:)
Encoding Multi-Image Frames
VTIsStereoMVHEVCEncodeSupported()VTCompressionSessionEncodeMultiImageFrame(_:taggedBuffers:presentationTimeStamp:duration:frameProperties:infoFlagsOut:outputHandler:)
Performing Multiple Passes
VTCompressionSessionBeginPass(_:flags:_:)VTCompressionSessionEndPass(_:furtherPassesRequestedOut:_:)VTCompressionSessionGetTimeRangesForNextPass(_:timeRangeCountOut:timeRangeArrayOut:)