Image to video stutter/predicting video

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
yurikha
Newbie
Posts: 5
Joined: Sat Dec 28, 2019 2:01 pm
Contact:

Image to video stutter/predicting video

#1 Post by yurikha »

Hello, i have 3 webm video files encoded with vp9 that are being transitioned into from webp pics, the first movie transitions well, but the other two stutter slightly right when they transitioned to, the music thats playing also stutters and is more noticeable. (stuttering is worse on an older machine)

First video is 16MB -14 sec, second 12MB - 4sec, third 7MB -3 sec. I know the file sizes are big but i didnt want to compromise on quality for the intro.

I have tried to see if the webms load using image load log when i tried to predict them, and while i am getting the confirmation checkmarks for them, the textures or image cache dont increase, caching works for pictures.(honestly i dont even know if you can cache video files)

Video doesent stutter as much when i encode it lower quality, or if i play it using play movie.

I predicted videos using

Code: Select all

$ renpy.start_predict("images/concert*.*")
to get them to show in the load log, and $ renpy.start_predict_screen("goddess_book")(i didnt know what the difference was so i tried both), it also predicted files as $ renpy.start_predict("intro_goddess_book.webm") and it gave me checkmarks even tho it didnt cache and even tho i could change the webm format to anything, without text after . it would not predict.

I know its a mess but for me trying stuff is the best way to learn.

I apologise for the wall of text, but i feel like i have to include everything in case there is an interaction i dont know about since i am new to this.

Code: Select all

image goddess_walktocam = Movie(play="video/intro_goddess_walktocamera.webm", loop=0)
image goddess_book = Movie(play="intro_goddess_book.webm", loop=0)
image goddess_mark = Movie(play="video/intro_goddess_mark.webm", loop=0)

Code: Select all

$ renpy.start_predict("video/test*.*")
    show goddess_static_far with Dissolve(0.5)

    goddessdream "Yes,{w=0.5} I think you will do."
    window hide

    $ renpy.start_predict_screen("goddess_book")

show goddess_walktocam:

        alpha 0.5
        linear 0.5 alpha 1.0
        time 13.5
        #"intro/goddess_intro_walk_chat.webp" with dissolve
        linear 0.5 alpha 0.0

    goddessdream "{cps=60}I have been searching for a while now for someone...{w=1.0} suitable.{w=5.5}{nw}{/cps}" with Dissolve(2.0)
    goddessdream "{cps=60}And i think i have found my next keeper.{w=4.7}{nw}{/cps}" with dissolve

    show goddess_intro_walk_chat with dissolve

    goddessdream "Tell me, what is your name?"
    $ me = renpy.input("Her imposing presence urges me to answer, i do not feel forced, rather i feel... {w=0.5}guided, what could she be?")
    if me== "":
        $ me = renpy.input("I have better not refuse her, i have a feeling she already knows.")
        if me == "" or me == " ":
            $ me = "peter haggot"

    me "[me]."

    scene goddess_intro_walk_chat_2 with Dissolve(0.3)
    goddessdream "I wish to give you a gift [me]."

    show goddess_intro_book with dissolve
    goddessdream "If you would accept it."

    #play movie "video/intro_goddess_book.webm"

    show goddess_book #vid2
    with dissolve
    pause 2.8

    #$ renpy.stop_predict("intro/intro_goddess_book.webm")

    show goddess_intro_book2 with Dissolve(1.0)
    pause

    show goddess_mark #vid3
    with dissolve

    goddessdream "{cps=60}Just...{w=0.3} {alpha=*0.5}step...{w=0.3}{nw}{/cps}{/alpha}"

    scene black with Dissolve(1.0)
    goddessdream "{alpha=*0.3}through...{/alpha}"

DragoonHP
Miko-Class Veteran
Posts: 758
Joined: Tue Jun 22, 2010 12:54 am
Completed: Christmas
IRC Nick: DragoonHP
Location: Zion Island, Solario
Contact:

Re: Image to video stutter/predicting video

#2 Post by DragoonHP »

renpy.start_predict_screen is used to predict screens and not individual files so you can safely remove that from your code.

And while I'm not sure what's happening, please try renpy.start_predict("goddess_book") and see if that helps.

yurikha
Newbie
Posts: 5
Joined: Sat Dec 28, 2019 2:01 pm
Contact:

Re: Image to video stutter/predicting video

#3 Post by yurikha »

Thank you for the reply, $ renpy.start_predict_screen("goddess_book") was left over from testing, i have used renpy.start_predict("goddess_book") too with no results, over the following days i tried probably hundreds of different encoding variants for encoding to see whats happening, the cutoff where audio seemed to stutter with vp9 was about 50% quality 5k bitrate in adobe media encoder, increasing the quality over this would start stuttering audio on transitions to the video increasing in severity up to a point(more like a slight popping noise), i watched task manager and when the video would start playing python would spike at about 35% cpu usage, other than that vp8 does not seem to produce the same problems no matter how big the bitrate or quality i used.

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

