如何在AV Foundation视频文件复制中设置preferredTransform
我正在使用 AVAssetReader 和 AVAssetWriter 将视频从一个文件转码到另一个文件。 AVAssetReaderTrackOutput 已添加到 AVAssetReader 中。不幸的是,单个轨道的preferredTransform属性没有从输入复制到输出,因此以纵向录制的视频会以横向播放。
如何在输出文件中设置preferredTransform 属性?
I am using AVAssetReader and AVAssetWriter to transcode video from one file to another. AVAssetReaderTrackOutput was added to the AVAssetReader. Unfortunately, the single track's preferredTransform property was not copied from the input to the output, so a video recorded in portrait orientation is played back in landscape.
How can I set the preferredTransform property in the output file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我刚刚找到了自己的答案:将 AVAssetWriterInput 的 Transform 属性设置为输入轨道的 PreferredTransform 属性,例如:-
assetWriterInput.transform = [[tracks objectAtIndex:0] PreferredTransform];
如果这两个属性没有对同一事物有不同的名称,那么在 doco 中会更快地找到这一点。
I've just found my own answer: Set the transform property of the AVAssetWriterInput to the preferredTransform property of the input track, for example:-
assetWriterInput.transform = [[tracks objectAtIndex:0] preferredTransform];
Would have found this quicker in the doco if these two properties hadn't had different names for the same thing.