CMTime,CMTimeMake CMTimeMakeWithSeconds

原地址: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 CMTimeMakeWithSeconds)