使用 AVFoundation 录制具有自定义尺寸的视频?
我正在使用 AVFoundation 录制 MOV 文件,但我无法找到如何更改视频的尺寸。我将 captureVideoPreviewLayer
的 videoGravity
属性设置为 AVLayerVideoGravityResizeAspectFill
并且显示预览图层的 UIView
具有自定义尺寸(不是屏幕的长宽比相同)。
录制效果很好,但录制视频的尺寸与屏幕的宽高比相同。如何记录 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).
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
录制视频的最佳示例代码
这是使用 AVFoundation https://developer.apple.com/library/ios/#samplecode/RosyWriter/Introduction/Intro.html#//apple_ref/doc/uid/DTS40011110
在文件中:
RosyWriterVideoProcessor.m
方法名称
在videoCompressionSettings中你可以改变尺寸,希望这对你有帮助。
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
In File:
RosyWriterVideoProcessor.m
Method Name
In videoCompressionSettings you can change dimension, hope this will help you.