Enable/disabling server-side media re-encoding


What are the benefits and drawbacks of enabling or disabling server-side media re-encoding? How do I reconfigure Centova Cast to enable or disable it?



Your users' media (i.e., MP3 files) will often come from a diverse set of sources, and as such each track will likely be saved at a slightly different level of audio quality.

If not eliminated prior to streaming, these differences in audio quality (known as the "bit rate" and "sample rate") can cause serious problems on your stream. Differences in bit rate, sample rate, and channels can cause the stream to consume far more bandwidth than intended, thus dramatically raising the cost of operating the stream. Differences in sample rate can also cause serious audio problems and buffering issues which will make the stream near- impossible to enjoy.

To avoid the problems associated with these inconsistencies in quality, most streaming sources can be configured to automatically process and "re-encode" each track at a consistent quality level to ensure that each song sounds correct, and each track consumes a predictable amount of bandwidth, when streamed.

What are the benefits of enabling re-encoding?

Bandwidth Consumption: Differences in the bit rate and sample rate of your media will directly affect the size of the media file. For example, a high- quality MP3 of a given song, saved at 320Kbps, will be roughly twice the size (in bytes) of the same song saved at a lower quality such as 160Kbps. As such, streaming the higher-quality version on an Internet radio station will require far more bandwidth (and thus cost far more) than streaming the lower- quality version.

Audio Problems / Buffering: Worse yet, streaming audio players are not designed to handle changes in sample rates between songs. Should you play two songs at different sample rates, the effect will be similar to that of playing an old record at the wrong speed -- the second song will sound either too fast or too slow, the pitch will be incorrect, and you will encounter significant buffering problems.

Bit rate limiting: Enabling re-encoding ensures that the media is streamed at the correct bit rate. Disabling re-encoding eliminates the source's ability to enforce bit rate restrictions on a stream. This means that if your users are able to upload their own media, they could potentially begin streaming at a much higher bit rate (and thus consuming far more bandwidth) than you, as the administrator, had authorized.

Enabling re-encoding automatically forces the media into the correct bit rate, sample rate, and number of channels, resolving all of the above issues, and ensuring that your audio will sound correct and your stream will consume a consistent amount of bandwidth.

What are the drawbacks of enabling re-encoding?

CPU usage: Re-encoding audio is a very CPU-intensive process -- re-encoding may consume anywhere from 5% to 50% of a server's CPU resources, depending on the speed of the server. This may limit the number of streams you can host on a single physical server.

If you trust your users, however, and/or you directly control the media that they stream, you may prefer to manually encode all of the media at a consistent bit rate and sample rate prior to using it on their stream, and then turn off re-encoding to conserve CPU resources on the server. This will dramatically reduce CPU load, and increase the number of streams you can host on a single server.

When does it apply?

Server-side re-encoding settings apply only when you are hosting the client's media on your server (i.e., the client is NOT using an off-side source), and only when using a server-side streaming source that supports reconfiguration of its re-encoding settings.

At present, all of the streaming sources supported by Centova Cast allow you to enable/disable re-encoding, EXCEPT sc_trans. sc_trans always re-encodes its media, and this cannot be disabled.

Server-Side Re-encoding in Centova Cast v3

Re-encoding is controlled by the Re-encoding: option in the stream settings for the account, either on the AutoDJ tab or in the configuration for the individual mount points on the Mount Points tab.

Note that to see this option, you must be accessing the client's account from the admin account; clients are not (by default) able to see this option.

Server-Side Re-encoding in Centova Cast v2

Re-encoding is enabled automatically by Centova Cast v2 when you enable certain features which depend on it, and disabled automatically when you're not using those features.

Re-encoding settings are configured on a per-stream basis. To change the re- encoding settings for a stream, login under the "admin" account, edit the stream settings, and click the Source tab.

The following settings, each displayed on the Source tab, control whether re- encoding is enabled or disabled:

  • Crossfade: Enabling cross-fading between tracks always requires re- encoding. Assigning any value other than "0" to the Crossfade setting will enable re-encoding.

  • Sample rate: Assigning a custom sample rate always requires re-encoding. Assigning any value other than "Auto" to the Sample Rate setting will enable re-encoding.

  • Channels: Setting a custom number of channels always requires re-encoding. Assigning any value other than "Auto" to the Channels setting will enable re- encoding.

If all three of the above settings are assigned to their default values (i.e., "Crossfade" is set to 0, and "Sample rate" and "Channels" are set to "Auto") then re-encoding will be disabled. Note that (as described above) this will also disable bit rate limiting for media hosted on the server.

Can I set default re-encoding values for all new streams?

Yes, as of Centova Cast v2.0, options exist in the admin area (on the settings page) to specify default re-encoding values for all new streams. This allows you to enable/disable re-encoding by default for all new streams.