remotion icon indicating copy to clipboard operation
remotion copied to clipboard

Error creating WebGL context

Open tohaosipow opened this issue 3 years ago • 8 comments

Bug Report 🐛

I have trouble with remotion and three js, in dev mode everything is ok, but when I am trying to render via CLI I get an error - Error creating WebGL context. I tried in Docker on server and locally on Mac Book. When I am using remotion without ThreeCanvas , everything is ok.

An error occurred while rendering frame 1: Error Error creating WebGL context.

It's also repeat with this example - https://github.com/remotion-dev/template-three

tohaosipow avatar Jan 30 '23 02:01 tohaosipow

Thanks for reporting! Looks like a recent Chrome version broke it.

You need to add

Config.Puppeteer.setChromiumOpenGlRenderer('angle');

to your remotion.config.ts file to fix it - I added it to the template now and made a PR in Remotion to give better error handling for it.

JonnyBurger avatar Jan 30 '23 09:01 JonnyBurger

Problems:

  • This broke rendering in GitHub Actions, so reverted
  • Did not work inside Docker

Therefore this change is reverted now

JonnyBurger avatar Jan 31 '23 13:01 JonnyBurger

First investigation shows that the reason for it is that some slim Docker images do not have graphics capabilities. A special Docker image which has the necessary libraries will be required for sure

JonnyBurger avatar Feb 01 '23 08:02 JonnyBurger

@JonnyBurger Could you specify which libraries are needed to prevent this error message in docker? Or are you still looking into it?

crllnsmnn avatar Feb 12 '23 10:02 crllnsmnn

I've now created a working Dockerfile: https://remotion-git-docker-remotion.vercel.app/docs/docker I know that macOS is broken by default, but there seems to be no value that works everywhere - I added the recommendation to use angle in case you get the render error.

JonnyBurger avatar Feb 13 '23 16:02 JonnyBurger

Hi, webgl seems to be still missing when exporting a video, even when adding Config.setChromiumOpenGlRenderer('angle'); to the config or --gl angle with lambda. @JonnyBurger Do you have an idea on how to fix this?

TLDR: canvag.getContext("webgl") returns undefined in export, but works in player

josefbender avatar Jun 21 '24 13:06 josefbender

On Lambda, I would recommend not setting any GL option, so null.

As far as I remember, the context will not be null then!

JonnyBurger avatar Jun 23 '24 15:06 JonnyBurger

You're right! Not setting any GL option fixed the problem. Thanks @JonnyBurger !

josefbender avatar Jun 24 '24 13:06 josefbender