Theora playback

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
User avatar
nibl
Regular
Posts: 36
Joined: Sun Feb 14, 2010 2:59 am
Projects: Lit - Literacy Teaching Game
Contact:

Theora playback

#1 Post by nibl » Fri Feb 19, 2010 9:14 pm

I'm having trouble with Ogg Theora playback in Ren'Py. Take a look at this theora video (very small and 2 secs). Plays inside Firefox 3.5+, or download it and try in Ren'Py.

Plays fine in FF, but in Ren'Py it looks all weird in Fullscreen mode and as a displayable it only plays audio (I used the example code in the reference, just replaced the filename). I tried both the extensions .ogv and .ogg in Ren'Py.

http://wordit.com/renpy/windsor_test.ogg

Code: Select all

label start:
    $ renpy.movie_cutscene("windsor_test.ogv")

(yes, strictly this should be .ogv , but the server's mime type works with .ogg and FF knows it's video)

User avatar
duanemoody
Regular
Posts: 100
Joined: Fri Oct 02, 2009 2:32 pm
Projects: American Jurassic
Organization: Pier 7 Media
Location: Arizona
Contact:

Re: Theora playback

#2 Post by duanemoody » Fri Feb 19, 2010 11:02 pm

I don't know much about Theora but VLC shows three streams where I expect to see two:
Screen shot 2010-02-19 at 8.00.21 PM.png
I suspect Firefox is more robust in parsing out streams, but I have no idea what stream 0 is or why it's there. What options are you encoding your media with?

Counter Arts
Miko-Class Veteran
Posts: 646
Joined: Fri Dec 16, 2005 5:21 pm
Completed: Fading Hearts, Infinite Game Works
Projects: Don't Save the World
Organization: Sakura River
Location: Canada
Contact:

Re: Theora playback

#3 Post by Counter Arts » Fri Feb 19, 2010 11:28 pm

I had to use an older version of mpeg2theora to make mine work. There was some new features in the newer ones.
Fading Hearts is RELEASED
http://www.sakurariver.ca

User avatar
nibl
Regular
Posts: 36
Joined: Sun Feb 14, 2010 2:59 am
Projects: Lit - Literacy Teaching Game
Contact:

Re: Theora playback

#4 Post by nibl » Sat Feb 20, 2010 7:07 am

Thanks, so it seems to be the encoding. I used ffmpeg2theora version 0.25. Either way we need to know how the streams should be packed into the ogg container. We don't know what mechanism Ren'Py is using for playback do we?

@Counter Arts, would you mind posting how your Theora looks in vlc or any other player which outputs the "ingredients" of the container?

User avatar
PyTom
Ren'Py Creator
Posts: 15893
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Theora playback

#5 Post by PyTom » Sat Feb 20, 2010 11:20 am

Ren'Py is using ffmpeg 0.5. I'm strongly thinking of bumping that version number shortly.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

Counter Arts
Miko-Class Veteran
Posts: 646
Joined: Fri Dec 16, 2005 5:21 pm
Completed: Fading Hearts, Infinite Game Works
Projects: Don't Save the World
Organization: Sakura River
Location: Canada
Contact:

Re: Theora playback

#6 Post by Counter Arts » Sat Feb 20, 2010 1:01 pm

When I said new features, I meant that there was a newer libtheora file. I don't think renpy can play libtheora 1.1 because of the newer encoding features. If there's a flag to use only libtheora 1.0 then try it. If not then use ffmpeg2theora 0.24
Attachments
settingsTheora.jpg
Fading Hearts is RELEASED
http://www.sakurariver.ca

User avatar
nibl
Regular
Posts: 36
Joined: Sun Feb 14, 2010 2:59 am
Projects: Lit - Literacy Teaching Game
Contact:

Re: Theora playback

#7 Post by nibl » Sun Feb 21, 2010 7:35 am

@ PyTom how about offering the same ffmpeg version the current Ren'Py is using as a download. That way any files created will be in unison with Ren'Py. The reference could point to the ffmpeg download.
Since ffmpeg is constantly changing and people get different builds with different codec support, wouldn't it be easier for users if there were a Ren'Py ffmpeg build?


@ Counter Arts, (edit) Many Thanks, I just tested the exact same AVI+PCM file with the 0.24 version of ffmpeg2theora and it works with Ren'Py 6.10.2. Your VLC screenshot also tells us that it was not the amount of streams. It has to be a change in libtheora?


Btw, Mozilla have been pushing Theora and trying to get Youtube to use it, but whether they can convince Google, no idea. As to the quality of Theora, I think it has been improved recently. There is a page, possibly linked from Mozilla, which shows some tests with comparable formats and the quality is mostly on par. In some cases lower, in others better! It all depends on the old file size versus quality choice. So it's worth looking into the latest developments.

Bocom
Newbie
Posts: 23
Joined: Sat Aug 08, 2009 2:06 pm
Projects: Yeah, 6-7 or more... <_<
Location: Sweden
Contact:

