Silence-GitHub / BBMetalImage

A high performance Swift library for GPU-accelerated image/video processing based on Metal.
MIT License
988 stars 126 forks source link

Video Writer not completed #42

Closed barche75 closed 4 years ago

barche75 commented 4 years ago

//there is the code

print("--- writer STARTED")

    videoWriter!.start()
    print("--- source STARTED")
    videoSource?.start(progress: { _ in

    }, completion: { [ weak self ] completed in
        guard let self = self else { return }
        if completed {
            print("--- source COMPLETED")
            self.videoWriter?.finish { [weak self] in
                DispatchQueue.main.async { [weak self] in
                    guard let self = self else { return }
                    print("--- writer COMPLETED")
                    let videoItem = AVPlayerItem(url: tempVideoUrl)
                    self.videoPlayer = AVPlayer(playerItem: videoItem)
                    self.videoPlayerLayer = AVPlayerLayer(player: self.videoPlayer)
                    self.videoPlayerLayer!.frame = CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width - 32, height: UIScreen.main.bounds.height - 64)
                    self.videoPlayerLayer!.videoGravity = .resizeAspect
                    self.videoView.layer.addSublayer(self.videoPlayerLayer!)
                    self.videoPlayer?.seek(to: .zero)
                    self.videoPlayer!.play()
                    self.videoWriter = nil
                    self.videoSource = nil
                }
            }
        } else {
            print("--- source NOT COMPLETED")
        }
    })

And this is console output: --- writer STARTED --- source STARTED --- source COMPLETED

Silence-GitHub commented 4 years ago

Could you please show more code (video source, video writer, filters)?