VideoPlayer flashes some black frames at the start

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By leandersilur

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(): = preload("res://output.webm")

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

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.

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.

SteveSmith | 2022-12-15 13:48

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.

guelinator | 2022-12-15 14:39

:bust_in_silhouette: Reply From: guelinator

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

Do you mean loop it?

SteveSmith | 2022-12-15 13:16

:bust_in_silhouette: Reply From: Ford4466

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.