[FFmpeg-devel] Adding ICC profile support to MOV decode/encode

Hello Vectronic hello.vectronic at gmail.com
Wed Sep 18 19:29:15 EEST 2019


> On 18 Sep 2019, at 15:27, Derek Buitenhuis <derek.buitenhuis at gmail.com> wrote:
> 
> On 18/09/2019 10:30, Hello Vectronic wrote:
>> I need to implement support for reading and writing ICC profiles which can be stored in MOV/MP4 sample descriptor colour information.
> 
> Does anything exist that can even consume or produce these sorts of files?
> 
> I looked a while back, and found literally nothing that could support these.
> 
> - Derek

It is possible to write and read this with VideoToolbox: https://developer.apple.com/documentation/videotoolbox/kvtcompressionpropertykey_iccprofile?language=objc

Here is a snippet of Swift code showing usage:


VTCompressionSessionCreate(
            allocator: nil,
            width: Int32(width),
            height: Int32(height),
            codecType: codec,
            encoderSpecification: encoderSpecification,
            imageBufferAttributes: sourceImageBufferAttributes,
            compressedDataAllocator: nil,
            outputCallback: outputCallback,
            refcon: Unmanaged.passUnretained(self).toOpaque(),
            compressionSessionOut: compressionSesionOut)

VTSessionSetProperties(vtCompressionSession, 
 	propertyDictionary: [
            kVTCompressionPropertyKey_ICCProfile: colorSpace.copyICCData() as CFTypeRef,
            kVTCompressionPropertyKey_MaxKeyFrameInterval: NSNumber(value: 50)
            ] as CFDictionary)


And here is an example file: http://vectronic.io/icc-profile/icc-profile.mov

And here is the relevant standard: https://standards.iso.org/ittf/PubliclyAvailableStandards/c068960_ISO_IEC_14496-12_2015.zip






More information about the ffmpeg-devel mailing list