Jump to content
Search Community

Scrolltrigger - video scrub laggy/choppy

calvin1988 test
Moderator Tag

Recommended Posts

Hi everyone.

I'm working on a video scrub using this example I found in another post, but when I replace the video url with my own video the animation gets laggy and choppy.

 

I went through other posts like this:

As recommended in the post, the video is now at 60FPS and encoded in H.264 format, but it is still choppy on Chrome (it's smooth on Safari).

Please advise :(

 

 

See the Pen xxrOdpj by GreenSock (@GreenSock) on CodePen

Link to comment
Share on other sites

The problem you're describing sounds like the nature of video codecs and keyframe spacing. It is critically important that you encode the video properly if you want to be able to scrub smoothly. Most video codecs have keyframes every X number of frames, and then between those it only records the changes from the previous frame (to minimize file size). It's optimized to only play forward. So if you encode the video when keyframes every 120 frames, for example, what happens if you try to scrub to frame 57? That's not a keyframe. It's a lot of work for the computer to back up to the closest keyframe earlier, and then calculate all the changes on each frame since. It's terrible for scrubbing smoothly. But if you encode your video with a keyframe literally on EVERY frame, then it'll be able to scrub incredibly smoothly (but you'll have a much bigger video file). 

 

In short, this has absolutely nothing to do with GSAP or ScrollTrigger - it's purely a video encoding thing. At least that's my best guess based on your description. Encode your video with the keyframes spaced tightly and you should be okay. Or just use an image sequence and <canvas>. 

 

@Cassie suggests some settings here: 

 

And this thread might also prove helpful: 

 

Good luck!

  • Like 1
Link to comment
Share on other sites

  • 1 year later...
On 3/3/2023 at 9:23 AM, calvin1988 said:

Hi everyone.

I'm working on a video scrub using this example I found in another post, but when I replace the video url with my own video the animation gets laggy and choppy.

 

I went through other posts like this:

As recommended in the post, the video is now at 60FPS and encoded in H.264 format, but it is still choppy on Chrome (it's smooth on Safari).

Please advise :(

 

 

Getting the TypeScript issue with "this" please help me out.

fn.apply(this, arguments);

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...