bbc / VideoContext

An experimental HTML5 & WebGL video composition and rendering API.
http://bbc.github.io/VideoContext/
Apache License 2.0
1.33k stars 157 forks source link

Slow scrubbing for videos #114

Closed germain-gg closed 5 years ago

germain-gg commented 6 years ago

Hi,

We have spotted that video scrubbing can be quite slow using VideoContext. It can drop to 4/5 fps. There are obviously a lot of factors that will come into play for that:

To make sure that we would have a fair benchmark, @sacharified came up with a reduced test case that compares:

You can try it for yourself: https://codepen.io/Sacharified/pen/dgderG?editors=0010

We are currently trying to investigate what the bottleneck is but it is slightly unclear as there are a lot of boilerplate code. Is there some documentation somewhere that explain the WebGL program structure? That would really help to debug this issue further. If you have any lead please let me know

PTaylour commented 6 years ago

That's a great codepen—and that is quite a difference between videocontext and the others

I'm afraid there isn't much in the way of implementation docs for videocontext itself.

PTaylour commented 6 years ago

Not sure as far as leads.

Looks like at one point it was waiting longer than necessary to update. But that is fixed now https://github.com/bbc/VideoContext/issues/59

germain-gg commented 6 years ago

Alright, I guess we'll do a bit of a reverse engineering session in the future and we'll try to document the way at the same time.

germain-gg commented 6 years ago

Safari just released a canvas debugger. It exposes all of the valid shaders for a WebGL canvas. https://webkit.org/blog/8452/canvas-debugging/

It might help us to better understand the structure of VideoContext

germain-gg commented 5 years ago

I forgot to update this issue.

I think this is more a video encoding problem rather than a VideoContext problem. I dug deep on this one and realised that the way that VC approached this was as optimised as it could be.

Changing the encoding parameters of our videos made a huge impact here.