更新时间:2022-12-30 16:27:59
我也在搜索.下面的链接提供了缩放视频的解决方案.
I am also searching for that. The link below gives a solution for zooming video.
http://www. iphonelife.com/blog/87/imaging-video-guru-reporting-lossless-video-zooming-ios7
缩放视频的逻辑是:
int selectedAVCaptureDeviceFormatIdx = 15;
[self.videoDevice lockForConfiguration:nil];
AVCaptureDeviceFormat* currdf = [self.videoDevice.formats objectAtIndex:selectedAVCaptureDeviceFormatIdx];
self.videoDevice.activeFormat = currdf;
if (selectedAVCaptureDeviceFormatIdx==12 || selectedAVCaptureDeviceFormatIdx==13)
self.videoDevice.activeVideoMaxFrameDuration = CMTimeMake(1,60);
NSLog(@"%f", self.videoDevice.activeFormat.videoMaxZoomFactor);
NSLog(@"videoZoomFactorUpscaleThreshold: %f", self.videoDevice.activeFormat.videoZoomFactorUpscaleThreshold);
// If you want to zoom to the threshold of possible zooming before binning occurs
self.videoDevice.videoZoomFactor = videoDevice.activeFormat.videoZoomFactorUpscaleThreshold;
// If you want to set your own zoom factor
//self.videoDevice.videoZoomFactor = 3.0f;// here zoom given in CGFloat like 1, 2, 3, 4, 5.
[self.videoDevice unlockForConfiguration:nil];