Page 1 of 1
Slight delay when webm videos play, why?
Posted: Mon Dec 09, 2019 2:45 am
by tapanojum
Hi, I'm having issues with loading videos into my game. The transition from image to video is not instant. There's about a half-second delay where the player sees a transparent background before the video starts. Is there some sort of optimization I need to do? I thought this was normal until I played other Ren'py games where the video playback was instant.
I convert all videos to webm and even the small ones under 1mb in size do this. Any ideas?
Thanks
Re: Slight delay when webm videos play, why?
Posted: Mon Dec 09, 2019 7:40 am
by isobellesophia
You might be adding alot of transitions before playing the video or something like that?
Showing the code will help.
Re: Slight delay when webm videos play, why?
Posted: Mon Dec 09, 2019 1:24 pm
by rames44
Movies have a start image property - if you set that to an image that matches the first frame of your video, that’ll display for a fraction of a second, then merge seamlessly into your video.
That’s the workaround. The underlying reason is that it takes Ren’py a few frames to get its video pipeline going.
Re: Slight delay when webm videos play, why?
Posted: Mon Dec 09, 2019 4:06 pm
by Imperf3kt
Alternatively, display a black image immediately before the video.
show black should work (black is already defined within renpy internals)
Naturally this won't work if you're trying to blend a scene into a movie.
Re: Slight delay when webm videos play, why?
Posted: Mon Dec 09, 2019 5:05 pm
by tapanojum
I figured out my issue. I've been using the following syntax for all my video animations this entire time.
Code: Select all
image anim1 = Movie(play="/animation/anim1.webm", loop = True )
I've now begun using the following syntax.
Code: Select all
$ renpy.movie_cutscene("/animation/anim_1.webm", loops = -1)
Now there is no delay before the start of the video.
Edit: Although I've spoken to some other Ren'Py users and they still use the Movie(play=) method without any issues.
I don't have any transitions or really any reason for there to be a delay using that first method. I'm thoroughly confused.
Edit 2: I was using
instead of
Calling the video with show removes any delay in the beginning.
Re: Slight delay when webm videos play, why?
Posted: Mon Dec 09, 2019 6:01 pm
by Imperf3kt
The scene command uses a transform, Fade. (or Dissolve, I cannot remember which)
This may be why.
Re: Slight delay when webm videos play, why?
Posted: Mon Dec 09, 2019 6:39 pm
by tapanojum
Imperf3kt wrote: ↑Mon Dec 09, 2019 6:01 pm
The scene command uses a transform, Fade. (or Dissolve, I cannot remember which)
This may be why.
Hmm, that's interesting. Whatever transform is being used, it's not actually transforming from the previous scene. It just showed a checkered empty background for half a second before the video starts instantly.
Re: Slight delay when webm videos play, why?
Posted: Mon Dec 09, 2019 7:27 pm
by Imperf3kt
That's what I meant.
If you had used an image, it would have taken 0.5 seconds to fade to the image. But opacity cannot be controlled on videos so you get half a second of completely invisible followed by completely visible.
Re: Slight delay when webm videos play, why?
Posted: Mon Dec 09, 2019 7:52 pm
by tapanojum
Sorry, I'm still a bit confused. I've used scene for all my images or videos this entire time. There is no visible transformation between the images, certainly not the 0.5 seconds.
Re: Slight delay when webm videos play, why?
Posted: Mon Dec 09, 2019 8:35 pm
by Imperf3kt
I'm not currently at a computer where I could copy code to show you from, but the old wiki states that the scene command uses the transition "dissolve"
https://www.renpy.org/wiki/renpy/doc/re ... enpy.scene
The documentation does not reflect this.
https://www.renpy.org/doc/html/displayi ... -statement
Re: Slight delay when webm videos play, why?
Posted: Tue Dec 10, 2019 1:14 pm
by rames44
To the best of my knowledge, if you don’t put an explicit transition in, “scene” does not (or doesn’t any more) include a “dissolve” transition.
Re: Slight delay when webm videos play, why?
Posted: Wed Dec 18, 2019 6:06 am
by Imperf3kt
Was doing something completely unrelated and found the section of code I was referring to.
This is found in options.rpy around line 107 (freshly made options.rpy with an up to date renpy version)
Code: Select all
define config.window_show_transition = Dissolve(.2)
define config.window_hide_transition = Dissolve(.2)
the "scene" command makes the window hide and show, so this transform is applied to it.
You can confirm it is there by defining an image named "white"
and then adding this to your script (assuming your textbox is black)
You can make it more apparent by lengthening the default config.window_show_transition and config.window_hide_transition
Try 1 second.
Re: Slight delay when webm videos play, why?
Posted: Wed Dec 18, 2019 5:11 pm
by rayminator
you can try it this way
Code: Select all
image anim1 = Movie(channel="anim1", play="video/anim1.webm", start_image="Your_Image", image="Your_Image")
scene anim1
or
show anim1