rFlex / SCRecorder

iOS camera engine with Vine-like tap to record, animatable filters, slow motion, segments editing
Apache License 2.0
3.06k stars 583 forks source link

After applying filter on video it automatically add black screen in right side. #425

Open Debabrataroy opened 5 years ago

Debabrataroy commented 5 years ago

whatsapp image 2018-09-26 at 11 13 19 am

whatsapp image 2018-09-26 at 11 13 16 am

My code is:

{ let movieURL = VideoAlbumManager.sharedSingleton().returnPathUrl(effcetVideoUrl) let aVideoAsset = AVURLAsset.init(url: effcetVideoUrl)

        let exportSession = SCAssetExportSession(asset: (self.recordSession?.assetRepresentingSegments1(aVideoAsset))!)
        exportSession.videoConfiguration.filter = SCFilter(ciFilterName: modelClass.effectFile)
        exportSession.videoConfiguration.preset = SCPresetHighestQuality
        exportSession.audioConfiguration.preset = SCPresetHighestQuality
        exportSession.videoConfiguration.maxFrameRate = 35
        exportSession.outputUrl = movieURL!
         exportSession.outputFileType = AVFileType.mp4.rawValue
        exportSession.delegate = self
        exportSession.contextType = SCContextType(rawValue: 0)!
        print("exportSession.outputUrl:-\(String(describing: movieURL!))")

        DispatchQueue.main.async {
        let overlay = SCWatermarkOverlayView()
        overlay.date = self.recordSession?.date
        exportSession.videoConfiguration.overlay = overlay
        print("Starting exporting")
        }
        let time: CFTimeInterval = CACurrentMediaTime()
       exportSession.exportAsynchronously(completionHandler: {
            print("Export")
            if !exportSession.cancelled {
                print("Completed compression in \(CACurrentMediaTime() - time)")
            }

            let error: Error? = exportSession.error
            if exportSession.cancelled {
                print("Export was cancelled")
            }
            else if error == nil {

                    DispatchQueue.main.async(execute: {() -> Void in
                        self.playerView.clean()
                        self.playerView .removeFromSuperview()
                        self.stopAnimating()
                        print("dfr==================f\(exportSession.outputUrl!)")
                        self.effectVideoUrl = exportSession.outputUrl! as NSURL
                        self.playerView = GUIPlayerView(frame: CGRect(x: CGFloat(0), y: CGFloat(105), width:UIScreen.main.bounds.size.width, height:UIScreen.main.bounds.size.height/2))//1
                        self.playerView.delegate = self
                        self.view.addSubview(self.playerView)//2
                        self.playerView.videoURL = exportSession.outputUrl!
                        self.playerView.prepareAndPlayAutomatically(false)
                        self.playerView .stop()
                    })

            }else {
                DispatchQueue.main.async(execute: {() -> Void in
                    self.stopAnimating()
                    print("elseelseelseerrorerrorerror:66666-\(String(describing: error))")
                })
            }

        })
    }

Please help me to figure out

NileshKalathiya commented 5 years ago

@Debabrataroy Did you got any solution?