# SpsColorPatcher

class SpsColorPatcher

Patches H.264 / H.265 SPS NAL units to embed BT.709 colour metadata. Hardware encoders typically ignore MediaFormat KEY_COLOR_* when generating the SPS VUI, so we must fix the raw bytes directly. Call sites: - Recording path: patchMediaFormatColorToBt709(videoFormat) before mediaMuxer.addTrack() - Streaming path: patchSpsNalColorToBt709(spsBytes, isHevc) before onVideoInfo()

## Constructors

SpsColorPatcher
Link copied to clipboard
constructor()

## Functions

patchMediaFormatColorToBt709
Link copied to clipboard
open fun patchMediaFormatColorToBt709(format: MediaFormat)
Patches csd-0 in a MediaFormat in-place before mediaMuxer.addTrack().
patchSpsNalColorToBt709
Link copied to clipboard
open fun patchSpsNalColorToBt709(spsData: ByteBuffer, isHevc: Boolean): ByteBuffer
Patches colour_primaries / transfer_characteristics / matrix_coefficients to BT.709 (1, 1, 1) in a raw SPS NAL ByteBuffer.