Why not just keep a timestamp for the first sample, and do a very simple calculation (latest timestamp minus the first one)?
How do I determine the duration of a sample buffer uses in an AVAssetWriter
-
01-06-2022 - |
سؤال
I have a sample buffer that I'm using to capture video for an AVAssetWriter. I'm trying to figure out a way to determine how much video (time) I have captured. currently I am able to access the current buffer timestamp by using
CMTime pts = CMSampleBufferGetPresentationTimeStamp(sampleBuffer);
I'm looking for a way to determine the duration of the buffer, i've tried
CMTime dur = CMSampleBufferGetOutputDuration(sampleBuffer); but it seems to fluctuate
between .002333 and nan for some reason
لا يوجد حل صحيح
نصائح أخرى
لا تنتمي إلى StackOverflow