-
Notifications
You must be signed in to change notification settings - Fork 582
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optionally dropping frames #83
base: master
Are you sure you want to change the base?
Conversation
This implementation breaks the videoTimeScale property if shouldDropFrames is not set to true. I believe you can very easily implement that feature by doing the following on the latest SCRecordSession impl. Could you tell me if that worked? if (_videoTimeScale != 1.0) {
computedFrameDuration = CMTimeMultiplyByFloat64(computedFrameDuration, _videoTimeScale);
_timeOffset = CMTimeAdd(_timeOffset, CMTimeSubtract(duration, computedFrameDuration));
}
// Here is the condition to add
// If the computed time of the buffer is less than the lastTime (which is presentation time + duration), skip the buffer
if (_shouldDropFrame && CMTIME_COMPARE_INLINE(lastTimeVideo, <, _lastTimeVideo)) {
return NO;
}
lastTimeVideo = CMTimeAdd(lastTimeVideo, computedFrameDuration); |
@rFlex I'm sorry for the delay. I couldn't came back to this till now. Unfortunately, your solution doesn't work for me. What I need is a 3 second long video with 1 fps, but the recording must also last 3 seconds. That is the main issue, making the recording last those 3 seconds. Your solution brings two issues:
I'll try to reproduce the issue you mentioned with |
By the way, in this new implementation, setting a different value to |
I got it, and updated to the new updates. The SCVideoConfiguration's Conceptually, we could translate When working together, I had to discard the old implementation because the updates since then and the necessary fixes were to large to consider. |
f82cc23
to
bd0f551
Compare
79b318c
to
788a6cd
Compare
Hey @rFlex was this ever merged? or implemented? I'm looking for a way to drop frames for a very similar effect as @fjcaetano |
There are so many commits after this that I don't think this would be wise. @MMasterson, perhaps you could cherry-pick this out of my fork? |
My application needed to create a "slideshow" of three frames to be shown with one second each and those frames should be captured one second after the previous. I "achieved" it with the following:
However, it captured 3 frames, extended their output length to 1 second, and thus, created a 3 second video with three frames of one second each, however, the recording took a fraction of a second. The frames weren't being captured with one second distance of each other.
My solution adds the boolean property
shouldDropFrames
toSCRecordSession
. It's default value isYES
, so nothing needs to be changed for the default behavior to continue, however, if this property is set toNO
, the session will drop the frames until the full length of the recording is over.I had to customize the framework in order to achieve what I needed. I do realise this behavior may not be intended, but, nevertheless, I thought it would be interesting to submit a pull-request for your appreciation.