Queue movies

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
Eliont
Regular
Posts: 111
Joined: Thu Aug 06, 2009 6:51 am
Completed: Begin of Evangelion, SAO - Smile of the black cat, SAO - Project "Ceramic Heart", Time for Dragons
Location: Russia
Contact:

Queue movies

#1 Post by Eliont »

Is there any way to queue movies (different files) with transitions between them like queue music works ?

Thanks in advance.

User avatar
hell_oh_world
Miko-Class Veteran
Posts: 777
Joined: Fri Jul 12, 2019 5:21 am
Contact:

Re: Queue movies

#2 Post by hell_oh_world »

Code: Select all

image vid1 = Movie(play="vid1.webm")
image vid2 = Movie(play="vid2.webm")

label queue_videos(*video_details):
  $ vd = list(video_details)
  while vd:
    $ v, d, t = vd.pop()
    scene expression v with t
    pause d

  return

label start:
  call queue_videos(
    ("vid1", 5.0, fade),
    ("vid2", 2.0, None))
This one is through a helper label, you can call this label and pass a variable amount of tuples () separated by commas , containing the (video name, video duration, transition).

Eliont
Regular
Posts: 111
Joined: Thu Aug 06, 2009 6:51 am
Completed: Begin of Evangelion, SAO - Smile of the black cat, SAO - Project "Ceramic Heart", Time for Dragons
Location: Russia
Contact:

Re: Queue movies

#3 Post by Eliont »

Thanks, though i need to do it without specifying video length, otherwise should be fine.
May be i can try to get video length from pygame.movie.Movie.get_length.

Do you know, is renpy Movie - pygame.movie.Movie, and therefore have get_length() method ?

User avatar
hell_oh_world
Miko-Class Veteran
Posts: 777
Joined: Fri Jul 12, 2019 5:21 am
Contact:

Re: Queue movies

#4 Post by hell_oh_world »

i don't think so since Movie displayable is a whole lot different from an ordinary pygame movie, add that the movie module doesn't exist in renpy's version of pygame. Might be wrong though.
You can easily search online on how to find a video's duration, then modify the code a bit according to what you want.
But I think some of them might involve third party libs so yeah, you might need to install those inside `game/python-packages` if they're python libs.

Eliont
Regular
Posts: 111
Joined: Thu Aug 06, 2009 6:51 am
Completed: Begin of Evangelion, SAO - Smile of the black cat, SAO - Project "Ceramic Heart", Time for Dragons
Location: Russia
Contact:

Re: Queue movies

#5 Post by Eliont »

Found

Code: Select all

renpy.music.get_duration(channel=u'music')
Returns the duration of the audio or video file on channel. Returns 0.0 if no file is playing on channel.
But can't get it to work - renpy.music.get_playing correctly show file name, renpy.music.get_duration always says 0.0, and renpy.music.play('movies/movie.webm',channel='movie',loop=False) seems totally lock screen until played.

Well, music.play webm on movie channel mostly works as wanted queue too, but then there are other question - is it possible to show / hide it with transition.

User avatar
Alex
Lemma-Class Veteran
Posts: 3094
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Queue movies

#6 Post by Alex »

Eliont wrote: Sun Feb 28, 2021 12:05 pm Found

Code: Select all

renpy.music.get_duration(channel=u'music')
Returns the duration of the audio or video file on channel. Returns 0.0 if no file is playing on channel.
But can't get it to work - renpy.music.get_playing correctly show file name, renpy.music.get_duration always says 0.0, and renpy.music.play('movies/movie.webm',channel='movie',loop=False) seems totally lock screen until played.

Well, music.play webm on movie channel mostly works as wanted queue too, but then there are other question - is it possible to show / hide it with transition.

Not tested (of course), but try 'movie' channel - https://www.renpy.org/doc/html/movie.html#Movie

Code: Select all

renpy.music.get_duration(channel=u'movie')

Eliont
Regular
Posts: 111
Joined: Thu Aug 06, 2009 6:51 am
Completed: Begin of Evangelion, SAO - Smile of the black cat, SAO - Project "Ceramic Heart", Time for Dragons
Location: Russia
Contact:

Re: Queue movies

#7 Post by Eliont »

Can not use this command during any video playback, as it fully lock all controls, and i dont know how to get it to work with Movie displayable.

Initial idea was about to get duration of webm file without playing it, to show Movie displayable with transition, but move to next video or line of code when video ends without manually setting pause time.

Post Reply

Who is online

Users browsing this forum: Google [Bot], henne, Ocelot