<?xml version="1.0" encoding="iso-8859-2"?>
<!DOCTYPE zprava PUBLIC "zprava" "techrep.dtd">
<zprava cislo="19/2006" jazyk="en">
<nazev>Multichannel Audio Broadcasting over IP</nazev>
<autor>Miloš Wimmer</autor>
<datum>20. 12. 2006</datum>


<h1>Introduction</h1>

<p>As a part of the CESNET research program, we have continuously explored the possibilities of transferring high-quality sound through computer networks. We have designed and implemented a system for processing and distributing two-channel Ogg Vorbis-compressed audio at either 128kb/s or 224kb/s to provide for live high-quality Internet broadcasting of selected Czech Radio stations. The actual solution uses dedicated servers for creating Ogg streams and separate streaming servers. With home cinema systems becoming more and more popular, multichannel audio recordings become also available. Our study discusses the possibilities of multichannel audio streaming.</p>

<h1>Multichannel Sound Systems</h1>

<p>Technically, even the widely used stereo sound format is -- in fact -- multi-channeled. However, the term multichannel is usually understood to refer to audio signal consisting of more than two channels.</p>
<p>Multichannel audio technologies have been originally developed by the movie industry since stereophonic sound soon became insufficient for large screens. To make the cinema experience more convincing, it was necessary to enhance the sound track and improve its quality. Original stereophonic systems were gradually replaced with four-channel Surround Sound systems expanding the spatial imaging of audio playback.</p>

<h2>LCRS Systems</h2>

<p>Formerly, <b>Dolby Surround</b> and <b>Dolby Pro Logic</b> were most widely used, both being analog systems capable of encoding four audio channels and storing them within the two traditional film-strip channels. Among the four channels were the two standard channels (left/right), a central channel, and a so-called Surround channel being played by speakers surrounding the auditorium. Both extra channels were limited as to their frequency range. These and similar audio formats are known as LCRS (Left Center Right Surround) Systems.</p>

<obr src="lcrs">Analog LCRS System</obr>

<p>The introduction of digital technologies has strongly influenced the audio recording process. Multichannel audio system set-ups are usually identified as X.Y systems where X refers to the number of full-blown channels while Y denotes the number of channels limited to frequencies of 120Hz or lower. The Y channel is usually used for special low-frequency sound effects, which is why it is frequently referred to as a LFE channel (Low Frequency Effects).</p>

<h2>5.1-Channel Systems</h2>

<p>There are five "fully-fledged" audio channels (front left, center, front right, plus left and right surround) and one frequency-limited LFE channel in a 5.1 set-up. Speakers playing the surround channels are meant to be located at the sides and in the rear of the listening space.</p>

<obr src="digital5-1">5.1 Digital System</obr>

<h2>6.1-Channel System</h2>

<p>6.1 enhances the 5.1 set-up by adding an independent rear surround channel. Left and right surround speakers are only located at the sides, rear surround only plays in the rear.</p>

<obr src="digital6-1">6.1 Digital System</obr>

<h2>7.1-Channel System</h2>

<p>7.1 systems extend the capabilities of multichannel systems even further. In comparison to a 5.1-channel set-up, 7.1 adds two rear surround channels allowing for a precise location of sounds played in the rear. </p>

<obr src="digital7-1">7.1 Digital System</obr>

<h1>Multichannel Digital Sound Formats</h1>

<p>The movie industry as well as the home cinema industry rely mostly on two formats -- <b>Dolby Digital</b> and <b>DTS</b>.</p>

<h2>Dolby Digital</h2>

<p>Dolby Digital is a proprietary multichannel digital audio format based on lossy compression algorithms. It has been developed by the Dolby Digital Company and is sometimes referred to as <b>AC-3</b> or <b>A52</b>. Dolby Digital is intended mainly for movie theaters, DVD Video, and DVD Audio. It may contain up to 5.1 channels. While the AC-3 standard allows for a maximum bitrate of as much as 640kb/s, a typical 5.1 Dolby Digital bitrate is 384kb/s or 448kb/s. DVD Audio disks usually play at 448kb/s.</p>
<p>Dolby Laboratories continuously improve the format and publish new versions such as Dolby Digital EX (intended for 6.7 or 7.1 systems), Dolby TrueHD, or Dolby Digital Plus, which supports up to 13.1 channels at a total bitrate of 18Mb/s.</p>

