This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
+1 vote

I am new to Godot. The first few frames on my VideoPlayer flash black. Is there a way to hide the video untill the first frame is actually loaded?

extends VideoPlayer
func _ready():
    self.stream = preload("res://output.webm")
    play()

func _process(delta):
    # If I stop right away, the black frame remains.
    # stop()
    pass

This is the ffmpeg command (written under the Compatibility section) which I used to create the video.

ffmpeg -i input.mp4 -c:v libvpx-vp9 -pix_fmt yuv420p output.webm

Thank you for your help.

in Engine by (13 points)

I'm surprised this isn't mentioned more but I can't find anything else on the internet. If you play lots of short videos, it's quite noticable.

I walked away from using videos wherever i can.
if you say "lots of short videos", this will definietly kill the engine.

In case of short videos, i would recommend using Flipbooks, aka AnimatedSprites. You can play thousends of them, without any problem.

2 Answers

+1 vote

Did you have any progress on that ? i am facing the same issue. I came up with an work around, that i play the video at start of my game, and let it run till the end, and make it almost invisible. if you make it completely invisible (alpha=0 or visible=false or outside screen) it wont work.

videoplayer must run through the whole video, otherwise you video will start with the frame, that was the last frame, when you last started it.

not happy with that at all

by (16 points)

Do you mean loop it?

+1 vote

I have found something that works as a fix. In the ready func I play the video and set the modulate.a8 to 1 then I wait till the steam position is 0.1( does not work as a variable IDK why, also might need to adjust) after that I set the modulate back to 255.

by (16 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.