2021 Photos & CameraAudio & Video
WWDC21 · 20 min · Photos & Camera / Audio & Video
Explore low-latency video encoding with VideoToolbox
Supporting low latency encoders has become an important aspect of video application development process. Discover how VideoToolbox supports low-delay H.264 hardware encoding to minimize end-to-end latency and achieve new levels of performance for optimal real-time communication and high-quality video playback.
Watch at developer.apple.com ↗Code shown on screen · 2 snippets
VTCompressionSession creation
CFMutableDictionaryRef encoderSpecification =
CFDictionaryCreateMutable(kCFAllocatorDefault, 0, NULL, NULL);
CFDictionarySetValue(encoderSpecification,
kVTVideoEncoderSpecification_EnableLowLatencyRateControl,
kCFBooleanTrue)
VTCompressionSessionRef compressionSession;
OSStatus err = VTCompressionSessionCreate(kCFAllocatorDefault,
width,
height,
kCMVideoCodecType_H264,
encoderSpecification,
NULL,
NULL,
outputHandler,
NULL,
&compressionSession); New profiles
// Request CBP
VTSessionSetProperty(compressionSession,
kVTCompressionPropertyKey_ProfileLevel,
kVTProfileLevel_H264_ConstrainedBaseline_AutoLevel);
// Request CHP
VTSessionSetProperty(compressionSession,
kVTCompressionPropertyKey_ProfileLevel,
kVTProfileLevel_H264_ConstrainedHigh_AutoLevel); Resources
Related sessions
-
17 min -
24 min