As I understand you want to apply filters before sending video data and also in real time. There is no easy source code here but I could tell you path.
For real time video filters you could use GPUImage framework. It has ready to use camera GPUImageVideoCamera
class. So you need to create class which implements GPUImageInput
(it is target in terms of GPUImage) which will produce OTVideoFrame
frame from input and add it to pipeline.
Something like this:
videoCamera = [[GPUImageVideoCamera alloc] initWithSessionPreset:AVCaptureSessionPreset640x480 cameraPosition:AVCaptureDevicePositionBack];
videoCamera.outputImageOrientation = UIInterfaceOrientationPortrait;
videoCamera.horizontallyMirrorFrontFacingCamera = NO;
videoCamera.horizontallyMirrorRearFacingCamera = NO;
// filter
filter = [[GPUImageSepiaFilter alloc] init];
[videoCamera addTarget:filter];
// frame producer for OTVideoCapture
frameProducer = [[FrameProducer alloc] init];
[filter addTarget:frameProducer];
// camera view to show what we record
[filter addTarget:filterView];
Also you need custom implementation of OTVideoCapture
protocol for OpenTok itself. You could use TBExampleVideoCapture
from Lets-Build-OTPublisher sample as a start point. You need to replace camera code with above GPUImageVideoCamera
camera code to use filters in real time.