<h2>Digital Theater System</h2>

<p>Digital Theater System -- also known as <b>DTS </b><b>Digital Surround</b> -- is a competing format designed by the same company. It is intended for 5.1 lossy-compression systems. The CAC (Coherent Acoustic Coding) codec is used for audio encoding. The maximum bitrate of the DTS format amounts to 1536kb/s, DVD Video disks most frequently rely on 768kb/s at 48-kHz sampling frequency and a 20-bit quantizer setting. DVD Audio uses 24-bit quantization at 96 or 192kHz.</p>
<p>The Digital Theater System is also under continuous development. Multichannel systems currently use its updated version -- the DTS-ES (Extended Surround).</p>
<p>Multichannel audio broadcasting is not very common on the Internet, mostly for the following reasons:</p>

<ul>
<li><p>multichannel systems are still more or less and exception</p>
</li>
<li><p>live broadcast studios at most radio stations are usually equipped with two-channel systems</p>
</li>
<li><p>content being broadcast by a majority of radio stations is usually played from internal two-channel recording/playback systems</p>
</li>
<li><p>producing multi-channeled programs presents a technical challenge</p>
</li>
<li><p>multi-channeled streams require wider bandwidth since they are "bulkier"</p>
</li>
</ul>
<p>Internet radios use mostly mp3, Windows Media, RealAudio or Ogg Vorbis formats for stereo broadcasting. Multichannel Internet broadcasting can only be done with formats that support multichannel audio, such as Ogg Vorbis<b>, MPEG AAC, AAC Plus, </b>or<b> Windows Media.</b> All these formats/codecs are lossy.</p>

<h2>Ogg Vorbis</h2>

<p>Ogg Vorbis is an open and free format being designed under the supervision of the Xiph.org Foundation. It offers high-class professional encoding and streaming technology. It supports up to 255 independent audio channels with sampling frequencies of up to 192kHz. Ogg Vorbis is often incorrectly referred to as "ogg." In fact, ogg is a transport layer format (also known as "container"), which may contain data processed by various codecs such as Ogg Vorbis (used for lossy compression) or FLAC (for lossless compression).</p>

<h2>AAC</h2>

<p>The AAC <b>(Advanced Audio Coding)</b> format has been developed by a consortium of companies lead by Dolby, Fraunhofer, and Coding Technologies to replace the MP3 format (AAC is, however, incompatible with MP3) introducing multichannel support and an improved compression algorithm designed within the MPEG-4 Standard.</p>
<p>The AAC format is still under development and there are numerous modifications such as AAC Plus High Efficiency AAC HE-AAC), or AACplus/DTS, which is compatible with DTS decoders allowing them do decode AAC-encoded sound. AAC supports sampling frequencies of up to 96kHz and as many as 48 audio channels. Unlike MP3 this format -- even if used for streaming or content distribution -- is not subject to legal liabilities, which improves its position among other streaming formats used in the Internet environment. However, there are license-related liabilities imposed on codec producers.</p>

<h2>FLAC</h2>

<p>FLAC <b>(Free Lossless Audio Codec) </b>is considered the most suitable lossless format supporting multichannel audio at sampling frequencies of up to 1MHz with quantizer settings as high as 32bit. Moreover, FLAC is totally free.</p>

<h1>Implementing a Multichannel Streaming System</h1>

<p>While implementing a multichannel streaming system, we wanted to achieve goals similar to those we have set forth when designing and implementing a two-channel system for Internet-based broadcasting:</p>

