0 Replies
      Latest reply on Mar 11, 2020 4:45 PM by matt_8457814
      matt_8457814 Level 1 Level 1 (0 points)

        I'm trying to get some clarity on what dictates the format of an CVPixelBuffer. I obtain the buffer for a stream using AVPlayerItemVideoOutput.copyPixelBuffer(), and have seen that on a simulator the format is BGRA, and on a real device it is 420v. What decides on the format of the PixelBuffer?

         

        On a simulator the pixel buffer has the following properties:

            Height = 1080;
            IOSurfaceCoreAnimationCompatibility = 1;
            PixelFormatType = 1111970369;
            Width = 1920;
        } propagatedAttachments={
            AlphaChannelIsOpaque = 1;
            CVFieldCount = 1;
            CVImageBufferColorPrimaries = "ITU_R_709_2";
            CVImageBufferTransferFunction = "ITU_R_709_2";
            CVImageBufferYCbCrMatrix = "ITU_R_709_2";
            CVPixelAspectRatio =     {
                HorizontalSpacing = 1;
                VerticalSpacing = 1;
            };
            QTMovieTime =     {
                TimeScale = 90000;
                TimeValue = 210000;
            };
        } nonPropagatedAttachments={
        }>

        And on the real device:

        
        
        <attributes={
            ExtendedPixelsBottom = 24;
            ExtendedPixelsLeft = 0;
            ExtendedPixelsRight = 16;
            ExtendedPixelsTop = 0;
            PixelFormatDescription =     {
                BitsPerComponent = 8;
                ComponentRange = VideoRange;
                ContainsAlpha = 0;
                ContainsGrayscale = 0;
                ContainsRGB = 0;
                ContainsYCbCr = 1;
                FillExtendedPixelsCallback = {length = 24, bytes = 0x0000000000000000d886649d010000000000000000000000};
                IOSurfaceCoreAnimationCompatibility = 1;
                IOSurfaceCoreAnimationCompatibilityHTPCOK = 1;
                IOSurfaceOpenGLESFBOCompatibility = 1;
                IOSurfaceOpenGLESTextureCompatibility = 1;
                OpenGLESCompatibility = 1;
                PixelFormat = 875704438;
                Planes =         (
                                {
                        BitsPerBlock = 8;
                        BlackBlock = {length = 1, bytes = 0x10};
                    },
                                {
                        BitsPerBlock = 16;
                        BlackBlock = {length = 2, bytes = 0x8080};
                        HorizontalSubsampling = 2;
                        VerticalSubsampling = 2;
                    }
                );
            };
        } propagatedAttachments={
            CVFieldCount = 1;
            CVImageBufferChromaLocationBottomField = Left;
            CVImageBufferChromaLocationTopField = Left;
            CVImageBufferColorPrimaries = "ITU_R_709_2";
            CVImageBufferTransferFunction = "ITU_R_709_2";
            CVImageBufferYCbCrMatrix = "ITU_R_709_2";
            CVPixelAspectRatio =     {
                HorizontalSpacing = 1;
                VerticalSpacing = 1;
            };
            QTMovieTime =     {
                TimeScale = 90000;
                TimeValue = 1059000;
            };
        } nonPropagatedAttachments={
        }>