将 AVAssetWriter 的输出绕 x 轴旋转 180 度
我正在使用 AVAssetWriter
创建 Quicktime 电影文件。目前输出视频是“颠倒的”。理论上,我可以通过将视频绕水平轴旋转 180 度(本质上是“翻转”视频)来纠正此问题。 执行此操作的最佳方法是什么?
目前,我正在尝试将 CGAffineTransform
分配给 myAVAssetWriterInput.transform
。也许 CGAffineTransformMake(a, b, c, d, tx, ty) 允许我指定正确的仿射变换矩阵?
Apple 文档 和 < a href="http://en.wikipedia.org/wiki/Transformation_matrix#Affine_transformations" rel="noreferrer">wikipedia 给出了关于如何仿射变换矩阵有效。在一起可能有更好的方法。
I'm creating a Quicktime movie file using AVAssetWriter
. Currently the output video is "upside down". In theory I can correct this by rotating the video 180 degrees about the horizontal axis (essentially "flipping" the video). What's the best way to do this?
Currently I'm trying to assign a CGAffineTransform
to myAVAssetWriterInput.transform
. Perhaps CGAffineTransformMake(a, b, c, d, tx, ty)
will allow me to specify the correct affine transformation matrix?
Neither the Apple docs nor wikipedia gives a clear explanation on how an affine transformation matrix works. And there might be a better way all together.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您想将视频绕 z 轴旋转 180 度,或者
如果您想在 x 轴上反射
if you want to rotate the video 180 degrees around z-axis, or
if you want to reflect in x-axis
[AVAssetTrack PreferredTransform]
将返回正确的 CGAffineTransform。您可以将此 CGAffineTransform 分配给
writeInput
。[AVAssetTrack preferredTransform]
will return the right CGAffineTransform.You can assign this CGAffineTransform to
writeInput
.