Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Debabrataroy opened this issue Sep 26, 2018 · 1 comment

Comments

@Debabrataroy
Copy link

Debabrataroy commented Sep 26, 2018

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
Copy link

@Debabrataroy Did you got any solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants