Is there anyway of getting CMSampleBuffers in 10bit P3 colorspace using AVCaptureVideoDataOutput (or otherwise?) at minimum 30 frames per second? I can configure AVCaptureSession to use P3 color space but in AVCaptureVideoDataOutput delegate can not get anything better than BGRA or YUV420, both of which are 8 bit formats.
Asked
Active
Viewed 670 times
1

Deepak Sharma
- 5,577
- 7
- 55
- 131
-
Can you show how you’re configuring AVCaptureSession? – Rhythmic Fistman Apr 19 '18 at 06:41
-
You just need to set sessionPreset to .photo to activate P3 colorspace, it works. But the problem is AVCaptureVideoDataOutput is unable to receive anything other than BGRA32 or YUV420, both of which are 8 bits in depth. – Deepak Sharma Apr 19 '18 at 07:43
-
Using a photo preset to configure the non-photo `AVCaptureVideoDataOutput` (or using a preset at all) seems wrong for this. How about setting `activeColorSpace` on the `AVCaptureDevice` to `P3_D65`? – Rhythmic Fistman Apr 20 '18 at 08:19
-
If you set a sessionPreset other than .photo, activeColorSpace is always going to be sRGB regardless of setting. – Deepak Sharma Apr 20 '18 at 15:12
1 Answers
3
Are you mixing colorspaces up with pixel formats? P3 colorspace doesn't specify the size of each element. You can have 8 bit per channel output in the P3 colorspace. If you want a different pixel format checkout
AVCaptureVideoDataOutput.availableVideoCVPixelFormatTypes.
That will give you a list of the available pixel formats for video output. You can then set the pixel format as follows
AVCaptureVideoDataOutput.videoSettings = [kCVPixelBufferPixelFormatTypeKey: pixelFormat]
Last time I checked the only ones available are 32 bit BGRA, 420v and 420f.

adamfowlerphoto
- 2,708
- 1
- 11
- 24
-
Yes, apparently I am mixing the two. But my question is in order for P3 color space to display colors more than sRGB, it needs more bit depth. Is there any benefit of working in P3 with 8 bit format? – Deepak Sharma Apr 20 '18 at 16:04
-
You will get a larger color range with P3 over sRGB, but the number of discreet colors doesn't increase. – adamfowlerphoto Apr 20 '18 at 16:37
-
Ok, got it. But still it's not a super set of sRGB. That is annoying. – Deepak Sharma Apr 20 '18 at 17:55
-
Indeed, all the discreet colors are in sRGB… the expanded gamut of P3 gets you all sorts of bold, flashy, and otherwise unsubtle colors. – rickster Apr 20 '18 at 18:46
-
1Okay, more seriously: color space and pixel format are *discrete*, independent concepts but closely related. P3 is a broader space than sRGB, but if you address P3 colors with 8-bit components you're still covering the same number of distinct colors (it's just a different set of colors). To truly express a superset of sRGB 8-8-8, you need a deeper pixel format for your P3-space pixel buffer, like 10-bit or half-float components. – rickster Apr 20 '18 at 18:49