<ul>
<li><p>the highest possible quality of the sound being transferred</p>
</li>
<li><p>client-side support availability</p>
</li>
<li><p>high system stability</p>
</li>
</ul>
<p>While looking for components and tools we could use to set up such a streaming system, we have proven many times that multichannel streaming is not a wide-spread technology yet. Most applications used for two-channel streaming do not support more than two channels. That is why we could not have simply reused our previous solution for stereophonic broadcasting.</p>
<p>Every streaming system may be divided into four main parts -- Acquiring and Processing the input audio signal, the Producer transforming (encoding) the input signal to a digital stream and transferring it to the streaming server, the Streaming Server accepting streams from Producers and distributing data to Clients used by individual listeners, and finally the Clients receiving the streams and playing them back at the listeners' devices.</p>

<h2>The Input Source</h2>

<p>In case of two-channel streaming systems, there are several ways of acquiring the input signal -- DVB-S and DVB-T PCI receivers for satellite and/or terrestrial broadcasting, or PCI sound cards receiving analog audio signal from external FM tuners. None of these options may be however used for multichannel streaming since it is not possible to acquire multi-channeled input by such means.</p>
<p>As the Acquiring part has not been our real priority, we have decided to use an audio file containing a~six-channel (5.1) sound recording, which is a common source used by most playlist-based internet radio stations.</p>
<p>Czech Radio has provided us with a "Vltava Multichannel Edition" DVD containing an authentic DTS~5.1 recording, as well as with an authorization for public Internet broadcasting.</p>
<p>The DTS format is proprietary and since we prefer to use open formats for our solutions, we had to start by converting the recording to multi-channeled Ogg Vorbis. Among many conversion tools, vlc proved to be the most suitable one. vlc is and advanced software product being developed by the VideoLAN project under the GNU license. It offers a number of features and supports numerous data formats. Vlc may be used both as a player and as a streaming server.</p>
<p>The conversion may performed by the following command:</p>
<blockquote><pre>
vlc --intf dummy file:///data/VTS_03_1.VOB --novideo --sout \
'#transcode{acodec=vorb,ab=672,channels=6}:standard{access=file, \
mux=ogg,dst=/data/foo.ogg}'
</pre></blockquote>
<p>Vlc will only process audio data (note the <tt>--novideo</tt> option) using the vorb codec (<tt>acodec=vorb</tt>) to transcode the VTS_03_1.VOB input file (<tt>file:///data/VTS_03_1.VOB</tt>) to the Ogg Vorbis format with the mean variable bitrate of 672kb/s (<tt>ab=672</tt>) and with six channels (<tt>channels=6</tt>). The 48-kHz sampling frequency is left unchanged. The output stream is stored in a file (<tt>access=file</tt>) using the ogg transport format -- so-called container (<tt>mux=ogg</tt>). The name of the output file is foo.ogg (<tt>dst=/data/foo.ogg</tt>).</p>
<p>The format of the input DTS file (VTS_03_1.VOB) is recognized automatically by vlc relying on information given in the file header.</p>

<h2>Producer</h2>

<p>Our two-channel solution relies on the cooperation of the oggenc and ices tools connected through a named pipe. Both products are being developed by the Xiph.org project and may be used freely under the GNU license. Oggenc is used to encode input data from pure OCM to an Ogg Vorbis stream. Then, ices takes over and transfers the stream to the streaming server.</p>
<p>Our multichannel system does need an Ogg Vorbis encoder since the input data are already available in the target format. </p>
<p>The Producer's part is taken over by the vlc application reading the input file in an infinite loop and forwarding the data as a stream to vlc's output module used for actual broadcasting, ie. delivering the stream to individual Clients.</p>
<p>The producer is started by the following command:</p>
<blockquote><pre>
vlc --intf dummy playlist.m3u --input-repeat=-1 --daemon --sout \
'#standard{access=http,mux=ogg,dst=tun2.cesnet.cz:8883}'
</pre></blockquote>
<p>A list of input files to play is given in the playlist.m3u index file. Files will be played in an infinite loop (<tt>--input-repeat=-1</tt>), and transmitted over http in an ogg container to a host named tun2.cesnet.cz, port 8883 (<tt>access=http,mux=ogg,dst=tun2.cesnet.cz:8883</tt>).</p>
<p>The playlist.m3u file lists the path to our test audio file:</p>
<blockquote><pre>
/data/foo.ogg
</pre></blockquote>
<p>It was necessary to use a playlist since defining the name of the input file directly as follows:</p>
<blockquote><pre>
vlc --intf dummy file:///data/foo.ogg --input-repeat=-1 --daemon \
--sout '#standard{access=http,mux=ogg,dst=tun2.cesnet.cz:8883}'
</pre></blockquote>
<p>causes the internal output http server to stop and restart between playbacks thus disconnecting all clients currently receiving the output stream. When using a playlist, the http server does not restart and clients do not get disconnected.</p>

<h2>Streaming Server</h2>

<p>As already indicated in the Producer Section, our experimental set-up does not employ an external streaming server -- it is fully replaced by the Producer's streaming module. In this case, an external streaming server would bring no added value. Generally, however, there are no obstacles preventing us from using one. The vlc-based Producer may transmit its Ogg Vorbis stream to another server also running an instance of vlc receiving the stream and distributing it among its clients over http.</p>
<p>The streaming server used in our two-channel solution relies on a high-quality Icecast Application. It offers a sophisticated interface for managing individual streams, switching clients to back-up streams and back, etc. Unfortunately, the Icecast Server cannot support multichannel streams as of yet, which is why we have not been able to use it as a part of our multi-channeled solution.</p>
<p>Increased reliability could be achieved by adding a secondary streaming server and configuring both servers as virtual IP hosts sharing a single IP address. Each time the Master server or its services would become inaccessible, the Backup server could take over its IP address. The Clients would naturally only connect to the virtual server's shared IP address -- this is a method we have used for our production two-channel system.</p>

<h2>Clients</h2>

<p>Multichannel support is not common in Clients, ie. audio players. Among the number of Ogg Vorbis-compatible clients, only vlc can play multichannel audio. Fortunately, vlc is a free multi-platform software that can be used to play many audio formats under Linux, Windows, Mac~OS~X, BSD, Solaris, WinCE, and other operating systems. Its popularity is still rising due to its quality and wide availability.</p>

<obr src="vlc">VLC Media Player</obr>

<obr src="dalin">Dalin Media Player</obr>

<p>Listeners are expected to use the vlc Client to connect to the streaming server. Generally, however, they may use any client capable of playing multi-channeled Ogg Vorbis streams.</p>

<h1>Real-life Experience</h1>

<p>The whole system is currently being run on the  tun2.cesnet.cz server running Debian Sid Linux. This server also serves as the primary encoding server for our two-channel production system broadcasting selected Czech Radio stations. Adding another Ogg Vorbis stream did not present any significant increase in the server's internal resources consumption. At the present time, the server's hardware is a Dell PowerEdge 1800 fitted with two 3.4-GHz P4 Xeon processors and 1GB of RAM.</p>
<p>A development vlc version (vlc-0.8.6) is currently being run.</p>
<p>The system is stable, running continuously for two months. We have not noticed any trouble during that time.</p>

<h1>Summary</h1>

<p>This Project was aimed at designing and implementing a system allowing for streaming multichannel audio in the Internet environment.</p>
<p>The whole solution relies on free software and open data formats used for encoding and decoding Ogg Vorbis multimedia content. We have achieved both high quality and high stability of the production system.</p>

<h1>Resources</h1>

<p><i>http://www.cesnet.cz/doc/techzpravy/2004/audio/ </i><br/>
<i>http://www.cesnet.cz/doc/techzpravy/2005/audio/</i><br/>
<i>http://radio.cesnet.cz/</i><br/>
<i>http://www.rozhlas.cz/</i><br/>
<i>http://www.videolan.org/</i><br/>
<i>http://www.debian.org/</i><br/>
<i>http://www.xiph.org/</i><br/>
<i>http://www.icecast.org/</i></p>
</zprava>

