[英]What does a CMSampleBuffer's sample presentation time represent?
Our app is using AVFoundation to capture video, display, manipulate, and export the video using its sample buffers. 我们的应用程序正在使用AVFoundation来捕获视频,使用其样本缓冲区显示,操作和导出视频。 I am trying to understand what the
CMSampleBufferGetPresentationTimeStamp(_:)
CMTime actually represents. 我试图了解
CMSampleBufferGetPresentationTimeStamp(_:)
CMTime实际代表什么。
For example, when video capture begins, the first sample's presentation time is 93 hours and 5 minutes. 例如,开始视频捕获时,第一个样本的演示时间为93小时5分钟。 I don't understand where this value comes from.
我不明白这个价值从何而来。 Using the first sample's presentation time to start the AVAssetWriter session creates 93 hours of black frames before video playback begins.
使用第一个样本的演示时间来启动AVAssetWriter会话会在视频播放开始之前创建93个小时的黑框。
It's based on a mach time, which means number of ticks from last reboot. 它基于马赫时间,这意味着上次重新启动的滴答数。 You can create such CMTime with this code:
您可以使用以下代码创建此类CMTime:
mach_timebase_info_data_t timeInfo;
mach_timebase_info(&timeInfo);
CMTime time = CMTimeMake(mach_absolute_time() * timeInfo.numer / timeInfo.denom, 1000000000);
Or use this to get it already converted to number of seconds. 或使用它来将其转换为秒数。
double seconds = CACurrentMediaTime();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.