title: How to modify (add filters to) the camera stream that WebRTC is sending to other peers/server
body: <p><strong>Scope</strong></p>
  
  <p>I am using RTCCameraPreviewView to show the local camera stream</p>
  
  <pre><code>    let videoSource = self.pcFactory.avFoundationVideoSource(with: nil)
      let videoTrack = self.pcFactory.videoTrack(with: sVideoSource, trackId: "video0")
  
      //setting the capture session to my RTCCameraPreviewView:
      (self.previewView as! RTCCameraPreviewView).captureSession = (videoTrack.source as! RTCAVFoundationVideoSource).captureSession
  
      stream = self.pcFactory.mediaStream(withStreamId: "unique_label")
      audioTrack = self.pcFactory.audioTrack(withTrackId: "audio0")
      stream.addAudioTrack(audioTrack)
  
      var device: AVCaptureDevice?
      for captureDevice in AVCaptureDevice.devices(withMediaType: AVMediaTypeVideo) {
          if (captureDevice as AnyObject).position == AVCaptureDevicePosition.front {
              device = captureDevice as? AVCaptureDevice
              break
          }
      }
      if device != nil &amp;&amp; videoTrack != nil {
          stream.addVideoTrack(videoTrack)
      }
  
      configuration = RTCConfiguration()
  
      configuration.iceServers = iceServers
      peerConnection = self.pcFactory.peerConnection(with: configuration, constraints: RTCMediaConstraints(mandatoryConstraints: nil, optionalConstraints: ["DtlsSrtpKeyAgreement": "true"]), delegate: self)
      peerConnection.add(stream)
  </code></pre>
  
  <p>Things are working fine as they are expected. </p>
  
  <p><strong>Problem</strong></p>
  
  <p>Now I want to take a hold of the frames from the camera and pre-process them to add some filters (sepia, b/w etc) and then relay the frames to WebRTC. After struggling through the webrtc docs I am still unable to find out where to start and what to do.</p>
  
  <p>Any kind of heads up will be highly appreciated!</p>