ccapture.js icon indicating copy to clipboard operation
ccapture.js copied to clipboard

Video is 5x faster

Open iamappmaker opened this issue 5 years ago • 14 comments

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

iamappmaker avatar Apr 23 '20 20:04 iamappmaker

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);
  }

dlazares avatar Apr 30 '20 02:04 dlazares

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.

Rolands-Laucis avatar May 04 '21 10:05 Rolands-Laucis

Same for me here ... Any solution ?

Soahr avatar Oct 21 '21 15:10 Soahr

That's because how GSAP instruments Date.now, I think i can recall. If someone can upload a codepen with the issue i can take a look. Just in case, make sure CCapture is the first dependency.

On Thu, 21 Oct 2021 at 16:35, Soar @.***> wrote:

Same for me here ... Any solution ?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/spite/ccapture.js/issues/110#issuecomment-948729413, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFSV3JRYB2ANXTKG4O3VQDUIAXKNANCNFSM4MPNEUNQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

spite avatar Oct 21 '21 15:10 spite

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

Rolands-Laucis avatar Oct 21 '21 15:10 Rolands-Laucis

You're perfectly free to do that.

On Thu, 21 Oct 2021 at 16:49, Rolands Laucis @.***> wrote:

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

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/spite/ccapture.js/issues/110#issuecomment-948745301, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFSV3L4PLRQCJKXJVPQCATUIAZBPANCNFSM4MPNEUNQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

spite avatar Oct 21 '21 15:10 spite

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

Soahr avatar Oct 21 '21 21:10 Soahr

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

EgorKorshunov avatar Nov 25 '21 21:11 EgorKorshunov

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

Soahr avatar Nov 26 '21 21:11 Soahr

Thank you very much!

EgorKorshunov avatar Nov 26 '21 21:11 EgorKorshunov

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?

EgorKorshunov avatar Nov 27 '21 14:11 EgorKorshunov

@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

Soahr avatar Nov 28 '21 10:11 Soahr

@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.

RickMohr avatar Dec 14 '21 13:12 RickMohr

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 ?

JulienPoirierWebDev avatar Nov 01 '22 07:11 JulienPoirierWebDev