Re: CVPixelBuffer and Color profiles
Re: CVPixelBuffer and Color profiles
- Subject: Re: CVPixelBuffer and Color profiles
- From: Kevin Meaney <email@hidden>
- Date: Tue, 20 Jan 2015 01:40:51 +0000
And what I wrote is here:
https://github.com/SheffieldKevin/attributesforpreset/blob/master/attributesforpreset/output.txt
Sent from my iPad
> On 20 Jan 2015, at 01:39, Kevin Meaney <email@hidden> wrote:
>
> Forgot to mention. I wrote a little something a few days ago that iterates through the export presets and prints out the audio and video settings.
>
> It uses a private Apple API so it's not for production code but the output is useful to look at. It was the output from this command line tool that led me to the Wikipedia pages.
>
> Kevin
>
> Sent from my iPad
>
>> On 19 Jan 2015, at 17:53, Quincey Morris <email@hidden> wrote:
>>
>>> On Jan 19, 2015, at 04:02 , Kevin Meaney <email@hidden> wrote:
>>>
>>> What I'd like to be able to do is to compare profiles obtained this way with what I think must be AVFoundation's equivalent e.g.:
>>>
>>> AVVideoColorPropertiesKey : [
>>> AVVideoColorPrimariesKey : AVVideoColorPrimaries_ITU_R_709_2,
>>> AVVideoTransferFunctionKey : AVVideoTransferFunction_ITU_R_709_2,
>>> AVVideoYCbCrMatrixKey : AVVideoYCbCrMatrix_ITU_R_601_4
>>> ],
>>>
>>> But the documentation is so poor, I do not understand what things like AVVideoColorPrimaries_ITU_R_709_2 mean, Apple docs don't help and my duck duck go searches haven't helped.
>>
>> Yes, this sucks, but it’s not quite Apple’s fault. This area (colorspaces) is a morass of disconnected information, and you have no real alternative to putting it together yourself. Each information source has different assumptions about your prior knowledge, your intentions and your workflow, and so doesn’t bother to connect its information to anything else. In many cases, you can’t even tell for sure which *direction* data is moving, let alone what’s happening to it.
>>
>> Wikipedia is a good place to start. “ITU_R_709_2” refers to ITU Rec. BT-709:
>>
>> http://en.wikipedia.org/wiki/Rec._709
>>
>> “ITU_R_601” is ITU Rec. BT-601:
>>
>> http://en.wikipedia.org/wiki/Rec._601
>>
>> These are broadcast TV standards, and therefore (of course) integral to movie-making, because … kittens. 709 is HD, 601 is SD. Color primaries are a way of describing a color space, so (in combination with information from another color space) can be used to derive a method of converting from one color space to another. Transfer functions and matrixes are each an entire method of converting HD or SD colors to RGB. (RGB in what colorspace? Beats me. Just RGB, because … fluffy kittens.)
>>
>>> When I get info about a movie file in Finder some will include a color profile name e.g.: HD (1-1-1)
>>> If I get info for an image file created from a movie using AVAssetImageGenerator then the profile name is: Composite NTSC. But I have no idea how to get this information in code. CGColorSpaceCopyName doesn't work as it is only returns a string from a CGColorSpace created with CGColorSpaceCreateWithName.
>>>
>>> What I'd like to know is, is the color profile of the image generated from an imported movie the same as the color profile equivalent for the movie (see AVFoundation color property keys above) I'm creating from individual frames? It would be ideal if I could keep everything using the same profile color space in my processing pipeline.
>>
>> Because different color space names may imply different underlying color space conversion technologies, about all a mere mortal can do is compare names. However, I’m not sure what “keep” means in that last sentence. If you have an input image file, it already has a color space (explicit or implied). Your output movie has a color space that you specified when you started. If they don’t match, there’s nothing you can do to “keep” them the same, you simply have to do a conversion.
>>
>> It’s the AVAssetWriter’s job to make the conversion for you. The point is you don’t *want* to deal with anything beyond that.
>>
>> “It’s kittens all the way down.”
>>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden