美文网首页
视频中的 transform 相关的问题

视频中的 transform 相关的问题

作者: 9362d9acd9ef | 来源:发表于2017-08-30 09:32 被阅读65次

    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;
    

    视频中存储的信息

    一般的对于一个播放的时候是竖着视频(如下)来说


    图片2

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


    图片2

    锚点和坐标系

    在不同的锚点和坐标系中使用相同的旋转信息会得到不同的结果
    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

    相关文章

      网友评论

          本文标题:视频中的 transform 相关的问题

          本文链接:https://www.haomeiwen.com/subject/moezdxtx.html