previous next

Appendix B: Advanced Production Techniques

This appendix will help you utilize the many features of RealSystem G2 and SMIL. Before following the production tips given here, make sure you have a good understanding of SMIL as described in Chapter 7.

Smoothing Transitions between Clips

By grouping clips played in sequence within a SMIL <par> tag, you can create smooth transitions between the clips. When clips normally play in sequence, each clip buffers data (its preroll) when it starts to play. By grouping the sequence within a <par> tag, though, RealSystem takes advantage of unused bandwidth to send clips' preroll before they start to playback. You can use this feature to mask preroll for high-bandwidth clips, for example, by streaming the preroll while low-bandwidth, introductory clips play.

The following SMIL example, which omits the header that defines the region layout and base URL, shows how to mask preroll for high-bandwidth clips and create smooth transitions between the initial and subsequent clips:


<body>
<par>
<seq>
<par>
<!-- group 1: introductory group masking preroll -->
<audio src="intro.rm"/>
<textstream src="titles.rt" region="left"/>
<textstream src="credits.rt" region="right"/>
</par>
<par>
<!-- group 2: main group with masked preroll -->
<ref src="graphics.rp" region="left"/>
<video src="story.rm" region="right"/>
</par>
</seq>
</par>
</body>

Group 1 consists of two RealText clips and a RealAudio clip played in parallel. Because of the <seq> tag, the group 1 clips precede the RealPix and RealVideo clips in group 2. If the <seq> tag were the highest level of organization, RealServer would stream the group 1 clips without regard to group 2, streaming data for group 2 clips only after group 1 finished. Viewers would experience a delay after group 1 clips finished as RealServer streamed preroll for group 2 clips.

The outer <par> tag just below the <body> tag, however, makes RealSystem treat groups 1 and 2 as one large parallel group with subgroups played in sequence. Although this doesn't affect the order in which the clips play, the parallel grouping makes RealSystem balance bandwidth between all clips. After it starts to stream the group 1 clips, RealServer makes use of unused bandwidth by streaming data for group 2 clips while the group 1 clips play. This masks the preroll for the group 2 clips.

Note
When you enclose clips in a <par> group, the individual clips do not appear in the RealPlayer playlist.

Additional Information
See "What is Preroll?" and "Developing Multiclip Presentations".

Hiding Regions with z-index

RealPlayer creates all regions defined in a SMIL file's header section when it first reads the file. So a single SMIL presentation cannot play clips in a certain set of regions, then destroy those regions and create different regions with a new layout. To accomplish dynamic layout changes, you can create separate SMIL files that define each region set, then play the SMIL files in sequence as described in "Creating a Ram File Manually".

An alternative is to create a single SMIL file that uses the <region> tag's z-index parameter to create transparent, overlaying regions. The following SMIL header example creates a left region next to a right region. Both are in portrait orientation, their heights over twice the value of their widths. A second set of regions, top and bottom, are stacked. These regions have higher z-index values, meaning that they display in front of the left and right regions:


<head>
<layout>
<root-layout width="360" height="360"/>
<!-- first two side-by-side regions -->
<region id="left" top="10" left="10" width="165" height="340" z-index="0"/>
<region id="right" top="10" left="185" width="165" height="340" z-index="1"/>
<!-- second two stacked regions -->
<region id="top" top="10" left="70" width="220" height="165" z-index="2"/>
<region id="bottom" top="185" left="70" width="220" height="165" z-index="3"/>
</layout>
</head>

As defined in the following SMIL body, RealPix and RealText clips first play in the left and right regions, which appear beneath the top and bottom regions. Because the overlaying top and bottom regions do not use background colors, they remain transparent until clips play in them. The introductory RealPix and RealText clips disappear when they finish playback, restoring to view the root-layout default background color of black. The group 2 clips, a RealVideo clip and another RealText clip, then play in the top and bottom regions:


<body>
<par>
<seq>
<par>
<!-- group 1: side-by-side titles and credits -->
<ref src="titles.rp" region="left" fill="remove"/>
<textstream src="credits.rt" region="right" fill="remove"/>
</par>
<par>
<!-- group 2: stacked video and subtitles -->
<video src="story.rm" region="top"/>
<textstream src="subtitles.rt" region="bottom"/>
</par>
</seq>
</par>
</body>

Although the left, right, top, and bottom regions exist from the start of the SMIL file playback, the use of z-index, fill="remove", and default region transparency makes it appear as if the regions are created dynamically with each new set of clips. The following figure illustrates the initial region creation, the first set of clips, then the second set of clips playing in the RealPlayer window.

Transparent Region Creation and Ordering

Additional Information
For more on z-index, see "Ordering Overlapping Regions with z-index". "Laying Out Multiple Clips" discusses SMIL layouts.

Writing Complex SMIL Switch Statements

The SMIL <switch> tag is a powerful feature that lets you specify options that each RealPlayer can choose between based on its preference settings and available bandwidth. "Switching Between Alternate Choices" explains the basics of using the <switch> tag. The following sections give tips on writing complex <switch> statements.

Switching with SureStream Clips

With RealAudio or RealVideo clips encoded for multiple bit rates with SureStream technology, you may or may not need to use the <switch> tag:

Switching with Multiple Test Attributes

You can use multiple <switch> test attributes to have RealPlayer choose clips based on both bandwidth and language. There are two ways to do this. In this first example, each audio clip choice has two test-attributes, one for language and one for bandwidth. Both attributes must be viable for RealPlayer to choose the clip:


