This appendix describes the RealProducer audience syntax. Each audience file or job file records settings about how clips and broadcasts are encoded. The information in this appendix allows you to edit audience information to modify encoding settings without using the RealProducer graphical application.
| Note: If you are not familiar with XML syntax, refer to Appendix A for information about XML namespaces, tags, attributes, and values. |
Each audience section within an audience file or job file defines a single audience for which a clip or broadcast is encoded. RealProducer predefines a number of audiences that appear within the graphical user interface when you click the Audiences button. For example, one audience is for 56 Kbps dial-up modems while another is for 256 Kbps DSL and cable modem users. Each audience specifies the streaming rates at which audio and video clips are encoded, along with other settings.
The audience files are stored in the audiences subdirectory under the main
RealProducer installation directory, although you can change this location
through the RealProducer preferences. Audience files use the file extension
.rpad, and their file names correspond directly to the audience name in the
graphical application. For example, the 56k Dial-up audience in the graphical
user interface stores its information in the file named 56k Dial-up.rpad.
If you edit an audience through the graphical applicationa process described in "Creating and Editing Audiences"RealProducer updates the corresponding audience file to record the changes. You can also edit audience files manually. This allows you to change audience information used by the graphical application or command-line application using a text editor or any automated process that can modify text files.
| Tip: When creating a new audience file, RealNetworks recommends that you start with an existing audience file that you have renamed. |
A job file, which Appendix B explains, can also hold information about
audiences. For example, if you use the RealProducer graphical application to
create a new job and add the 56k Dial-up audience to this job, RealProducer
copies the audience information from the 56k Dial-up.rpad audience file into
the job file. Unlike an audience file, which defines just a single audience, a job
file can define multiple audiences. This is necessary for using SureStream
technology, which encodes a single clip with multiple streams targeting
different audiences.
When you encode a clip using a job file, RealProducer gathers the audience information from the job file, rather than the original audience file. This allows you to change the audience settings for the job without affecting the audience default settings. For instance, you might change an audio codec used for your 56 Kbps dial-up audience within a job. That change affects only the clips encoded using that job file.
The syntax for defining an audience within an audience file and a job file is the same, except for the following differences:
<audience> tag in an audience file requires a namespace, whereas an <audience> tag within a job file does not use a namespace.name value. A job allows multiple outputs, such as encoding to two separate files. Using the name values, you can specify which audiences each output uses. One output might use a high-bandwidth audience, for example, while another output encodes for a low-bandwidth audience.<audience> section falls within a list that begins with an <audiences> tag and ends with </audiences>. The audience file, which defines only one audience, does not use the <audiences> container list.| For More Information: Refer to "Audiences Section" for an explanation of how audiences appear within a job file. |
The <audience> and </audience> tags encapsulate an audience section within
an audience file or job file. The audience section then uses separate <streams>
sections to define the video stream, the audio stream, and so on. For a
standalone audience file that defines a single audience, the <audience> tag
follows directly after the XML declaration tag. Be sure to include the
namespaces shown in the following example, and add any namespaces
required by customized RealProducer components:
<?xml version="1.0" encoding="UTF-8"?> |
| For More Information: For information about defining an audience within a job file, refer to "Audiences Section". |
The following table describes the properties of an <audience> element.
| Property | Value | Function |
|---|---|---|
avgBitrate type="uint" |
positive integer from 1 to 999999 | Defines the average bit rate for this audience in bits per second (bps). This is ignored if the encoding type is set to vbrQuality, or you are encoding audio without video. For more on encoding types, refer to "Stream Encoding Types". |
maxBitrate type="uint" |
positive integer from 1 to 999999 | Limits the total bit rate for this audience to a maximum number in bits per second (bps). The value, which must be more than the value for avgBitrate, applies only if the encoding type is vbrBitrate or vbrQuality, as described in "Stream Encoding Types". |
name type="string" |
string | Creates a user-defined name that identifies the audience template. This name appears in the graphical user interface. The job file uses the name to determine which audiences each output uses. |
streams |
list | Defines each stream in the audience, as described in "Streams Section". |
The following example shows a template for an audience using 256 Kbps DSL or cable modem connections. The average bit rate is set to 225 Kbps, which allows approximately 10 percent of the total bandwidth for network overhead. If variable bit rate encoding is used, bandwidth spikes can reach 450 Kbps:
<audience> |
Each audience template has a streams section that defines the encoded
streams. This section starts and ends with <streams> and </streams> tags (note
the plural "streams"). Within this list, one or more sublists defined between
<stream> and </stream> tags (note the singular "stream") define each stream
setting.
Each <stream> section can define an audio or video stream. All stream types are
optional. You can omit the video stream from audio-only encodings, for
example. You define each video stream once within the audience section. For
audio, however, you can define up to four streams for four separate audio
contexts:
The various <stream> sections use an xsi:type attribute to indicate the type of
the stream. The following example shows the five possible streams defined
within an audience section:
<audience> |
The following table describes the properties that the various audio streams
can contain. Each audio stream section begins with a <stream
xsi:type="audioStream"> tag and ends with a </stream> tag. The codecName and
codecFlavor properties are required.
| Property | Value | Function |
|---|---|---|
codecFlavor type="uint" |
number | Sets the encoding speed used with the chosen codec. For a list of the flavor numbers, refer to the tables in the section "RealAudio Codecs". |
codecName type="string" |
sipr|cook|ralf|raac |
Defines the type of codec used to encode the stream. For a list of the codec names, refer to the tables in the section "RealAudio Codecs". |
encodingComplexity type="string" |
low|medium|high |
Sets the complexity for the lossless codec, as described in "Encoding Complexity Modes". This value is ignored for all other codecs. The default is high. |
encodingType type="string" |
cbr| |
Determines the encoding type. The default is vbrUnconstrainedQuality for the RealAudio lossless codec, cbr for all other codecs. Omit this to choose the encoding type automatically. For background, refer to "Stream Encoding Types". |
pluginName type="string" |
rn-audiocodec-realaudio|s |
Optionally sets the plug-in to use. If omitted, RealProducer selects the plug-in based on the xsi:type value. |
streamContext type="bag" |
list | Determines the audio context for which the codec is used. Refer to "Audio Stream Context". |
Each audience can have up to four audio streams that define which audio codec is used based on the presentation type (audio-only or audio-video) and audio mode (voice or music). This creates four possible audio stream contexts:
These contexts exist because you should use different codecs when encoding music or voice. As well, the audio typically receives more bandwidth in an audio-only clip than in a video clip. When RealProducer encodes a clip using the audience information, it selects just one of the audio contexts, based on other audio settings you have defined in the job file, graphical application, or command line.
| For More Information: For background on audio contexts, refer to the section "Audio Encoding for Audiences". |
Each audio stream uses the streamContext sublist to define one of the four
possible audio contexts. For example, the following markup instructs
RealProducer to use this audio stream when encoding voice audio for a video
clip or broadcast:
<stream xsi:type="audioStream"> |
The following table describes the stream context properties.
| For More Information: The section "Setting Audio Parameters" explains how to set the audio mode through the graphical application. For the command line, see the section "Audio Mode (-am)". See "Media Profile" for information about how the stream context is set in a job file. |
Unless you are an advanced user, RealNetworks recommends that you always define four separate audio streams for the four possible stream contexts. This ensures that the audience information is valid for all possible audio contexts. However, you can define fewer than four audience contexts depending on your encoding needs. Improperly defining these audio contexts, however, may cause errors.
If you encode only music videos, for example, you can define just one audio
stream that uses the appropriate music codec for your audience streaming
speed. In this case, you do not need to include a <streamContext> list.
RealProducer uses the single, defined stream for any audio encoded for the
audience.
If you define a single audio stream, though, you may inadvertently create unstreamable clips, or clips that do not use available bandwidth effectively. Suppose that you create a 56 Kbps modem audience and use a 32 Kbps music codec as the only audio stream. The total streaming speed for this audience is approximately 34 Kbps. As long as you encode audio-only files, you are using bandwidth effectively. But if you encode a video with this audience setting, the visual track gets only 2 Kbps of bandwidth, rendering the video useless.
Conversely, you might define a 6 Kbps music clip for your 56 Kbps modem audience. This leaves about 28 Kbps of usable bandwidth for a video's visual track, which is a good division. However, if you encode an audio-only clip with this audience, it still uses just 6 Kbps of the bandwidth for the audio, letting the other 28 Kbps of bandwidth go unused. For an audio-only clip, you want to select a higher-bandwidth codec that uses bandwidth more effectively and improves the sound quality.
When you define multiple audio streams for different stream contexts, you need to ensure that a context fits your audio encoding settings. Suppose that you set RealProducer to encode a video sound track with music, and your audience file specifies just two streams:
In this case, RealProducer does not encode the clip because no context for audio-video with music exists.
The following sections explain the codec choices and show the markup used
for defining audio streams for a 56 Kbps dial-up modem audience. Because
this type of modem connection rarely achieves a sustained throughput of 56
Kbps, the avgBitrate value for the audience is set at 34 Kbps. The audio (or
audio and video together) cannot use more than this amount of bandwidth.
For More Information:
The section "RealAudio Codecs" lists the
audio codecs along with the values you use for codecName and
codecFlavor.
|
For audio-only with voice, choose a voice codec that uses as much of the
available bandwidth as possible. For a 34 Kbps target speed, for example, the
best choice is 32 Kbps voice, which has a codec name of cook and a flavor of 7:
<stream xsi:type="audioStream"> |
For audio-only music, choose a music codec that has a bit rate as close to the
available bit rate without going over. For a 34 Kbps target speed, for example, a
good choice is 32 Kbps Stereo Music High Response - RealAudio. This codec
has a name of cook and a flavor of 21:
<stream xsi:type="audioStream"> |
For audio with video, it's generally advisable to allocate only 20 percent of a
video's bandwidth for audio. A good choice when streaming at 34 Kbps is 6.5
Kbps voice. This codec has a name of sipr and a flavor of 0:
<stream xsi:type="audioStream"> |
As with voice, a music codec for a video stream should consume only about 20
percent of the total bit rate. A good choice is either 6 Kbps Music - RealAudio,
or 8 Kbps Music - RealAudio if you want better sound quality. The following
illustrates the 8 Kbps codec, which has a name of cook and a flavor of 0:
<stream xsi:type="audioStream"> |
The following table describes the properties that a video stream can contain.
Each video stream section begins with a <stream xsi:type="videoStream"> tag
and ends with a </stream> tag.
| Property | Value | Function |
|---|---|---|
codecName type="string" |
rv8|rv9|rv10 |
Defines the specific video codec used. The default is rv10 for RealVideo 10. See "RealVideo Codecs" for more information. |
enableLossProtection type="bool" |
true|false |
Determines if error correction packets are added. The default is false. See "Loss Protection". |
encodingComplexity type="string" |
low|medium|high |
Sets the encoding complexity, as described in "Encoding Complexity Modes". The default is high. |
encodingType type="string" |
cbr| |
Sets constant bit rate encoding or a type of variable bit rate encoding. The default is cbr. Refer to "Stream Encoding Types". |
maxFrameRate type="double" |
positive number from 0-60.000 | Sets the maximum target frame rate. The default is 30. See "Encoded Frame Rates". |
maxKeyFrameInterval type="double" |
positive number from 0 to 60.000 |
Sets the maximum number of seconds between video key frames. The default is 10. See "Maximum Time Between Keyframes". |
maxStartupLatency type="double" |
number of seconds between 4.0 and 60.0 |
Determines how long the clip buffers. The default is 4.0. See "Video Startup Latency". |
pluginName type="string" |
rn-videocodec-realvideo |
Optionally defines the plug-in that encodes the stream. You use the same value for RealVideo 8, 9, or 10. If omitted, RealProducer selects the plug-in based on the xsi:type value. |
quality type="uint" |
positive integer from 1 to 100 |
Sets a quality target for VBR clips. A value of 100 represents the highest possible quality. For background, refer to "VBR Encoding Settings". See also "Stream Encoding Types". |
The encodingType attribute for an audio or video stream uses one of the values
described in the following table. The value you select determines whether
RealProducer ignores or adheres to other audience settings. This attribute
primarily affects video streams, but can be used with audio as well. If you do
not define it for an audio stream, RealProducer uses vbrUnconstrainedQuality
for the RealAudio lossless codec and cbr for all other audio codecs.
| encodingType Value | Output |
|---|---|
cbr |
Constant bit rate stream based on the audience's avgBitrate. The audience maxBitrate and the video stream quality values are ignored. Use this setting for all audio codecs other than the RealAudio lossless codec, which uses vbrUnconstrainedQuality. This is the only setting you can use for a video stream when packaging multiple streams into a single clip using SureStream technology. |
vbrBitrate |
Variable bit rate stream based on the audience's avgBitrate and maxBitrate settings. The video stream quality value is ignored. This is the standard setting for most variable bit rate clips. RealProducer may encode certain sections at speeds up to the maxBitrate setting, but attempts to encode an overall bit rate consistent with the avgBitrate value. The resulting average rate may be somewhat higher than the avgBitrate value, however. The vbrUnconstrainedBitrate encoding type generally encodes very close to the specified average bit rate, but has an unconstrained maximum bit rate. |
vbrQuality |
Variable bit rate stream based on the audience's maxBitrate setting and the video stream's quality setting. The audience's avgBitrate setting is ignored. Use this value if you want to try to maintain the encoding quality at a certain level and it is not necessary to maintain a consistent, average bit rate. The quality level may be constrained by the maximum bit rate, however, particularly during fast-action scenes. |
vbrUnconstrainedQuality |
Variable bit rate stream based on the video stream's quality setting. The audience's avgBitrate and maxBitrate values are ignored. Use this value to maintain the encoding quality at a certain level and it is not necessary to maintain a consistent, average bit rate or adhere to a maximum bit rate. This is the only setting allowed for the RealAudio lossless codec. |
vbrUnconstrainedBitrate |
Variable bit rate stream based on the audience's avgBitrate setting. The audience maxBitrate property and video stream quality setting are ignored. The resulting file may therefore have large bandwidth spikes, but the average bit rate will be close to the avgBitrate value. This is a better choice than vbrBitrate for creating a download clip at a specific file size. The final size will be the avgBitrate setting multiplied by the clip timeline. For example, a 60-second clip with an average bit rate of 450 Kbps is approximately 27,000 Kbits, or 3.3 Megabytes. |
| For More Information: For background on variable bit rate encoding, see "Variable Bit Rate Video". |
When you define a video stream, you do not set its bit rate directly. To
determine the rate, take the audience's avgBitrate value and subtract the rates
for the selected audio stream.
For a 256 Kbps audience, for example, the average bit rate may be 225 Kbps. If a 44 Kbps music audio codec is used for the sound track, the video's visual track has an average bit rate of 181 Kbps (225 minus 44). If the video uses a voice sound track that consumes 32 Kbps, the visual track has an average bit rate of 193 Kbps (225 minus 32).
For a variable bit rate clip, the same calculation using the audience's
maxBitrate value reveals the video's maximum rate. If the maximum rate is 450
Kbps, for instance, the video's visual track can use a maximum bandwidth of
406 Kbps (450 minus 44) when a music codec is used, or a maximum
bandwidth of 418 Kbps (450 minus 32) if a voice codec is used.
| For More Information: The section "Audience Properties" describes the audience values. For background on the division between the sound track and the visual track in a video clip, refer to "Soundtrack Bandwidth". |
The following example shows a video stream defined for a relatively low bandwidth, such as a dial-up modem. Because of the slow streaming speed, constant bit rate encoding is used with a maximum frame rate of 15 frames per second:
<stream xsi:type="videoStream"> |
|
|
©2004 RealNetworks, Inc.
For more information, visit RealNetworks Click here if the Table of Contents frame is not visible at the left side of your screen. |