简体   繁体   English

我可以使用AVAssetWriter代替AVExportSession吗?

[英]Can i use AVAssetWriter in place of AVExportSession?

I want to crop the video given the lenght and width and x and y coordinates and it seems its not at possible with avmutablecomposition so I am planning to use AVAssetWriter to crop video using its aspectFill property in video setting. 我想根据长度和宽度以及x和y坐标来裁剪视频,而使用AVAssetWriter似乎无法实现此效果,因此我打算在视频设置中使用AVAssetWriter在其As​​pectFill属性中裁剪视频。

BUT MY QUESTION is can we use AVAssetWriter as a replacement for AVExportSession ?? 但我的问题是,我们可以使用AVAssetWriter代替AVExportSession吗?

If yes, how to initialise the AVAssetWriterInput with AVAsset object as that we do in AVExportSession ,Like this 如果是,如何像我们在AVExportSession AVAssetWriterInputAVAsset对象初始化AVExportSession ,就像这样

[[AVAssetExportSession alloc] initWithAsset:videoAsset presetName:AVAssetExportPresetHighestQuality];

It's possible that what you are looking for is AVMutableComposition naturalSize property which from what it looks from here, allows scaling (not cropping) of the video to wished sizes. 您可能正在寻找的是AVMutableComposition naturalSize属性,该属性从此处的外观开始,可以将视频缩放(而非裁剪)为所需的大小。

https://developer.apple.com/library/mac/documentation/AVFoundation/Reference/AVMutableComposition_Class/Reference/Reference.html#//apple_ref/occ/instp/AVMutableComposition/naturalSize https://developer.apple.com/library/mac/documentation/AVFoundation/Reference/AVMutableComposition_Class/Reference/Reference.html#//apple_ref/occ/instp/AVMutableComposition/naturalSize

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

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