Re: Image to video stutter/predicting video

#4 Post by rames44 »

Just speculating, but I wonder if your system has drivers or codecs that allow hardware acceleration for vp8 but not for vp9. Software-only decoding for vp9 could probably cause this type of effect as the frame sizes increase (which they would as you increased the nitrate)

yurikha
Newbie
Posts: 5
Joined: Sat Dec 28, 2019 2:01 pm
Contact:

Re: Image to video stutter/predicting video

#5 Post by yurikha »

I have the k lite codec pack, player plays video files normally with a big exception, when i encode files as vp9 it slightly changes yellows to a darker shade closer to orange, vp8 does not cause that, but stranger still, when i play the same video files in renpy the colour is back to normal, i tried several different players, with no effects enabled, so i think renpy might be decoding the videos differently. I also tried the game on 3 different machines and the audio stutter was the same.

But by far the thing that irks me the most is that one video file stutters the audio while the other doesent even though they were encoded the same way with similar settings and close enough bitrate.

Another weird issue, if i load the game from the main menu to where the transition happens and play it i get audio stutter, if i start the game and THEN load the same portion the stutter does not happen, unless i rollback the scene or shift+r which causes the stutter again while playing it.

The video file thats fine is right at the start of the game, third scene, the other two that break the audio happen a little after like in the code.

Im gonna include the video info for each file in case someone has any clue, or maybe just curious, and thank you again for the replies and suggestions.

good video
General
Complete name : F:\renpy projects\Anime heroine island\game\video\intro_goddess_walktocamera.webm
Format : WebM
Format version : Version 4
File size : 16.6 MiB
Duration : 14 s 17 ms
Overall bit rate : 9 919 kb/s
Encoded date : UTC 2020-02-11 07:31:19
Writing application : fnord WebM for Premiere, built Jun 15 2017
Writing library : libwebm-0.2.1.0

Video
ID : 1
Format : VP9
Codec ID : V_VP9
Duration : 14 s 22 ms
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 60.119 FPS
Language : English
Default : Yes
Forced : No

Audio
ID : 2
Format : Opus
Codec ID : A_OPUS
Duration : 14 s 17 ms
Channel(s) : 2 channels
Channel layout : L R
Sampling rate : 48.0 kHz
Compression mode : Lossy
Language : English
Default : Yes
Forced : No

bad video

General
Complete name : F:\renpy projects\Anime heroine island\game\video\intro_goddess_book.webm
Format : WebM
Format version : Version 4
File size : 3.32 MiB
Duration : 4 s 0 ms
Overall bit rate : 6 953 kb/s
Encoded date : UTC 2020-02-20 20:55:03
Writing application : fnord WebM for Premiere, built Jun 15 2017
Writing library : libwebm-0.2.1.0

Video
ID : 1
Format : VP9
Codec ID : V_VP9
Duration : 3 s 992 ms
Bit rate : 6 670 kb/s
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 60.119 FPS
Bits/(Pixel*Frame) : 0.054
Stream size : 3.17 MiB (96%)
Language : English
Default : Yes
Forced : No

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

Re: Image to video stutter/predicting video

#6 Post by rames44 »

Only one observation - do you really need 60fps? If you ran at, say, 30fps it feels like that would reduce the strain on the whole video decode chain, leaving more CPU for the audio. Probably also would allow you to reduce the bitrate. 60fps at 1920x1080 might just be pushing the limits of what Renpy can do on your system.

Just speculation...

yurikha
Newbie
Posts: 5
Joined: Sat Dec 28, 2019 2:01 pm
Contact:

Re: Image to video stutter/predicting video

#7 Post by yurikha »

My system should be able to handle it, but i went ahead and tested it anyway, rendered the same file as 30fps and lower bitrate, same popping noise.

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

Re: Image to video stutter/predicting video

#8 Post by rames44 »

Ok, well it was a nice theory.... LOL. But it doesn’t do it if you use VP8?

yurikha
Newbie
Posts: 5
Joined: Sat Dec 28, 2019 2:01 pm
Contact:

Re: Image to video stutter/predicting video

#9 Post by yurikha »

VP8 is fine even at very high bitrate, but the quality suffers a lot.

I went and uploaded the two VP9 video files, in case you or anyone wants to plug them into renpy and run them with music playing from renpy to see if you get any weird noises, the smaller file is the one thats causing the issue, but both are encoded similarly.

WARNING the character is in skimpy clothing
https://mega.nz/#F!AuA2GYgL!_0TzHdDCMfIhzQQF8Fx0oQ

Post Reply

Who is online

Users browsing this forum: Google [Bot], Sugar_and_rice, voluorem