 
                         success = assetWriterPixelBufferAdaptor.appendPixelBuffer(pixelBuffer, withPresentationTime: timeStamp)
 
+//                        success = self.assetWriterVideoInput?.appendSampleBuffer(sampleBuffer)
+
                         self.delegate?.writerCoordinatorDidRecording(self, seconds: self.recordingSeconds)
 
                     } else {

        }
    }

    private func makePixelBufferAdaptor(assetWriterInput input: AVAssetWriterInput,videoTrackSettings settings: [String: AnyObject]) -> AVAssetWriterInputPixelBufferAdaptor {

        let videoWidth = max(settings[AVVideoWidthKey] as! Int, settings[AVVideoHeightKey] as! Int)
        let videoHeight = min(settings[AVVideoWidthKey] as! Int, settings[AVVideoHeightKey] as! Int)

        // Use BGRA for the video in order to get realtime encoding.

        let sourcePixelBufferAttributes = [
            String(kCVPixelBufferPixelFormatTypeKey): Int(kCVPixelFormatType_32BGRA),
            String(kCVPixelBufferWidthKey): videoWidth,
            String(kCVPixelBufferHeightKey): videoHeight,
            String(kCVPixelFormatOpenGLESCompatibility): kCFBooleanTrue
        ]



                        if let videoInput = self.assetWriterVideoInput {

                            let videoWidth = Int32(videoTrackSettings[AVVideoWidthKey] as! Int)
                            let videoHeight = Int32(videoTrackSettings[AVVideoHeightKey] as! Int)
                            let videoDimensions = CMVideoDimensions(width: videoWidth, height: videoHeight)

                            self.assetWriterPixelBufferAdaptor = self.makePixelBufferAdaptor(assetWriterInput: videoInput, videoDimensions: videoDimensions)

                            if assetWriter.canAddInput(videoInput) {
                                assetWriter.addInput(videoInput)
