How to add movie to game as an AVI file?

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
amyXD
Newbie
Posts: 2
Joined: Mon Mar 02, 2020 10:29 pm
Contact:

How to add movie to game as an AVI file?

#1 Post by amyXD » Fri Aug 21, 2020 3:29 pm

Hey everyone, I'm trying to display a short rain effect with an avi file, but it won't show up at all even when I used the sample code from the renpy documentation. My code before the start label is [image rain_effect = Movie(play="images/rain_effect.avi",][/code] , and before the texts, I have show rain_effect, but it's not showing at all. I made the avi file with after effects. (I probably don't have a soundtrack to the avi file, and I'm not sure how to add a silent track to it) Please help. Thank you in advance. :D

User avatar
SypherZent
Veteran
Posts: 330
Joined: Fri Sep 02, 2016 3:14 am
Completed: Multiverse Heroes, Space Hamster in Turmoil
Soundcloud: Chrysopoeist
Location: Puerto Rico
Contact:

Re: How to add movie to game as an AVI file?

#2 Post by SypherZent » Sun Aug 23, 2020 11:03 pm

You need to export the .avi container format using .mp4 codec for video, and vorbis codec for audio. Check Ren'py documentation for other acceptable codecs here: https://www.renpy.org/doc/html/movie.html

If it still doesn't work, export the video with a silent audio track that matches the video duration. Ren'py uses video's audio for timestamp handling.
Creator of Multiverse Heroes & Space Hamster in Turmoil

Want me to code your game?
Check my services thread!

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

Re: How to add movie to game as an AVI file?

#3 Post by Imperf3kt » Mon Aug 24, 2020 4:05 am

SypherZent wrote:
Sun Aug 23, 2020 11:03 pm
You need to export the .avi container format using .mp4 codec for video, and vorbis codec for audio. Check Ren'py documentation for other acceptable codecs here: https://www.renpy.org/doc/html/movie.html

If it still doesn't work, export the video with a silent audio track that matches the video duration. Ren'py uses video's audio for timestamp handling.
Note that mpeg-4 part 10 (.mp4) is not supported.
From the Ren'Py docs:
inside the following container formats:

WebM
Matroska
Ogg
AVI
Various kinds of MPEG stream.
.avi should work fine as long as you are exporting it as Xvid or Divx (not DX50 or h263, etc)
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

User avatar
SypherZent
Veteran
Posts: 330
Joined: Fri Sep 02, 2016 3:14 am
Completed: Multiverse Heroes, Space Hamster in Turmoil
Soundcloud: Chrysopoeist
Location: Puerto Rico
Contact:

Re: How to add movie to game as an AVI file?

#4 Post by SypherZent » Mon Aug 24, 2020 4:30 pm

The videos I created for my current game, work fine, fully tested.
I'm 99% sure that I export them from Shotcut using:

Video Codec: mp4
Audio Codec: vorbis
Container Format: .avi

The documentation says that Ren'Py IS capable of using .mp4 video codec.

Code: Select all

Ren'Py is capable of using libav (included) to play movies using the video codecs:

VP9
VP8
Theora
MPEG-4 part 2 (including Xvid and DivX)
MPEG-2
MPEG-1

In my experience this method has been working for me. I use a .avi in my Main Menu with images on top and buttons on top and everything.

The section you posted is regarding the Container Format (not the Video Codec).

In the 1% that I am wrong, you can just change the Video Codec to .mp2 instead of .mp4, but I am 99% certain that I use .mp4 for my game videos.

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

Re: How to add movie to game as an AVI file?

#5 Post by Imperf3kt » Mon Aug 24, 2020 5:53 pm

.mp4 is not a codec, it's a container.
What you're thinking of is AVC / H264 which is not officially supported.

I am unable to find the post where Pytom explicitly states this, even using google. Was it removed?
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

User avatar
SypherZent
Veteran
Posts: 330
Joined: Fri Sep 02, 2016 3:14 am
Completed: Multiverse Heroes, Space Hamster in Turmoil
Soundcloud: Chrysopoeist
Location: Puerto Rico
Contact:

Re: How to add movie to game as an AVI file?

#6 Post by SypherZent » Mon Aug 24, 2020 6:06 pm

I'm not sure what you mean.

The Ren'Py documentation clearly states above "using the video codecs".
In the list is MPEG-4 part 2 (including Xvid and DivX)

Here is exactly the Codec setting in Shotcut.
Image

Note where it says "Format" it is set to avi.
"Format" is container format. The resulting file will be in this format.

The Video Codec is in the "Codec" tab next to the Video tab.
The Audio Codec is within the "Audio" tab, next to "Codec" tab (obscured by the popup menu in the above image).

Maybe I am saying it wrong. I mean .mpeg4 when I say .mp4.
To me they are one and the same. Sorry for any confusion.

What works for me is:

Container Format: .avi
Video Codec: mpeg4
Audio Codec: vorbis

I use these settings and the videos in my game run perfectly fine.

I also export the videos with silent audio track set to the duration of the movie file (I just duplicate an 8 second track to fill the movie duration, then truncate the final duplicate if it goes over the movie duration so that it perfectly matches the video track).

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

Re: How to add movie to game as an AVI file?

#7 Post by Imperf3kt » Mon Aug 24, 2020 6:09 pm

I found out why the post I thought was by Pytom wasn't showing up - it wasn't pytoms post I was recalling.
viewtopic.php?f=8&t=42139&p=440909#p440916


Anyway, yes, mpeg4 and .mp4 are two different things.
You may also want to avoid mpeg codec altogether though, as it's a licensed format and has fees associated with it.
http://www.mpegla.com/main/programs/M4V ... ement.aspx
Where End User pays for MPEG-4 Video
o Title-by-Title - 12 minutes or less = no royalty; >12 minutes in length = lower of (a) 2% of first Arm’s-Length Sale or (b) $0.02 per
title. Licensees are (a) replicators of physical media and (b) direct sellers of other media.
o Subscription (not Title-by-Title): 0-100,000 subs/year = no royalty;
>100,000-250,000 subs/year = $25,000; >250,000 – 500,000 subs/year = $50,000; >500,000-1M subs/year = $75,000; >1M – 5M subs/year = $100,000; >5M – 25M subs/year = $200,000; >25M subs = $300,000
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

User avatar
SypherZent
Veteran
Posts: 330
Joined: Fri Sep 02, 2016 3:14 am
Completed: Multiverse Heroes, Space Hamster in Turmoil
Soundcloud: Chrysopoeist
Location: Puerto Rico
Contact:

Re: How to add movie to game as an AVI file?

#8 Post by SypherZent » Tue Aug 25, 2020 1:09 am

If you google '.mp4' you get the Wikipedia article for "MPEG-4 Part 14".
Wikipedia wrote:MPEG-4 Part 14 or MP4 is a digital multimedia container format
That's why to me they are the same. I'm not really interpreting a difference when I say mpeg4 or .mp4.
Perhaps there's more to this than I know of.

In any case, is it the container format or the video codec that requires a license?

And how can someone verify that the video codec used to create a .avi file was indeed mpeg4?

And if it's possible to somehow extrapolate that mpeg4 was used as the video codec, say, from the .avi file's metadata, which of the other video codecs supported by Ren'Py do not require paying fees? (Nevermind, I found the answer to this one in the Movie documentation)
Ren'Py Documentation wrote:(Note that using some of these formats may require patent licenses. When in doubt, and especially for commercial games, we recommend using VP9, VP8, or Theora; Opus or Vorbis; and WebM, Matroska, or Ogg.)

User avatar
SypherZent
Veteran
Posts: 330
Joined: Fri Sep 02, 2016 3:14 am
Completed: Multiverse Heroes, Space Hamster in Turmoil
Soundcloud: Chrysopoeist
Location: Puerto Rico
Contact:

Re: How to add movie to game as an AVI file?

#9 Post by SypherZent » Tue Aug 25, 2020 10:21 am

Sorry for the double post, I just wanted to leave a concrete solution here.

As Imperf3kt mentioned, .mp4 is a proprietary format and subject to royalty fees, and it requires a proper license for redistribution.

So, here are the new parameters for outputting files using open source formats that are royalty-free and also fully compatible with Ren'Py.
These settings also work in Shotcut.

Container Format: .webm
Video Codec: libvpx-vp9
Audio Codec: vorbis

Side note: If you are using Shotcut to export movies, be aware it defaults the quality to about 60% in the "Codec" tab, so feel free to raise that value if you want to preserve the quality of the output video.

Post Reply

Who is online

Users browsing this forum: Bing [Bot]