ofxEmscriptenVideoPlayer optimization?

For the non-Emscripten video player I found a way to increase performance a lot:

Now I wonder, if there is a similar way to improve the performance of ofxEmscriptenVideoPlayer?
Maybe do some shader calculations on the Java Script side?

Or is the bottleneck, that the data needs to be tranfered every frame from GPU to CPU and back?

1 Like

Sorry for posting so much Emscripten related topics… :wink:

Actually transfering the data does not seem to be the bottleneck: Put the transfer off, and still more than 100% cpu (with an hd .mp4 video)…

No success with the optimization so far. Does anyone know if an optimization is possible at all or if it is already the most efficient way like it is now?

One new technology (API) that might be helpful, is webCodecs:

This new API unleashes access to the media decoders and encoders, enabling us to access raw data from video frames (YUV planes), which may be a lot more useful for many applications than rendered frames;

Maybe those YUV planes can be accesssed from webassembly code (that would be great)?

I found a way to optimize Emscripten video a bit (about 50 %):
With setUsePixels(false); and setPixelFormat(OF_PIXELS_RGBA); used together.
setUsePixels() works only with an ofxEmscriptenVideoPlayer instance (not with ofVideoPlayer).
And draw it with:

if (videoPlayer.getTexture() -> isAllocated()) {
videoPlayer.getTexture() -> draw(50, 350, 205, 110);
1 Like