Coder Social home page Coder Social logo

FPS about asscreenrecorder HOT 12 CLOSED

alskipp avatar alskipp commented on June 4, 2024
FPS

from asscreenrecorder.

Comments (12)

alskipp avatar alskipp commented on June 4, 2024

The information can probably be found here

You could try the following within the setUpWriter method.

 _videoWriterInput.mediaTimeScale = FPS;
 _videoWriter.movieTimeScale = FPS;

from asscreenrecorder.

arturdev avatar arturdev commented on June 4, 2024

I'm getting warning: Unable to write buffer to video.
It means appendPixelBuffer return NO (line 266).

I did another way by setting frameInterval property of _displayLink.

from asscreenrecorder.

alskipp avatar alskipp commented on June 4, 2024

I did another way by setting frameInterval property of _displayLink.

Cunning plan : )

from asscreenrecorder.

arturdev avatar arturdev commented on June 4, 2024

:D

from asscreenrecorder.

arturdev avatar arturdev commented on June 4, 2024

I have another question.
How can I implement pause/resume functionality?
I tried to play with _displayLink.paused property. It works, but not as I expect.
In the exported video I see a frozen screen (the screen from where I paused recording) for some time interval (actually this is the interval between pause and resume) and after the image changes.
In other words, lets say if I started the recording on time1 and stopped on time 2, and paused on time3 and resumed on time4, then the video duration still will be (time2-time1):

Start_________________________________________________________________________Stop
|__frozen screen_******************|
(time1)(time3)(time4)____(time2)

So what I should do, to cut that time interval (from time3 to time4) from the video, or prevent from recording when it paused?

from asscreenrecorder.

alskipp avatar alskipp commented on June 4, 2024

Unfortunately the functionality you want is not implemented. A workaround would be to stop recording instead of pausing, then record a new video for the next section. You would then need to use AVFoundation to combine the separate videos into one when you're finished.

The ability to pause recording is probably feasible to add to the current code base, but it's not something I have time to implement personally.

from asscreenrecorder.

arturdev avatar arturdev commented on June 4, 2024

I think I found the solution, again :D
I'm collecting the timestamps of pause and resume times in the array, and then I remove that intervals from elapsed:

        CFTimeInterval elapsed = _displayLink.timestamp - self.firstTimeStamp;
        if (self.pauseResumeTimeRanges.count) {
            for (int i = 0; i < self.pauseResumeTimeRanges.count; i += 2) {
                double pausedTime = [self.pauseResumeTimestamps[i] doubleValue];
                double resumeTime = [self.pauseResumeTimestamps[i+1] doubleValue];
                elapsed -= resumeTime - pausedTime;
            }
        }

        CMTime time = CMTimeMakeWithSeconds(elapsed, 1000);

Cunning plan, huh? :))

from asscreenrecorder.

alskipp avatar alskipp commented on June 4, 2024

I wonder if you can achieve the same result by checking _isRecording in the writeVideoFrame method? I've not actually tried to see if it would work, but the idea is: you'd set _isRecording to NO to pause the recording and restart by setting it back to YES. Then you'd need to check before writing the video frame:

if (![_videoWriterInput isReadyForMoreMediaData] && !_isRecording) return;

Having not actually tried this idea out, I can't guarantee it'll work. Seems reasonable?

from asscreenrecorder.

arturdev avatar arturdev commented on June 4, 2024

That will give same result as setting _displayLink.paused to NO. Because the issue is with _displayLink.timestamp value. It always returns the time value associated with the last frame that was displayed.

from asscreenrecorder.

alskipp avatar alskipp commented on June 4, 2024

Fair point. Perhaps another technique would be to pause the displayLink, capture the paused time, then adjust the self.firstTimeStamp before resuming recording?

Either way, good luck with your mission!

from asscreenrecorder.

arturdev avatar arturdev commented on June 4, 2024

Thank you :)

from asscreenrecorder.

Ameenul557 avatar Ameenul557 commented on June 4, 2024

@arturdev @alskipp Can you guys please help me with this issue #15 :( , Thanks in advance

from asscreenrecorder.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.