Wowza Community

Manipulating video with videoFrameWasCaptured

I’m trying to figure out how to manipulate the video feed using WZVideoSink, but I can’t get it to work. I’m using this example for guidance:

https://stackoverflow.com/questions/51187549/stream-video-with-bitmap-as-overlay/51609700#51609700

I’ve also tried copy-pasting the code in the WowzaGoCoderSDKSampleApp project (code below) but there is no filter on the recorded video. The method is hit for each frame as intended. Am I missing something obvious?

- (void) videoFrameWasCaptured:(nonnull CVImageBufferRef)imageBuffer framePresentationTime:(CMTime)framePresentationTime frameDuration:(CMTime)frameDuration {

    if (self.goCoder.isStreaming) {

        if (self.blackAndWhiteVideoEffect) {

            // convert frame to b/w using CoreImage tonal filter

            CIImage *frameImage = [[CIImage alloc] initWithCVImageBuffer:imageBuffer];

            CIFilter *grayFilter = [CIFilter filterWithName:@"CIPhotoEffectTonal"];

            [grayFilter setValue:frameImage forKeyPath:@"inputImage"];

            frameImage = [grayFilter outputImage];

            CIContext * context = [CIContext contextWithOptions:nil];

            [context render:frameImage toCVPixelBuffer:imageBuffer];

        }

    }

}<br>

The issue was that I’d registered the videoSink after I set the camera view when configuring the wowzaGoCoder object.