【问题标题】:How do I determine the duration of a sample buffer uses in an AVAssetWriter如何确定 AVAssetWriter 中使用的样本缓冲区的持续时间
【发布时间】:2013-06-18 22:36:20
【问题描述】:

我有一个示例缓冲区,用于为 AVAssetWriter 捕获视频。我试图找出一种方法来确定我捕获了多少视频(时间)。目前我可以使用

访问当前缓冲区时间戳
CMTime pts = CMSampleBufferGetPresentationTimeStamp(sampleBuffer);

我正在寻找一种方法来确定缓冲区的持续时间,我已经尝试过

CMTime dur = CMSampleBufferGetOutputDuration(sampleBuffer); but it seems to fluctuate 

由于某种原因在 .002333 和 nan 之间

【问题讨论】:

    标签: ios buffer avassetwriter cmtime cmsamplebufferref


    【解决方案1】:

    为什么不为第一个样本保留一个时间戳,然后做一个非常简单的计算(最新的时间戳减去第一个时间戳)?

    【讨论】:

      猜你喜欢
      • 2020-03-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-11
      • 2014-02-23
      • 2010-09-19
      • 1970-01-01
      • 2015-08-15
      相关资源
      最近更新 更多