Contents

VTCompressionSession

An object that compresses video data.

Overview

A compression session supports the compression of a sequence of video frames. Here’s the workflow:

  1. Create a compression session using VTCompressionSessionCreate(allocator:width:height:codecType:encoderSpecification:imageBufferAttributes:compressedDataAllocator:outputCallback:refcon:compressionSessionOut:).

  2. Optionally, configure the session with your desired Compression Properties by calling VTSessionSetProperty(_:key:value:) or VTSessionSetProperties(_:propertyDictionary:).

  3. Encode video frames using VTCompressionSessionEncodeFrame(_:imageBuffer:presentationTimeStamp:duration:frameProperties:sourceFrameRefcon:infoFlagsOut:) and receive the compressed video frames in the session’s VTCompressionOutputCallback.

  4. To force the completion of some or all pending frames, call VTCompressionSessionCompleteFrames(_:untilPresentationTimeStamp:).

  5. 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

Encoding Multi-Image Frames

Performing Multiple Passes

Invalidating a Session

Accessing the Type Identifier

Data Types

See Also

Compression