Search code examples
gifgdscriptgodot4

How do I play a gif in godot4?


I want to play a simple gif in my godot4 project.

Let's say that I have a gif file named video.gif. How do I play it using GDscript? Which component would play a gif? If I can't play a gif, can I play a video file? If I also can't do that, how can I display a video/gif in godot4?


Solution

  • Out of the box Godot does not have support for gif. It might be possible to add this functionality via plugins, however I'm not aware of one for gif.

    If you can use video, then I recommend the OGV format, which Godot supports, of course. You can play it with the VideoStreamPlayer in Godot 4, or the VideoPlayer in Godot 3. Godot 3 also had support for WEBM video, however it was problematic, which let to it being removed for Godot 4.

    See Playing Videos (Godot 4, Godot 3) for details.