Re: Theora playback

#8 Post by Bocom » Sun Feb 21, 2010 10:36 am

PyTom wrote:Ren'Py is using ffmpeg 0.5. I'm strongly thinking of bumping that version number shortly.
Yes, please! Also, please enable H.264 in it. Pretty please?

Also, the newer ffmpeg versions are faster and more efficient. As you saw in a thread of mine, I got it to compile and get used in Ren'Py just fine, so it's not like you have to change your current implementation.
nobl wrote:Btw, Mozilla have been pushing Theora and trying to get Youtube to use it, but whether they can convince Google, no idea. As to the quality of Theora, I think it has been improved recently. There is a page, possibly linked from Mozilla, which shows some tests with comparable formats and the quality is mostly on par. In some cases lower, in others better! It all depends on the old file size versus quality choice. So it's worth looking into the latest developments.
Theora as a format can't improve in quality, only the encoders. And even then, it has a looooooooong way to go if it ever wants to beat H.264.

There was a test that showed that H.264 (encoded with x264, which is the best encoder for H.264) beat Theora in low-bitrate quality. The tester even disabled some stuff in x264 to make the encoders more alike in terms of encoding.

User avatar
PyTom
Ren'Py Creator
Posts: 15893
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Theora playback

#9 Post by PyTom » Sun Feb 21, 2010 10:52 am

Bocom wrote:Yes, please! Also, please enable H.264 in it. Pretty please?
I did some research as to which formats Linux distros think are safe to include, patent wise. IIRC, mpeg is allowed because there's a commitment to not go after open-source decoders. But there's no similar commitment when it comes to h.264, so I don't want to risk it.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

User avatar
nibl
Regular
Posts: 36
Joined: Sun Feb 14, 2010 2:59 am
Projects: Lit - Literacy Teaching Game
Contact:

Re: Theora playback

#10 Post by nibl » Sun Feb 21, 2010 10:57 am

I think Theora might be fine. I just got excellent quality once I figured out how to achieve it and got the right tools. The important thing is to start with raw video if possible and not go via any other codecs in between which degrade the final quality immensely.

Compare this smaller resolution first attempt with the improved one below (124kb). You can see this one causes "smudges" around the movements:

http://wordit.com/renpy/windsor_test.ogg

Now improved in a larger size with top quality (568kb):

http://wordit.com/renpy/w4-muxed.ogg

I can't really fault the second Theora video. And this was created with the older ffmpeg2theora version so it runs in Ren'Py. It also plays in the same quality in Ren'Py as in Firefox, which note, was not the case with the lower-quality file.

This is what I did:

- Mux the raw video avi and pcm wav in ffmpeg

Code: Select all

ffmpeg.exe -i vidfile.avi -i audiofile.wav -vcodec rawvideo -acodec pcm_s16le file-muxed.avi

- Convert muxed file to theora with ffmpeg2theora, using a version compatible with renpy, and set quality to 10, highest.

Code: Select all

ffmpeg2theora-0.24.exe -v 10 file-muxed.avi
- In Ren'Py set size not larger than resolution. A smaller size than video res can also affect quality, e.g.

Code: Select all

image movie = Movie(size=(620, 460), xalign=0.0, yalign=0.0)

label start:
    scene black
    show movie at Position(xpos=0.0, ypos=0.0, xanchor='left', yanchor='top')
    play movie "file.ogv"

    pause
    stop movie

User avatar
duanemoody
Regular
Posts: 100
Joined: Fri Oct 02, 2009 2:32 pm
Projects: American Jurassic
Organization: Pier 7 Media
Location: Arizona
Contact:

Re: h.264

#11 Post by duanemoody » Sun Feb 21, 2010 6:41 pm

PyTom wrote:I did some research as to which formats Linux distros think are safe to include, patent wise. IIRC, mpeg is allowed because there's a commitment to not go after open-source decoders. But there's no similar commitment when it comes to h.264, so I don't want to risk it.
A chunk of my job involves media delivery using Flash and Flash Media Server. We chose to go with MP4 as our internal video format over FLV because more tools output MP4 and there are more standards for including metadata.

That said, MP4/h.264 are encrusted with patents to the point that they require an entire licensing agency clearinghouse to collect royalties, and as it stands right now MPEG-LA feels entitled to collect royalties on:
  • any software that encodes or decodes MPEG-4 (e.g. media players)
  • any software or hardware that implements it as a streaming or broadcasting medium (e.g. servers, television broadcasting hardware)
  • any broadcaster (OTA, cable, satellite) using it in digital television
  • and any website that streams it (with a sole exception granted to nonprofits who do not charge for viewing)
This is the reason why Firefox refuses to implement h.264 in HTML5's VIDEO tag, and went with Theora support instead.
ffmpeg's own legal page waffles on the issue of whether their support for h.264 is violating any patents.

Post Reply

Who is online

Users browsing this forum: No registered users