Slight delay when webm videos play, why?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
tapanojum
Regular
Posts: 28
Joined: Tue Feb 27, 2018 4:33 am
Contact:

Slight delay when webm videos play, why?

#1 Post by tapanojum » Mon Dec 09, 2019 2:45 am

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

User avatar
isobellesophia
Miko-Class Veteran
Posts: 979
Joined: Mon Jan 07, 2019 2:55 am
Completed: None
Projects: Maddox and Friends! (AI Teacher friend), Friendly Universities! (Soon)
Organization: Friendly Teachers series
Deviantart: SophBelle
itch: Child Creation
Location: Philippines, Mindanao
Contact:

Re: Slight delay when webm videos play, why?

#2 Post by isobellesophia » Mon Dec 09, 2019 7:40 am

You might be adding alot of transitions before playing the video or something like that?
Showing the code will help.
I am a friendly user, please respect and have a good day.


Image

Image


rames44
Veteran
Posts: 232
Joined: Sun May 29, 2016 4:38 pm
Contact:

Re: Slight delay when webm videos play, why?

#3 Post by rames44 » Mon Dec 09, 2019 1:24 pm

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.

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3636
Joined: Mon Dec 14, 2015 5:05 am
Location: Your monitor
Contact:

Re: Slight delay when webm videos play, why?

#4 Post by Imperf3kt » Mon Dec 09, 2019 4:06 pm

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.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor
Free Android GUI - Updated occasionally
Twitter
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py

tapanojum
Regular
Posts: 28
Joined: Tue Feb 27, 2018 4:33 am
Contact:

Re: Slight delay when webm videos play, why?

#5 Post by tapanojum » Mon Dec 09, 2019 5:05 pm

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

Code: Select all

scene anim1
instead of

Code: Select all

show anim1
Calling the video with show removes any delay in the beginning.

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3636
Joined: Mon Dec 14, 2015 5:05 am
Location: Your monitor
Contact:

Re: Slight delay when webm videos play, why?

#6 Post by Imperf3kt » Mon Dec 09, 2019 6:01 pm

The scene command uses a transform, Fade. (or Dissolve, I cannot remember which)
This may be why.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor
Free Android GUI - Updated occasionally
Twitter
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py

tapanojum
Regular
Posts: 28
Joined: Tue Feb 27, 2018 4:33 am
Contact:

Re: Slight delay when webm videos play, why?

#7 Post by tapanojum » Mon Dec 09, 2019 6:39 pm

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.

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3636
Joined: Mon Dec 14, 2015 5:05 am
Location: Your monitor
Contact:

Re: Slight delay when webm videos play, why?

#8 Post by Imperf3kt » Mon Dec 09, 2019 7:27 pm

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.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor
Free Android GUI - Updated occasionally
Twitter
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py

tapanojum
Regular
Posts: 28
Joined: Tue Feb 27, 2018 4:33 am
Contact:

Re: Slight delay when webm videos play, why?

#9 Post by tapanojum » Mon Dec 09, 2019 7:52 pm

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.

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3636
Joined: Mon Dec 14, 2015 5:05 am
Location: Your monitor
Contact:

Re: Slight delay when webm videos play, why?

#10 Post by Imperf3kt » Mon Dec 09, 2019 8:35 pm

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
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor
Free Android GUI - Updated occasionally
Twitter
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py

rames44
Veteran
Posts: 232
Joined: Sun May 29, 2016 4:38 pm
Contact:

Re: Slight delay when webm videos play, why?

#11 Post by rames44 » Tue Dec 10, 2019 1:14 pm

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.

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3636
Joined: Mon Dec 14, 2015 5:05 am
Location: Your monitor
Contact:

Re: Slight delay when webm videos play, why?

#12 Post by Imperf3kt » Wed Dec 18, 2019 6:06 am

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"

Code: Select all

image white = "#fff"
and then adding this to your script (assuming your textbox is black)

Code: Select all

    scene white
    pause
    scene white
You can make it more apparent by lengthening the default config.window_show_transition and config.window_hide_transition
Try 1 second.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor
Free Android GUI - Updated occasionally
Twitter
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py

rayminator
Miko-Class Veteran
Posts: 754
Joined: Fri Feb 09, 2018 12:05 am
Location: Canada
Contact:

Re: Slight delay when webm videos play, why?

#13 Post by rayminator » Wed Dec 18, 2019 5:11 pm

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

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], span4ev