Seeing this with watermark image and text layers that each back a UIView

            // Create the video layer.
            let videolayer = CALayer()
            videolayer.shouldRasterize = true
            videolayer.rasterizationScale = UIScreen.main.scale
            videolayer.contentsScale = UIScreen.main.scale
            videolayer.frame = CGRect(origin: .zero, size: videoImageSize)

            // Create the parent layer.
            let parentlayer = CALayer()
            parentlayer.shouldRasterize = true
            parentlayer.rasterizationScale = UIScreen.main.scale
            parentlayer.contentsScale = UIScreen.main.scale
            parentlayer.frame = CGRect(origin: .zero, size: videoImageSize)
            parentlayer.addSublayer(videolayer)

            // Create the watermark layer
            if videoExportOptions.isLogoSelected,
               let watermarkLayer = initWatermarkLayer(
                videoSize: videoImageSize, superviewBounds: viewBounds, highlightReelType: highlightReelExportType.highlightReelType) {
                watermarkLayer.shouldRasterize = true
                watermarkLayer.rasterizationScale = UIScreen.main.scale
                watermarkLayer.contentsScale = UIScreen.main.scale
                parentlayer.addSublayer(watermarkLayer)
            }
            
            // Add all the shot detail layers to be exported.
            for detailViewLayer in detailViewLayers {
                detailViewLayer.shouldRasterize = true
                detailViewLayer.rasterizationScale = UIScreen.main.scale
                detailViewLayer.contentsScale = UIScreen.main.scale
                parentlayer.addSublayer(detailViewLayer)
            }

            // Configure the layer composition.
            let layerComposition = AVMutableVideoComposition()
            var frameRate: Float = videoCompTrack.nominalFrameRate
            if frameRate <= 0 {
                if let matchVideo = match.matchVideo {
                    frameRate = Float(matchVideo.fpsPreset.frameRate)
                } else {
                    DDLogInfo("Frame rate is negative exiting")
                    completion(nil)
                    return
                }
            }
            layerComposition.frameDuration = CMTimeMake(value: 1, timescale: Int32(frameRate))
            layerComposition.renderSize = videoImageSize

            layerComposition.animationTool = AVVideoCompositionCoreAnimationTool(
                postProcessingAsVideoLayer: videolayer,
                in: parentlayer)
            let newSize = videoImageSize != assetVideoTrack.naturalSize ? videoImageSize : nil

            if let newSize = newSize, videoExportOptions.aspectRatio == .r9_16 || videoExportOptions.aspectRatio == .r1_1 {
                let instructions = initVideoCompositionCropAndPanInstructions(videoCompositionTrack: videoCompTrack, assetVideoTrack: assetVideoTrack, aspectRatio: videoExportOptions.aspectRatio, videoShotsInfo: videoShotsInfo, newSize: newSize)
                layerComposition.instructions = instructions
            } else {
                let instructions = initVideoCompositionInstructions(
                    videoCompositionTrack: videoCompTrack, assetVideoTrack: assetVideoTrack, newSize: newSize)
                layerComposition.instructions = instructions
            }

            ...

I've tried setting shouldRasterize to false but get the same result. In a 9:16 export on iOS, the layers look clear, and this it the result I'm trying to achieve. What might explain the difference? The layers back a UILabel and UIImage which are in a XIB.

0

There are 0 best solutions below