record video with AVFoundation with custom dimensions? [duplicate]

社会主义新天地 提交于 2019-12-22 08:46:38

问题


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?


回答1:


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

- (BOOL) setupAssetWriterVideoInput:(CMFormatDescriptionRef)currentFormatDescription

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



来源:https://stackoverflow.com/questions/9338029/record-video-with-avfoundation-with-custom-dimensions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!