I've searched to find that sdk do not support digital zoom in or out, you have to do it indirectly. The way I found on stackoverflow is transform the AVCaputureVideoPreviewLayer
while recording, and do the corresponding transform postprocess to the output video(my present idea is use AVMutableVideoCompositionLayerInstruction's
transform ramp function.).
The problem is how can you record all the continuous course of user's zoom activity, which I think can be a sirious of very complex zoom in and zoom out behaviors I mean, for example, I design a slider for user to control the zoom, user may hold the slider zoom in 4x slowly(say last 3 seconds) and, without release the slider, quickly zoom out to 2X(say last 0.5 seconds), I have to record all this changes according the timeline.
I really feel this record complex, in addition you also have to guarantee it doesn't cost too much resources to keep smooth performance of video recording process! Or any other way of implementation of digital zoom? Grateful to any helper!
You could transform AVCaputureVideoPreviewLayer
while recording and use the zoomvalue to manipulate the frames in the AVCaptureVideoDataOutput
delegate. The delegate method captureOutput:didOutputSampleBuffer:fromConnection:
can be used to process frames of video. See AVFoundation documentation AVFoundation documentation, Media Capture > Processing Frames of Video.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With