<switch>
<!-- French language choices -->
<audio src="sound/audio_fr2.rm" system-language="fr" system-bitrate="47000"/>
<audio src="sound/audio_fr1.rm" system-language="fr" system-bitrate="20000"/>
<!-- English language choices (default) -->
<audio src="sound/audio_en2.rm" system-bitrate="47000"/>
<audio src="sound/audio_en1.rm" system-bitrate="20000"/>
</switch>

Because RealPlayer evaluates the <switch> choices from top to bottom, selecting the first viable option, the last two choices do not have system-language options. This lets all RealPlayers other than those with French as their language preference choose between the two English-language clips.

The next example adds RealText files in both French and English to the presentation possibilities. Here, <switch> statements are nested so that RealPlayers with French set as their language preference play the French RealText file and choose from the set of French-language RealAudio files based on available bandwidth. All other RealPlayers play the English RealText file and choose from a set of English-language RealAudio files:


<switch>
<!-- Choose French as the language -->
<par system-language="fr">
<textstream src="text/credits_fr.rt"/>
<switch>
<!-- Choose fast or slow bit rate for French audio -->
<audio src="sound/audio_fr2.rm" system-bitrate="47000"/>
<audio src="sound/audio_fr1.rm" system-bitrate="20000"/>
</switch>
</par>
<!-- Choose English (default) as the language -->
<par>
<textstream src="text/credits_en.rt"/>
<switch>
<!-- Choose fast or slow bit rate for English audio -->
<audio src="sound/audio_en2.rm" system-bitrate="47000"/>
<audio src="sound/audio_en1.rm" system-bitrate="20000"/>
</switch>
</par>
</switch>

Displaying Captions for the Hearing Impaired

The RealPlayer G2 preferences window has an option to enable captions for the hearing impaired. To author these captions, write a RealText clip that coordinates text with the audio timeline. Then create a SMIL file that plays the two in parallel. The SMIL attribute system-captions="on" makes the captions appear only if the viewer's preferences enable captions:


<smil>
<head>
<layout>
<root-layout background-color="blue" width="310" height="200"/>
<region id="video" width="176" height="132" left="67" top="5"/>
<region id="captions" width="300" height="50" left="4" top="145"/>
</layout>
</head>
<body>
<par>
<video src="news.rm" region="video"/>
<textstream src="captions.rt" region="captions" system-captions="on"/>
</par>
</body>
</smil>

In this example, the RealText file (captions.rt) appears only for viewers who have enabled captions in RealPlayer. For all other viewers, the caption region shows the root-layout region's background color. RealPlayer's captions setting does not affect the video clip, which has no system-captions value. Following sections explain how to fill the caption region or make it disappear when captions are off.

Tip
The system-captions attribute also works for <seq> and <par> groups. You can use system-captions="off" to make a clip or group play only when system captions are turned off in RealPlayer.

Additional Information
"Laying Out Multiple Clips" discusses SMIL layouts. RealText Authoring Guide is available at http://service.real.com/help/library/encoders.html. The RealPlayer G2 online help can assist you with turning captions on and off in the preferences.

Filling a Captions Region when Captions are Off

To avoid a blank region when captions are off, you can display another file, such as an image file, in the caption region. The following extract is from a SMIL file that uses the same layout as the previous example. Here, the parallel group includes an image clip with a system-captions="off" attribute. This makes the image display only when captions are turned off in RealPlayer:


<par>
<video src="news.rm" region="video"/>
<textstream src="captions.rt" region="captions" system-captions="on"/>
<img src="filler.gif" region="captions" system-captions="off"/>
</par>

Any clip, not just a static image, can fill the captions region when captions are off. The filler clip should be the same size as the RealText captions clip, however, when the two display in the same region.

Resizing the Playback Area for Captions

As an extension to SMIL, RealPlayer G2 supports system-captions in layout tags. This lets you change layouts when captions are displayed. The following SMIL file centers a video region above a captions region only when RealPlayer enables captions. Although this example uses system-captions in the <layout> tag, you could use the attribute in <root-layout/> and <region/> tags as well to display or hide individual regions based on RealPlayer's captions setting:


<smil>
<head>
<meta name="title" content="Closed-Captioned News"/>
<!-- Layout used when captions are on. -->
<layout system-captions="on">
<root-layout background-color="blue" width="310" height="200"/>
<region id="video" width="176" height="132" left="67" top="5"/>
<region id="captions" width="300" height="50" left="4" top="145"/>
</layout>
</head>
<body>
<par>
<video src="news.rm" system-captions="off"/>
<video src="news.rm" region="video" system-captions="on"/>
<textstream src="captions.rt" region="captions" system-captions="on"/>
</par>
</body>
</smil>

With this SMIL file, RealPlayer creates the layout and plays the RealText clip in parallel with the video only when captions are on. When captions are off, RealPlayer defines no regions and plays only the news.rm clip that includes the system-captions="off" attribute. When captions are off, the SMIL file is equivalent to the following:


<smil>
<head>
<meta name="title" content="Closed-Captioned News"/>
</head>
<body>
<video src="news.rm" system-captions="off"/>
</body>
</smil>


Copyright © 1998-1999 RealNetworks
For information on RealNetworks' technical support, click here.
Comments on this document? Click here.
This file last updated on 06/21/99 at 10:44:41.
previous next