Skip to content
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

Video is 5x faster #110

Open
iamappmaker opened this issue Apr 23, 2020 · 14 comments
Open

Video is 5x faster #110

iamappmaker opened this issue Apr 23, 2020 · 14 comments

Comments

@iamappmaker
Copy link

I am using GSAP to create animation
Video output is 5x faster
10 seconds animation is recorded in 2 sec.

@dlazares
Copy link

I'm also experiencing sped up recordings using a Mac running Chrome version 81.

Here's the simplified version of the code.

this.capturer = new CCapture({format: 'webm'});

start(){
    this.renderCanvas();
    this.capturer.start();
}
renderCanvas(){
    requestAnimationFrame(this.renderCanvas);
    this.update(); // Updates Canvas 
    this.capturer.capture(this.canvasRef.current);
  }

@Rolands-Laucis
Copy link

Same for me with any FPS configurations. Reading the other issues, it seems that is just how it is with a solution nowhere in sight.

@Soahr
Copy link

Soahr commented Oct 21, 2021

Same for me here ... Any solution ?

@spite
Copy link
Owner

spite commented Oct 21, 2021 via email

@Rolands-Laucis
Copy link

I would just record my browser screen with a free tool like Bandicam (watermark) or OBS (no watermark, but kinda overkill for the task)

@spite
Copy link
Owner

spite commented Oct 21, 2021 via email

@Soahr
Copy link

Soahr commented Oct 21, 2021

My bad, apparently, after using it correctly, the speed is correct !

@EgorKorshunov
Copy link

Right now I have the same problem and I don't understand what you guys did to solve it. Could you please help?

@Soahr
Copy link

Soahr commented Nov 26, 2021

@EgorKorshunov
I just pushed my working project here : https://github.com/Soahr/ccapture-recording-canvas-animation
Hope this can help you ;)

@EgorKorshunov
Copy link

Thank you very much!

@EgorKorshunov
Copy link

Unfortunately, if I add GSAP to this example, the final video goes much faster than it should.
@spite you mentioned here that this is about GSAP and Date.now(). Do you know if it is possible to do anything about it? Also what does "CCapture is the first dependency" mean here?

@Soahr
Copy link

Soahr commented Nov 28, 2021

@EgorKorshunov I don't know GSAP very well but i just updated my code to work with it frame based : https://github.com/Soahr/ccapture-recording-canvas-animation

@RickMohr
Copy link

RickMohr commented Dec 14, 2021

@EgorKorshunov, here's one way to capture a GSAP timeline at the correct speed. Since the timeline stores the full animation we can control the capture rate directly, independent of any GSAP or ccapture timing:

async function capture(timeline, canvas) {
    const frameRate = 60;
    const capturer = new CCapture({ format: 'webm', framerate: frameRate });
    capturer.start();

    const nFrames = timeline.duration() * frameRate;
    const step = 1 / nFrames;
    for (let t = 0; t <= 1; t += step) {
        timeline.progress(t);
        capturer.capture(canvas);

        await new Promise(resolve => requestAnimationFrame(resolve));
    }
    capturer.stop();
}

(Note this uses promises and async to simplify the control flow, but would work fine without them as well.)

Thanks to @Soahr for the idea of using timeline.progress.

@JulienPoirierWebDev
Copy link

Hello ! I have the same issue with p5.js ! The video output is more faster than the recorded animation !

It's just me or there is someone ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants