RealText Tutorial version 0.1

Last update: Thursday, 09/09/1999
(Esta página se encontra disponível também em português)
(This page is also available in Portuguese)

This tutorial will try to give you the basics of RealText creation, with emphasis on "closed captioning", which can be used to create subtitles without changing the RealVideo file.

I want to thank JD for hosting this page some time ago in his site, and to be as motivated as I am with this subject. Also, his site for animes was great. I hope that he find the time to make it come back to life...

Please, send your comments, suggestions, complaints and questions to Ricardo M. Ferreira at ric@mpcnet.com.br.


Contents


Introduction (what's RealText?)

The RealText mark-up language is a new feature of the RealPlayer G2 that allows text streaming, in a similar way that RealVideo is a video streaming. With SMIL (another new feature), you can create presentations that combine together streams of audio, video and text.

You can set the text attributes (like typeface, size, color, ...), time when it appears and disappears, and position (including over or outside the video window area).

The RealText language is simple and intuitive, so it's really very easy to learn. You don't need previous experience with any other computer/scripting language, but if you have some knowledge of HTML it will be even easier for you to get started.


What you'll need

To follow this tutorial and create RealText files, all you'll need is:


Basic Stuff

The syntax of the RealText mark-up language is very similar to HTML. If you can write HTML, you already know the basics about RealText.

A RealText file is made of

An example of a single line inside of a RealText file is:

I'm gonna kick your sorry butt <font color="red">right now!!!</font>

The above line produce this:


Fig. 01 - It's as simple as that.

Notice that the text inside the "<" and ">" symbols are not displayed, but rather interpreted by the player, who see it as a command to change the color of the text font.

Now that you know a bit about how it works, here are some rules that you need to be aware of:

The wrong-and-right table:

Wrong Right
"Kodomo no omocha - 01.rt" "Kodomo_no_omocha-01.rt"
<FONT COLOR=WHITE> <font color="white">
<br> <br/>

Here is another simple sample:

She is <b> so sexy! </b> Well, at least <br/> as sexy as a cat-girl can be...


Fig. 02 - One tag pair, and one tag without pair in action.


The format of a RealText file

All your RealText files must have this pair of tags:

<window>
</window>

They are the first and the last line in your file, respectively. Everything else goes between these tags.

Here's a fully working example of a RealText file. Copy and paste it into your editor and save it as "example01.rt" (if you're using Wordpad, remember to always save as a "Text Document" type).

<window width="320" height="60">
I'm gonna kick your sorry butt <font color="red">right now!!!</font>
</window>

When you play this file, you'll have the result seen in fig. 01. The width and height values are the horizontal and vertical size of the window in pixels, respectively.

Play with the values and see what happens. Change the file to get the same result found in fig. 02.

Let's jump out of the basics this time. Save the text below to "example02.rt" and see how it plays.

<window width="320" height="140">
Countdown starts in five seconds...<br/>
<time begin="3"/>Get ready!<br/>
<time begin="5"/>Five...<br/>
<time begin="6"/>... four... <br/>
<time begin="7"/>... three...<br/>
<time begin="8"/>... two... <br/>
<time begin="9"/>... one...<br/>
<time begin="10"/>Launching the Battle Squadron!
</window>


Fig. 03 - An example of the <time> tag.

Of course, you will see it animated. :-)

As you can see, the <time> tag determines when a text will appear in the RealText window. The unit of the value is a second, and all time information are related to the beginning of the presentation.

You can type the value in seconds or in the format "dd:hh:mm:ss.xyz". So, if you want a text to appear 60 seconds after the start of the file, you can type any of the three lines below:

<time begin="60">60 seconds have been passed...
<time begin="1:00">60 seconds have been passed...
<time begin="00:01:00.0">60 seconds have been passed...

Our next section is all about tags.


Important Tags and Values

The attributes of your window and the text where it appears are both controlled by tags. With the appropriated value, your text can scroll from right to left, from bottom to top or do some other amazing things! :-) But here we will only look at those relevants to our intent.

Here's a piece of a real RealText file for you to use as reference:

<window type="generic"
 duration="13:20.9"
 height="30"
 width="320" 
 bgcolor="#808080"
 wordwrap="true" />

<font color="black" face="arial" size="2">
<center>

<time begin="00:00.0"/><clear/>Tradução e legenda em português: 08/1999<br/>
Ricardo M. Ferreira - ric@bestway.com.br
<time begin="00:04.0"/><clear/> 

<!-- the opening subtitles -->
<time begin="00:13.7"/><clear/>Kodomo no Omocha<br/>(Brinquedo de Criança)
<time begin="00:16.7"/><clear/><font color="#008040"><b>O boato sobre eu te amar é verdade, é sim.
<time begin="00:22.6"/><clear/> 
<time begin="00:23.8"/><clear/>Você não consegue ignorar também.
<time begin="00:26.1"/><clear/> 

</b>
</center>
</font>
</window>

What does it mean?

<window> ... </window>

Have I told you that this tag is present in every RealText file? It will set the window size, type, color, duration of the RealText presentation and other things.

All values are rather self-explanatory:

<font> ... </font>

The <font> tag changes the default attributes of the font.

<center> ... </center>

Guess what? Text between this pair of tags is centralized horizontally.

<clear/>

After this tag, all text inside the window disappears, and any new text appears at the default position (top-left corner of the window, if your window type is "generic").

<br/>

Forces a line break. The next text will appear in the following line.

<b> ... </b>

Makes a text bold.

<i> ... </i>

Makes a text italic.

<u> ... </u>

Underlines a text.

<!-- ... -->

If you want to insert a comment in the file, put it inside this tag. It will simple be ignored by the RealPlayer.


Color names and codes
white (#FFFFFF) silver (#C0C0C0) gray (#808080) black (#000000)
yellow (#FFFF00)fuchsia (#FF00FF)red (#FF0000) maroon (#800000)
lime (#00FF00) olive (#808000) green (#008000)purple (#800080)
aqua (#00FFFF) teal (#008080) blue (#0000FF) navy (#000080)
Table extracted from the RealText Authoring Guide


To show the "<", ">" and "&" characters in your subtitle, you must use a "character entity".

Glyph Syntax Description
< &lt; "Less than" sign
> &gt; "Greater than" sign
& &amp; Ampersand
(non breaking space) &nbsp; Non breaking space

For example, the following line

Calling &lt;Mr. Shinji &amp; Mrs. Rei&gt;

... will look like this in the RealText window:

Calling <Mr. Shinji & Mrs. Rei>


The SMIL Presentation

So far we have covered only the RealText itself. But how do we put it together with the video?

To accomplish this, we must create a SMIL file that contains information about your presentation, as the name of the files it will play, and their window's position and size on screen.

All basic rules for a RealText files apply to a SMIL file (except that the extension must be ".smi" or ".smil"). Here's a complete example:

<smil>

   <head>
      <meta name="title" content="Ep. 01 - Kodomo no Omocha (Brinquedo de Criança)" />
      <meta name="author" content="Ricardo M. Ferreira - ric@bestway.com.br" />
      <meta name="copyright" content="(c) 1999" />
      <layout>
         <root-layout width="320" height="270" />
         <region id="video_region" width="320" height="240" left="0" top="0" />
         <region id="text_region" width="320" height="30" left="0" top="240" />
      </layout>
   </head>

   <body>
      <par>
         <textstream src="kodomo_ep1part1.rt" region="text_region" fill="freeze" />
         <video src="kodomo_ep1part1.rm" region="video_region" fill="freeze" />
      </par>
   </body>

</smil>

Let's look at the meaning of each tag:

<smil> ... </smil>

All SMIL files must begin and end with this tag pair.

<head> ... </head>

In this section, some important information is defined in other tags.

<meta name/>

These tags are not required, and are used to add comments about your presentation. This text appears when you choose the option "About this Presentation" in the "Help" menu of the RealPlayer.

<layout> ... </layout>

Tags in this section will define the dimensions of the whole presentation and of each window.

<root-layout/>

This tag appears only once. The <width> and <height> values represent, respectively, the horizontal and vertical size, in pixels, of the whole presentation. All other windows must fit inside this area.

<region id/>

For each window/media clip in your presentation, you must insert one tag of this type. Each one will describe the region id (or name), its position and size. The unit of the values is a pixel, the top-left corner is position 0,0 and the position value increases going from left-right or top-bottom.

Remember to always use here, for the RealText region, the same <width> and <height> values you set in the <window> tag of the .rt file.

<body> .. </body>

This section describes the media clip files that are part of the presentation.

<par> .. </par>

You can have more than one of this pair of tags in a file, but in our case, there will always be just one. Media clips described between these tags are meant to start being played simultaneously.

<textstream/>  <video/>

These tags contain the filename of the media clip to be played in each region defined with the <region> tag.

The fill="freeze" value will keep the last frame visible when the presentation ends.

Now that you have your RealVideo (.rm), RealText (.rt) and SMIL (.smi) files, you can play the SMIL file to start your presentation.


Tips & Tricks


Links

A much longer and more comprehensive description of the RealText format (the "RealText Authoring Guide") can be found at http://service.real.com/help/library/guides/realtext/realtext.htm or http://service.real.com/help/library/encoders.html (search for RealText and choose to read it on-line or download).


Disclaimer

I'm in no way associated with RealNetworks. All information presented here is for educational purposes only and is not guaranteed to be precise nor correct at all, although I have done my best to do so. You can create links to this page and/or reproduce it as long as it is kept in its original form. RealText is a trademark of RealNetworks, Inc.. RealAudio, RealVideo, RealPlayer and the Real logo are registered trademarks of RealNetworks, Inc.. Other product and corporate names may be trademarks or registered trademarks of other companies. They are used for explanation only, with no intent to infringe. Why this letters are always so small? Bites me. Are you happy, lawyers? I hope so.

Hits since January 2002: