CGAffineTransform 定义
从 AVAssetTrack 中可以获取两个信息:视频尺寸& transform:
/* indicates the natural dimensions of the media data referenced by the track as a CGSize */
@property (nonatomic, readonly) CGSize naturalSize;
/* indicates the transform specified in the track's storage container as the preferred transformation of the visual media data for display purposes;
its value is often but not always CGAffineTransformIdentity */
@property (nonatomic, readonly) CGAffineTransform preferredTransform;
视频中存储的信息
一般的对于一个播放的时候是竖着视频(如下)来说

他存储的可能是一个横着的图像+旋转信息

锚点和坐标系
在不同的锚点和坐标系中使用相同的旋转信息会得到不同的结果
1、对于左上角坐标系的图片进行旋转


2、对于左下角坐标系的图片进行旋转


从 AVAssetTrack 中获取的 transform
有时候 transform 获取出来是 [0 1 -1 0 0 0] 有时候可能是 [0 1 -1 0 960 0]
对于左上角坐标系而言, [0 1 -1 0 0 0] 代表着把图片以圆点作为锚点顺时针旋转 90°
对于左上角坐标系而言, [0 1 -1 0 960 0] 代表着把图片以圆点作为锚点顺时针旋转 90°,然后沿着 x 轴的正方向平移 960
网友评论