美文网首页
CMTime,CMTimeMake CMTimeMakeWith

CMTime,CMTimeMake CMTimeMakeWith

作者: 歌白尼 | 来源:发表于2016-12-29 17:18 被阅读228次

原地址:http://blog.csdn.net/chun799/article/details/8679264

“CMTime可是專門用來表示影片時間用的類別,

他的用法為: CMTimeMake(time, timeScale)

time指的就是時間(不是秒),

而時間要換算成秒就要看第二個參數timeScale了.

timeScale指的是1秒需要由幾個frame構成(可以視為fps),

因此真正要表達的時間就會是 time / timeScale 才會是秒.”

上面的代码可以这么理解,视频的fps(帧率)是10,firstframe是第一帧的视频时间为0.1秒,lastframe是第10帧视频时间为1秒。

或者换种写法   CMTime curFrame = CMTimeMake(第几帧, 帧率)

看看另一篇博客的写法:沒有符合條件的頁面。 

这么看,

        CMTimefirstframe=CMTimeMake(32,16);

        CMTimelastframe=CMTimeMake(48, 24);

关于帧率说一下题外话,通常帧率是多少呢?如下:


You frequently use a timescale of 600, since this is a common multiple of several commonly-used frame-rates: 24 frames per second (fps) for film, 30 fps for NTSC (used for TV in North America and Japan), and 25 fps for PAL (used for TV in Europe). Using a timescale of 600, you can exactly represent any number of frames in these systems


这个地方有说明developer.apple.com/library/mac/#documentation/AudioVideo/Conceptual/AVFoundationPG/Articles/05_MediaRepresentations.html#//apple_ref/doc/uid/TP40010188-CH2-SW1

CMTimeMakeWithSeconds 和 CMTimeMake 区别在于,第一个函数的第一个参数可以是float,其他一样。

相关文章

  • CMTime,CMTimeMake CMTimeMakeWith

    原地址:http://blog.csdn.net/chun799/article/details/8679264 ...

  • CMTimeMake和CMTimeMakeWithSeconds

    CMTimeMake(a,b) a当前第几帧, b每秒钟多少帧.当前播放时间a/b CMTimeMakeWith...

  • AVFoundation视频处理的时间CMTime

    一、CMTime Core Media定义的一种时间数据类型 1、创建CMTime 1、CMTimeMake()C...

  • iOS CMTimeMake 和 CMTimeMakeWithS

    CMTime是专门用于标识电影时间的结构体,通常用如下两个函数来创建CMTime1、CMTimeMake valu...

  • CMTime

    CMTime 一个用来描述视频时间的结构体。他有两个构造函数:\ * CMTimeMake\* CMTimeMak...

  • AVPlayer seek 位置不精确问题

    func seek(to time: CMTime, toleranceBefore: CMTime, toler...

  • CMTime

    要求时间高精度时一般使用CMTime,比如音频视频。其他一般情况下一般使用NSTimeInterval,NSTim...

  • CMTime

    最近看到一篇关于CMTime的文章,感觉讲得通俗易懂,正好最近也在看相关的资料就顺便记录下来,以便自己今后回忆复习...

  • CMTime

    CMTime 其实是帧时间,取值为(0,1),单位是秒是用当前帧数除以帧率算出来的,表示当前帧在视频时长的哪个点 ...

  • CMTime

    参考:https://www.jianshu.com/p/d6f9d7e493b6 一、CMTimeMakeWit...

网友评论

      本文标题:CMTime,CMTimeMake CMTimeMakeWith

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