Closed hoangdado closed 5 years ago
Do you mean calculating the whole duration of writing a video? If so, keep the start time and the end time to calculate.
Or do you mean calculating the duration of writing one frame? How about adding a progress callback after writing a frame? So you can do whatever you want after writing each frame.
Thanks @Silence-GitHub, What I want is a progress callback.
Version 1.0.7 adds video writer progress callback.
videoWriter.start { (type) in
switch type {
case let .video(time, success): print("Video time = \(time), success = \(success)")
case let .audio(time, success): print("Audio time = \(time), success = \(success)")
}
}
Hi @Silence-GitHub, thanks for your quick response, but what I mean is the elapsed time (may be CMTime or CGFloat seconds value) from videoWriter.start()
I think providing the video time in progress callback is more reasonable. You can track the elapsed time like this.
let startTime = CACurrentMediaTime()
videoWriter.start { (type) in
let duration = CACurrentMediaTime() - startTime
}
@Silence-GitHub, thank you so much!
Hi @Silence-GitHub, could you please add a way to track video recording duration to BBMetalVideoWriter?