简体   繁体   English

用于视频录制的ios数码变焦。如何有效实施?

[英]ios digital zoom for video recording. how to implement efficiently?

I've searched to find that sdk do not support digital zoom in or out, you have to do it indirectly. 我搜索过发现sdk不支持数字放大或缩小,你必须间接地做。 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.). 我在stackoverflow上找到的方法是在录制时转换AVCaputureVideoPreviewLayer ,并对输出视频执行相应的转换后处理(我现在的想法是使用AVMutableVideoCompositionLayerInstruction's转换渐变功能)。

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. 问题是如何记录用户缩放活动的所有连续过程,我认为这可能是一个非常复杂的放大和缩小行为的神秘感,我的意思是,例如,我设计了一个滑块供用户控制缩放,用户可以让滑块缓慢放大4倍(比如最后3秒),如果没有释放滑块,快速缩小到2X(比如说最后0.5秒),我必须根据时间线记录所有这些变化。

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. 您可以在录制时转换AVCaputureVideoPreviewLayer并使用zoomvalue来操纵AVCaptureVideoDataOutput委托中的帧。 The delegate method captureOutput:didOutputSampleBuffer:fromConnection: can be used to process frames of video. 委托方法captureOutput:didOutputSampleBuffer:fromConnection:可用于处理视频帧。 See AVFoundation documentation AVFoundation documentation , Media Capture > Processing Frames of Video. 请参阅AVFoundation文档AVFoundation文档 ,“媒体捕获”>“处理视频帧”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM