使用带自定义尺寸的AVFoundation录制视频? [英] record video with AVFoundation with custom dimensions?

查看:436
本文介绍了使用带自定义尺寸的AVFoundation录制视频?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用AVFoundation录制MOV文件,但我无法找到如何更改视频的尺寸。我有 videoGravity 属性 captureVideoPreviewLayer 设置为 AVLayerVideoGravityResizeAspectFill UIView 显示预览图层具有自定义尺寸(屏幕的长宽比不同)。

I am recording an MOV file using AVFoundation but im having trouble finding out how to change the dimensions of the video. I have videoGravity property of captureVideoPreviewLayer set to AVLayerVideoGravityResizeAspectFill and the UIView showing the preview layer has custom dimensions (not the same aspect ratio of the screen).

录制工作正常,但录制视频的尺寸与屏幕的纵横比相同。如何用UIView或预览层的宽高比记录?

Recording works fine but the dimensions of the recorded video are the same as the aspect ratio of the screen. How can i record with the aspect ratio of the UIView or the preview layer?

推荐答案

这里是最好的示例代码, AVFoundation

Here is best sample code to record video using AVFoundation

https://developer.apple.com/library/ios/#samplecode/RosyWriter/Introduction/Intro.html#//apple_ref/doc/uid/DTS40011110

在档案中: RosyWriterVideoProcessor.m

名称

- (BOOL) setupAssetWriterVideoInput:(CMFormatDescriptionRef)currentFormatDescription

在videoCompressionSettings中,您可以更改维度,希望这将有助于您。

In videoCompressionSettings you can change dimension, hope this will help you.

这篇关于使用带自定义尺寸的AVFoundation录制视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