Translations of this page:

Ogg Theora - Or, how to convert them and have them play correctly.

Wintermute supports the use of Ogg Theora video files, which are very well compressed without losing much quality. The problem I had was that none of the methods outlined anywhere I could find for converting an AVI/MOV file to Ogg Theora was actually working on a level I'd call "professional" - very frustrating.

The problem seemed to be this (as far as I could tell): though many utilities could convert AVI to Theora, they were often buggy and had strict requirements for successful transfers, and the most stable utility I've found - "ffmpeg2theora" - requires that the AVI use specific codecs for sound and video for the conversion to be successful. Unfortunately, AVI seems to act only as a container for multiple combinations of Audio/Video codecs, making it difficult to get a video that uses the right stuff for conversion.

So, I've taken it upon myself to make this small guide Roll Eyes. This is the method I use to get Theora files into the engine that are small (a 2-min video file is 3MB-8MB, depending on resolution) and that work, as a big plus, with optional subtitles.

Tools you'll need

Rad Video Tools
Virtual Dub
SubtitlesK5ky (Subtitle Software)

And at least 10GB of free hard drive space (some temporary space for LARGE uncompressed video files).

What you need to do

1) Open RadVideo.exe and select the source file in the browser. Click the button "Convert a File".

2) Make sure to check both "Convert Video" and "Convert Audio". Set the output file to "AVI File" and click "Convert".

3) When a Video Compression dialog pops up, choose "Full Frames (Uncompressed)" and hit OK. Note that this new file will be VERY LARGE, probably in the 2-5Gb range or higher.

4) Run VirtualDub.exe and open the Uncompressed AVI file. Here, you can use the "Video→Filters…" menu to fix up the video if needs be (resizing, contrast, grayscale, etc). VirtualDub's resizing utility is particularly nice because it doesn't limit resolutions to DVD and movie resolutions like a lot of editing software does.

4b) If you plan on using subtitles, it is vital that you know how many frames per second the video file is, or the subtitles will show up at the wrong time. Use "Video→Frame Rate…" to find the current frame rate or to change the frame rate (25 is easy to remember, but I IMAGINE changing it could cause the audio and video to unsync in some situations…though I have no proof of this, change at own risk). If nothing else, write down the current frame rate to use later.

5) Be sure that the "Video→Compression…" has the "Uncompressed RGB" option selected and use "Save as AVI…" from the file menu to save it. You can't overwrite your other file because virtual dub is still using it Tongue. Depending on what you did to the file, the new file may be even larger.

(This is why you need so much hard drive space. Grin)

6) "ffmpeg2theora.exe" is a drag-and-drop utility, so drag you're Uncompressed, Resized AVI file onto the icon and wait for it to convert. It will automatically save a .OGG file in the same directory as the original. The .OGG file will be very small by comparison; for a test run, I used a 100MB file…it is now 300kb with no noticeable visual or audio loss. Nice!

(NOTE: .OGG files do not save the FPS (frames per second) in the property dialog…this can be important to know, so it might be a good idea to put the FPS in the comments section of the property dialog for future use.)

(At this point, the video file is ready to be used in the engine using the PlayTheora command. However, the subtitle stuff is pretty cool, and will make your game that much more professional.)

7) Run "SubtitlesK5ky.exe" - this program is pretty bizarre, but it works - and use "Player→Open File…" to select the ogg file. You'll need to switch to "All Files" to see the ogg file, but as long as you have the ogg codec installed, it will work. When it asks for the number of frames per second, USE THE RIGHT NUMBER. If you don't, the subtitles will display at the wrong time when you run it.

Cool Basically, the "Compendium" window shows the entire sequence. When you play the movie, there is a box at the bottom of the main window marked "Actual Frame:" - this shows the frame the video is on at any given point. You put the "Actual Frame" values into the "From" and "To" text boxes. For example, if a person in the movie starts saying "Hello" at frame 34 and ends at frame 45, you'd put 34 and 45 in the "From" and "To" boxes respectively, and then "Hello" into the subtitle box. There are a lot of buttons, but the ones that you'll use a lot are the ones with two rectangles in them in the main window; these insert a new subtitle. After you've inserted a few of subtitles, you can play back the movie and the subtitle will light up when it will show up during the movie, so you can be sure it works.

(NOTE: You can also do SUB files with a simple text editor. To do the above in a text editor, you'd insert "{34}{45}Hello")
(NOTE: It's also a good idea to fill the frames you don't have anything displaying with a space, so that you know nothing will show when it's not supposed to)

An example .SUB file is as simple as:
{1}{1} 25 ←-The program author suggests that FPS is first line of the SUB for reference.
{36}{50} Who's there?
{81}{96} Hmm…must have been nothing.

9) When you're done, use "File→Save" and save it as a .SUB file in the same directory as the video. The program will give you a message that basically says "You can't save until you register, unless you really have to." (WTF?) and then you can save.

And you are done! Play the ogg file in game, watch the subtitles show up on cue (unless you have them turned off) and pat yourself on the back. Since the subtitles are a separate file and not part of the movie, they can be turned off and also translated into different languages for localization. Sure, you might get away with just using ffmpeg2theora on everything, but chances are you'll get garbage, it won't be the right size, the audio won't work, or everything will be out of sync. This method ensures that the converted file IS the original taking up less space.

NOTE: And remember to delete those Uncompressed AVI files after the conversion, or you will be using a good 10GB for every file. Not good.

I hope this was helpful, and have fun!

kbase/tranzaudiosimple.txt · Last modified: 2017/12/03 14:48 by Indra Anagram
Recent changes RSS feed Creative Commons License Driven by DokuWiki