Log in

View Full Version : The Radio Stream Transcoding Bible


Menneisyys
01-02-2008, 09:47 AM
With the advent of cheap and/or unlimited data plans, good coverage and the increasing presence of Internet radio stations, the importance of listening to streaming radio stations have become much bigger than ever. In this Bible, I mostly elaborate on practices that


may make the sound quality much better using the same bandwidth, and/or
may save you tens or hundreds of bucks a month by heavily reducing data usage, while providing the same (or even better!) sound quality should you not be able to access any unlimited data plan (Canada with its ridiculous data rates (http://www.pocketpcmag.com/blogs/index.php?blog=15&title=why_the_larger_mobile_service_providers&more=1&c=1&tb=1&pb=1) comes into mind), and/or
may heavily increase your battery life by letting you “falling back” to the much more battery-friendly 2.(7)5G Internet access technologies instead of the power-hungry 3(.5)G ones, and/or
in cases, may even let you listen to some radio stations you would never have thought of because of the network / operating system restrictions, and/or
makes the central administration of your radio station favorites much easier – no need to switch between different radio programs if there’s a difference between the protocols / formats they use.

This article is part of my “Multimedia Bible” series and will, eventually, be incorporated in some way in the final version of Multimedia Bible, which, hopefully, will be published this month. Note that I'll also elaborate on TV (video) streaming and transcoding in a later Bible. We’ll use many of the tools / technologies introduced in this Bible in there; most importantly, Orb and VLC.

This Bible, as with my last multimedia-related articles, multiplatform. Don’t get offended by this if you're a fanboy of either of the platforms and just hate everything related to the other: both Windows Mobile and Symbian software developers need to know what the other operating system offers so that they can improve on their products. In addition, should you have devices of both operating systems, you'll be able to optimize the usage of these devices. Just an example: I mostly use the Nokia N95 as my main entertainment and light Web browser / mailer / communicator device because of its, compared to any Windows Mobile device, superior A2DP quality, built-in, stereo speakers, acceptable battery life and lightweight (120g), small body. Therefore, when I know I won't need a Pocket PC (and its high-resolution VGA screen), I know I can safely leave my comparatively heavy and "brick" HTC Universal at home, and go to, say, a quick walk with my N95 only. And, of course, when I do know I will need a Pocket PC and/or a high-resolution screen (for example, to do some serious (!) Web browsing or remote desktop access/control), I take my Universal with me too. (For phoning purposes, I still use my HTC Oxygen (s310) WM5 MS Smartphone because it's cheap - no problem if I'm robbed / it's stolen -, very sturdy and is one of the very few Windows Mobile devices that support flawless, two-party call recording capabilities (http://www.pocketpcmag.com/blogs/index.php?blog=3&p=2311&more=1&c=1&tb=1&pb=1). I always keep it in my trousers' pocket.)

Note that I planned to review the Palm OS as well. As, currently, I don’t have a Wi-Fi card for my Tungsten T3 and I just couldn’t make it use an external IrDA / Bluetooth modem (unlike with my old Zire 71), I couldn’t test streaming on it. By the time I publish the final Multimedia Bible, I’ll try to get hold of a Wi-Fi card and update this Bible so that Palm OS is also covered. (Sorry, I can't affort a 750p just to be even more multiplatform. If you have one lying around unused, of course, you can send it to me, particularly if you're inside the EU to avoid customs issues ;-) ). After all, on Palm OS, Pocket Tunes is a freaking good audio player well worth comparing other mobile operating systems to.

Introduction

While trying to listen to a radio stream, you surely have run into not being able to play back an Internet radio station either entirely or without severe quality and/or battery life degradation. After you read this Bible – and digest all its contents –, you’ll know how to fix problems like these.

1.1 When it’s completely impossible to listen to a stream...

First, let’s take a quick look at what can cause your handset to not be able to play back a particular Internet radio station.


Your connection speed simply doesn’t suffice for correctly playing back the stream. For example, you’re trying to listen to a 64 kbps (kilobit per second; that is, the so-called ‘bitrate’) stream over a standard GPRS connection. That is, your Internet connection speed is no more than 43 kbps. In these cases, you simply won’t be able to listen to the stream without severe pauses / stuttering, no matter how large buffers you use.

The situation is the same when you try to stay away from using a 3G (either a UMTS or a HSDPA) connection. Even if your handset supports 3G and you also have the necessary signal, you may still want to opt for disabling 3G entirely and going back to using GPRS. The most important reason for this is the vastly increased power usage of current 3G modules used in recent, even high-end handsets like the Windows Mobile HTC Kaiser or the Symbian Nokia N95 or N82. I’ve elaborated on this problem (with several tools that help in switching) in THIS (http://www.pocketpcmag.com/blogs/index.php?blog=3&p=2316&more=1&c=1&tb=1&pb=1) (Windows Mobile) and THIS (http://www.pocketpcmag.com/blogs/index.php?blog=3&p=2338&more=1&c=1&tb=1&pb=1) (Symbian) article.

In these cases, you will want something to (in cases, radically) decrease the bitrate of these streams. Fortunately, it’s in no way impossible. With current technology, you can transfer FM-quality, stereo music even at 24 kbps. I’m not kidding!

(Note that, in this Bible, I assume you only have GPRS access. Unfortunately, many GSM operators still stick with the GPRS + 3(.5)G schema, leaving out the 2.75G technology, EDGE (http://en.wikipedia.org/wiki/Enhanced_Data_Rates_for_GSM_Evolution) altogether. One example of them is Vodafone, which, with their unlimited data plans, only support GPRS, UMTS and HSDPA / HSUPA. That is, no support for EDGE at all - at least here.

EDGE has both (for radio streaming at least) good speed (236 kbps at most) and low power usage - according to my benchmarks, it doesn't use more power than GPRS.)

You’re trying to listen to a so-called ‘RTSP (http://en.wikipedia.org/wiki/RTSP)’ stream but your mobile phone operator doesn’t support direct Internet connections. They use firewalls and NAT’ing (Network Address Translation – see THIS (http://www.pocketpcmag.com/blogs/index.php?blog=3&p=343&more=1&c=1&tb=1&pb=1) article for more info on the consequences), making it for the radio server to completely impossible to connect back to your handset. Unfortunately, about 60% of the world’s GSM operators do so.

Unfortunately, several radio stations or applications use RTSP. Most importantly, all (except for Mplayer (http://www.pocketpcmag.com/blogs/index.php?blog=3&p=2312&more=1&c=1&tb=1&pb=1) on Windows Mobile – more on this later) mobile RealAudio players use RTSP on both Windows Mobile and Symbian. This means you simply can’t listen to radio stations utilizing RealAudio unless you’re lucky enough to have a data subscription at a mobile operator not using NAT’ing.

(Speaking of the Windows Mobile port of Mplayer (http://www.pocketpcmag.com/blogs/index.php?blog=3&p=2312&more=1&c=1&tb=1&pb=1), it uses the firewall / NAT-friendly HTTP protocol instead of RTSP. However, it’s a real CPU hog: in the current version, RealOne streaming only works on 624 MHz Xscale CPU’s because it’s really-really CPU-intensive and, on these CPU’s, it chews through the battery really-really fast. It can’t be played back on current, TI OMAP-based Windows Mobile models at all. All in all, it’s pretty much useless.)

RTSP is also very extensively used by Orb, one of the best tools to transcode Internet radio stations. More on this in the Orb-related section.

There are simply no players to play back a given stream type. Then, even if you have a quick connection and/or a non-NAT’ing network operator, you still won’t be able to play back the stream.

The most important case of this are Windows Media Audio (WMA) streams on Symbian. While the built-in Music Player supports playing back local WMA files, it can’t do the same to WMA streams. The situation is particularly bad because the well-known, excellent Orb service, currently, only uses WMA as the only non-RTSP stream format. As WMA streams aren’t compliant with Symbian, you simply can’t use the otherwise excellent Orb if your connection is NAT’ed.

OGG stream support isn’t particularly good on Symbian either. Oggplayer is pretty much a joke and additional radio stations are pretty complicated to set up in the commercial LCG Jukebox (http://www.lonelycatgames.com/?app=lcgjukebox), the only other, SHOUTcast OGG-compliant player on Symbian. (Note that CorePlayer (http://www.coreplayer.com/) is able to play back WMA and OGG streams but, currently, as of the current beta version, its networking module is so bad that it’s unable to play back anything without severe problems surfacing after some minutes at most. This applies to not only WMA, but also other streams. Hope future versions - hopefully the forthcoming 1.2 - fix these issues. In the meantime, stay away from it.)


1.2 When you prefer optimizing an, otherwise, working stream...

Now that we’ve seen what can make it completely impossible to listen to a particular stream, let me also take a look at when you may still want to go for an optimized version of a radio station.


While, at your current connection speed, you already have a compatible stream, it isn’t of the best quality and you would prefer something much better.

The most important examples of this case are GPRS connections, meaning less than 43 kbps total download (downlink) speed, which means about 32 kbps effective radio stream bit rate. With traditional (non-HE-AAC v2) radio stations, you can only have streams of bad quality using GPRS.

For example, Orb only offers a 32 kbps, mono, 44 kHz stream when you switch to the GPRS mode (by using the “40 kbps” mode) if you can’t use RTSP because of the NAT restrictions of your operator. In no way can you instruct the Orb client to transfer stereo WMA audio in so low bitrates.

The (pretty few – most radio stations only have 60+ kbps OGG / WMA and 90+ kbps MP3 streams) radio stations that natively support 32-kbps-max bitrates suffer from the same problem: these streams are almost all mono and still of low sound quality.

You may want to prefer a single interface to quickly switch between your favourite radio stations, independent of their type / source. For example, you don’t want to fire up Internet Explorer Mobile (or, on Symbian, (Nokia) Web) to log into your Sirius account to listen to your Sirius stream only to find out you would still prefer a non-Sirius stream. In these cases, you’ll want to do this using an interface letting for quickly switching between your streams in order to avoid having firing up completely different interfaces to access them all.

And, I’ve already mentioned the vastly increased battery life when you fall back to 2.(7)5G technologies like GPRS (or EDGE – if you’re lucky enough to be a subscriber of a mobile operator with EDGE support). In general, you can count with about 50% (!) increased battery life if you do so.

Again and again, now, with the latest achievements in the radio streaming / encoding technology, you can get perfect sound quality even at GPRS speeds. That is, now, pre-3G technologies (and, particularly, GPRS – as has already been explained, EDGE, which offers far higher transfer speeds without any severe power usage increase, is able to stream most, if not all, current radio streams) have become much more important than ever before. You wouldn’t have thought you would force your shiny, HSDPA-capable, expensive handset to use GPRS only, have you? :) It certainly pays off if you need acceptably battery life while listening to your radio stations without any external charger for more than a few minutes.

If you don’t believe you can save a LOT of battery life by sticking to GPRS (or EDGE), just take a look at the following acbTaskMan screenshot showing the TCPMP playback of an MP3 stream on an HTC Universal. The first section shows playing back the stream over UMTS; the second over GPRS. The current difference is 200 mA / 330 mA = 60% (see the upper chart; the lower one shows the CPU usage which, in this test, is exactly the same because I played back the same stream with the same player). (Disregard the temporary power "bump" of the second part.) Yes, you can get 60% better battery life if you force your handset to operate in GPRS mode, instead of streaming over UMTS. Quite a difference, isn’t it?

http://www.winmobiletech.com/122007StreamTranscodingBible/CPUXscale520-TCPMP-GPRSvs3G-MP3.png

As can clearly be seen, the difference is almost the same as with the Nokia N95 – or, for that matter, with any other, current handset. As a rule of thumb, you will have at least 50% better battery life with any handset if you don’t use 3G for streaming.

To have a picture of what playback times you can expect of current handsets while playing back HE-AACv2 (and, on Symbian, MP3) streams over GPRS, I’ve made some serious long-time tests. On the TI OMAP-based HTC Vox / s710 MS Smartphone, HE-AACv2 (TCPMP) consumed 27% power an hour. Incidentally, as the TI OMAP platform exhibits far less CPU usage-dependent power usage than at least the older (but still most widely deployed) pre-PXA-3x0-series Intel Xscale’s, I’ve got almost the same figure with A2DP enabled. A2DP causes about an additional 20% CPU usage on the Vox; still, the difference in battery life is negligible when streaming (streaming itself is a very battery-consuming activity, even if you only use GPRS/EDGE, and stay away from 3G).

On the Nokia N95 v20, without A2DP, the power consumption is about 0.93W (see THIS (http://www.pocketpcmag.com/blogs/index.php?blog=3&p=2338&more=1&c=1&tb=1&pb=1)) ; with A2DP, about 1.15W. Therefore, you can expect slightly less than 4 hours of playback time without A2DP on the handset – just like with the HTC Vox.


Note that, currently, on Windows Mobile, you’ll want to use TCPMP to play back your streams. See THIS (http://www.pocketpcmag.com/blogs/index.php?blog=3&p=2362&more=1&c=1&tb=1&pb=1) article for more info on HE-AACv2 compliance. It’s only later that CorePlayer and, probably, Conduits Pocket Player / PocketMind Pocket Music (the developers of these apps promised they'd look into implementing support for them) get HE-AACv2 support.

Keep in mind the following: if you install TCPMP on a MS Smartphone (WM6 Standard), as opposed to “regular” Pocket PC’s, just extract 00000aac.001 from the AAC CAB file, rename it to aac.plg and copy it to the home directory of TCPMP on your Smartphone.

On Symbian, currently, Nokia Internet Radio (see remarks & quick review HERE (http://www.pocketpcmag.com/blogs/index.php?blog=3&p=2338&more=1&c=1&tb=1&pb=1)) is the best way to play back SHOUTcast MP3 streams.

Now, let’s take a quick look at what tools we have at our disposal.

1.3 Our tools: transcoders, stream formats

1.3.1 You must run a transcoder on your desktop PC!

First and foremost, for ALL the alternate technologies, you’ll need to have a desktop computer attached to the Internet and switched on when listening to music. The sole reason for this is that it’s on this machine that the so-called ‘transcoding’ (converting between two stream formats; Wiki page HERE (http://en.wikipedia.org/wiki/Transcoding)) takes place. Your handset will connect to this desktop PC instead of the original radio station URL.

Why no purely desktop PC-less setup, you might ask. Why can’t you just connect to a third-party server to do the trick for you? The reason for this is pretty simple: transcoding is a pretty much CPU-intensive task. A typical transcoding process, in VLC, takes about 10% CPU cycles on a contemporary 3.2 GHz P4. You can’t expect for example the Orb folks to install a supercomputer (http://en.wikipedia.org/wiki/Supercomputer) or some hundred PC’s to offer transcoding to their clients – for free. Of course, in the future, companies / services specialized in providing server-side, commercial transcoding services may turn up.

This is why you MUST have a desktop PC running your transcoder, independent of their particular type.

1.3.2 Stream formats

In my quick review of streaming audio formats (http://www.pocketpcmag.com/blogs/index.php?blog=3&p=2350&more=1&c=1&tb=1&pb=1), I’ve already elaborated on the different playback capabilities of the available media players.

You may already also know that you should go for the currently best, most effective audio format, HE-AAC v2 if you have a Windows Mobile device. If you have a Symbian one, then, either MP3 or, if you have a non-NAT’ed network connection, even Orb's RealAudio or RTSP/AAC will work for you.

Quality differences (in which, HE-AAC v2 is certainly the winner) and generic operating system compliance (again, streamed HE-AAC v2 is, currently, only compatible with Windows Mobile but not with Symbian) aside, there are some other factors you should consider when going for a given streaming format; for example, the CPU usage, which, at least on some architectures, may have a huge effect on the power usage and battery life of the handset.

The following screenshot shows playing back MP3 (which is a less CPU-hungry operation) and HE-AAC v2.

http://www.winmobiletech.com/122007StreamTranscodingBible/CPUXscale520-TCPMPMP3vsHEAAC2-GPRS.png

Note that this, mostly, affects Intel Xscale PXA-2xx users only – that is, users with HTC Universals, Athenas / X7500’s and several earlier PDA’s and handsets. Users of for example TI OMAP-based handsets won’t really notice any increase in battery life if they go for MP3 instead of HE-AAC v2. The reason for this has already been explained in my H.264 Bible (http://www.pocketpcmag.com/blogs/index.php?blog=3&p=2373&more=1&c=1&tb=1&pb=1): the TI OMAP platform is much more battery-friendly than the Intel PXA-2xx one. I can only hope Marvel, the new owner / developer of the old PXA architecture, have indeed improved on power usage in the brand new, 3x0-series PXA’s. (I still haven't had the chance to verify this as these new CPU's are used in very few and, in Europe, still not available, disconnected, traditional PDA models.)

1.4 Transcoders

Now, let’s elaborate on all the transcoder alternatives.

1.4.1 Orb (http://www.orb.com/)

Currently, the most widely known and popular transcoder (and generic radio streaming) service is that of Orb. It is hugely popular with both the Windows Mobile, Symbian and iPhone folks. It certainly deserves this: while, in some cases, it’s definitely lacking, the web access module it provides is by far the best of all. And, it not only allows for transcoding radio stations, but also accessing the files on your desktop computer and streaming multimedia files from there – as if they were located on your handset.

After installing, if you want to add your own radio stations to Orb, right-click the Orb icon in the Windows tray in the lower right corner, select Configuration and go to the Media tab. There, click the Add button in the “Music” group to add the directory of your playlist files.

http://www.winmobiletech.com/122007StreamTranscodingBible/AddRadioPLSFilesToOrb.png

They’ll, then, be shown under Audio / Playlists:

http://www.winmobiletech.com/122007StreamTranscodingBible/OrbMobilePlaylistsshown.png

Of course, under Audio / Internet Radio, you’ll still see the radio stations shipping with Orb (http://www.winmobiletech.com/122007StreamTranscodingBible/OrbInternetRadio.png) – you might also want to take a look at them.

I REALLY recommend giving Orb a try. Even if you don’t start to actively use it (because of the severe Orb restrictions and the vast superiority of the HE-AAC v2 format (Orb only uses the “dumbest” AAC-LC (http://forums.orb.com/viewtopic.php?t=3690))), it’s still worth paying a try.

1.4.1.1 Restrictions of Orb

If you take a look at the online Settings / Stream page of Orb, you see it offers several output stream types:

http://www.winmobiletech.com/122007StreamTranscodingBible/OrbMobileStreamTypes.png

(Incidentally, it’s this page that allows for selecting the streaming format. All this when accessed from a mobile browser like Internet Explorer on Windows Mobile, Nokia Web on Symbian or Opera Mobile on both operating systems.)

As can clearly be seen, WMA, RealAudio, some 3G formats (ALL in RTSP!), Winamp PLS and Flash are supported. Unfortunately, many of them (the 3G formats and RealAudio) are RTSP-only, which means they are completely useless if your mobile operator uses NAT’ing – that is, doesn’t expose your handset directly to the Internet.

As far as the Flash support of Orb is concerned, on Windows Mobile, the Flash player (screenshot running under Opera Mobile (http://www.winmobiletech.com/122007StreamTranscodingBible/FlashPlaybackInOrbOM.png)), while it starts with the official, latest MM7 Flash player plug-in, crashes after about 10 seconds when used from the built-in Internet Explorer (tested on two devices). On Opera Mobile 8.65, it keeps playing; however, it utilizes the CPU at 100% as can clearly be seen in HERE (http://www.winmobiletech.com/122007StreamTranscodingBible/FlashPlayerCPUUsage.png). And, in addition to the huge CPU usage, it also has a major problem: it uses a temporary file in the built-in storage of the device, which will, sooner or later, result in the storage’s entirely filling up and stopping / crashing the machine. A screenshot of these temporary files is HERE (http://www.winmobiletech.com/122007StreamTranscodingBible/FlashPlayerTempFiles.png). Flash Lite 2.1 (https://www.adobe.com/cfusion/entitlement/index.cfm?e=flashlite2%5F1%5Fwinmobile%5Fdownload) is totally incompatible with Orb’s Flash streams as can also be seen in HERE (http://www.winmobiletech.com/122007StreamTranscodingBible/FlashLiteWMIncomp.png).

Under Symbian, it doesn’t even start under the “old” but still official Flash Lite 2 support of Nokia Web as can also be seen in HERE (http://www.winmobiletech.com/122007StreamTranscodingBible/NokiaOrbFlashNo.png).
All in all, under the two mobile operating systems, using the Flash mode is in no way recommended.

Also note that the Winamp .pls format it offers internally just uses WMA streams – don’t think it’s a SHOUTcast-compatible stream meaning compatibility with Nokia Internet Radio / LCG Jukebox on Symbian or with many SHOUTcast clients (GSPlayer etc.) on Windows Mobile.

Two compatibility charts follow, which show the two major mobile operating systems in both NAT’ed and non-NAT’ed (direct) cases:

Windows Mobile:

http://www.winmobiletech.com/122007StreamTranscodingBible/t1.png


Symbian:

http://www.winmobiletech.com/122007StreamTranscodingBible/t2.png

As can clearly be seen, if your connection is NAT’ed, your only choice is WMA (which, incidentally, uses 32 kbps 44 kHz mono (!) sound in the 40 kbps, that is, GPRS setting). This will work on Windows Mobile but, currently, not on Symbian.

All in all, Orb is a decent choice if you have a faster (for example, EDGE or the even faster 3G, assuming you aren’t afraid of the huge battery usage of the latter) connection and/or a non-NAT’ed environment. In these cases, its technical inferiority (the lack of SHOUTcast stream support and, most importantly, the lack of HE-AAC v2 – that is, the only high-quality streaming format for GPRS connections) won’t cause you problems. Finally, it has pretty nice Sirius and XM support. See THIS (http://www.allaboutsymbian.com/forum/showpost.php?p=353195&postcount=7) for more info on the latter.

Let me, however, reiterate its disadvantages again:


if you try to listen to radio stations at GPRS speeds (meaning streams with 32 kbps bitrates max), it’s, audio quality-wise definitely a suboptimal solution and should only be used when you absolutely need to use it – for example, because you prefer its GUI to those of the other players. Why would you want to prefer mono WMA streaming with a lot of compression artifacts when, with other transcoders, you can have excellent, stereo HE-AAC v2 streams without compression artifacts - at the same bitrate? and/or
if you have Symbian (not WM) and a NAT’ed connection (ruling out everything – remember, in a NAT’ed environment, with Orb, you could only rely on WMA, but it’s not supported by the system and CorePlayer’s current version has very buggy streaming support),

you will definitely want to take a look at the SHOUTcast / Icecast2-based alternatives; most importantly, Oddsock.org’s excellent apps.

Note that I’m pushing the Orb folks to add Icecast2-based HE-AAC v2 and MP3 stream support. See THIS (http://forums.orb.com/viewtopic.php?t=9248) thread for more info.

1.4.1.2 Other Orb-related discussion threads of interest

Mobile Phone Streaming Issues (http://forums.orb.com/viewtopic.php?t=4139)

XM and Sirius (http://forums.orb.com/viewtopic.php?t=1833)

SKY.FM, DI.FM (http://forums.orb.com/viewtopic.php?t=9205)

Note that, while the old "High quality" option under 3GP, had a separate checkbox to switch to AAC(-LC); the new, 2beta version has a separate, top-level radio button for this mode. That is, don't let you be mislead by THIS (http://forums.orb.com/viewtopic.php?t=1432), THIS (http://forums.orb.com/viewtopic.php?t=1862), THIS (http://forums.orb.com/viewtopic.php?t=2271) and THIS (http://forums.orb.com/viewtopic.php?t=1860) threads, which still refer to the old approach.

Streaming, additional aac codec (http://forums.orb.com/viewtopic.php?t=2176)

1.4.2 Icecast2-based streaming

The following alternatives all require the usage of an Icecast2 server. (Note that, as an exception, VideoLAN VLC doesn’t necessarily need it unless you stream to a Symbian handset from it. The same stands for WME as well - it's a server on its own.)

1.4.2.1 Icecast2

Icecast2 (Wiki page HERE (http://en.wikipedia.org/wiki/Icecast)) is an open source equivalent of Nullsoft’s SHOUTcast (http://en.wikipedia.org/wiki/SHOUTcast) server, which does exactly the same. There, effectively, there isn’t much difference between SHOUTcast and Icecast2; geeks and other pros tend to prefer the latter; therefore, I also elaborate on it in here, instead of the closed-source, proprietary SHOUTcast.

You can get it HERE (http://icecast.org/). The download links are on the top of the page; if you have Windows, you’ll want to download the icecast2_win32_v2.X.X_setup.exe file. After installation, start it. Go to Configuration / Edit Configuration and edit the file in the following way:


Change the three passwords from “hackme” to anything under icecast / authentication. For example, in THIS (http://www.winmobiletech.com/122007StreamTranscodingBible/IcecastpasswordChange.png) screenshot, I’ve changed all the three to mennpwd. You don’t need to use the same word for all the three passwords.
The number of concurrent streams under icecast / limits / sources. If you plan to transcode more than two streams with a multiple stream-capable source client at the same time, you must modify this parameter too. For example, in THIS (http://www.winmobiletech.com/122007StreamTranscodingBible/IcecastSourceNr.png) screenshot, I’ve set it to 30 so that I can have 30 concurrent, different streams (we’ll see in which cases you’ll find this useful).

After editing, just close the Notepad window and answer Yes to saving it.

Now, when you click the Start Server button, it starts listening to incoming streams as can be seen in HERE (http://www.winmobiletech.com/122007StreamTranscodingBible/IcecastServerStarted.png). You won’t need to do anything else to Icecast2, other than starting / stopping the server if you need it or don’t need it any more.

Note that, by itself, Icecast2 doesn’t stream anything; it needs other clients (“source clients”), whose streams it just relays to the Net. That is, effectively, it uses the famous three-tiered Web application server model already known to many IT gurus, where the listening client equals to the Web browser, the middle tier (the application / Web server) is Icecast2 and the database back-end is, in this case, the transcoding source clients. It’s the stream of the latter that Icecast2, in the middle tier, “just” relays further to the client listener(s).

The streaming clients introduced in the next subsections are all geared towards using Icecast2 as the real streaming server. The only exceptions are:


VideoLAN VLC, which can also operate in a standalone mode (but, then, produce a stream not compatible with some media player clients, including Nokia Internet Radio);
Orb and, finally,
WME, which are also completely independent of Icecast2.

1.4.2.1.1 Mount points

You must be aware of the so-called ‘mount points’. Particularly when you stream more than one radio stations at the same time (in cases, you’ll want to prefer this solution to the others because it frees you from having to remote control the sound source), you will want to know what a mount point is.

When you configure an Icecast2 source client (VideoLAN VLC, Oddsock.org’s apps etc) to stream their contents to an Icecast2 server, you not only pass these clients the Internet address of the Icecast2 server they’ll need to connect to, but also an additional parameter that, later, uniquely identifies the stream: the mount point.

For example, let’s assume you stream two streams to your Icecast2 server from your VideoLAN VLC client. To quickly fire up the streams, you create a batch file with the following contents:

start vlc.exe --sout-shout-name="Iskelmä Radio" --sout-shout-description="Iskelmä Radio (Finnish)" http://217.30.180.250:8050/ :sout=#transcode{acodec=mp3,ab=32,channels=2}:duplicate{dst=std{access=shout,mux=ogg,dst=source:[email protected]:8000/iskelma}}

start vlc.exe --sout-shout-name="Radio Vaasa" --sout-shout-description=" Radio Vaasa (Finnish)" http://webcast.vlp.fi:8000/radioVaasa :sout=#transcode{acodec=mp3,ab=32,channels=2}:duplicate{dst=std{access=shout,mux=ogg,dst=source:[email protected]:8000/radioVaasa}}

Here, look for the iskelma and radioVaasa parameters. It’s there that you tell Icecast2 where to “map” these streams to. If you use these two mount points, you can access (listen to) these streams from a SHOUTcast/Icecast-compliant mobile client (TCPMP, CorePlayer, GSPlayer, Nokia Internet Radio, LCG Jukebox etc.) by simply supplying the mount point after the address and IP of your server like in the following direct URL you can directly enter in any of these players:

http://111.222.333.444:8000/iskelma

and

http://111.222.333.444:8000/radioVaasa

(111.222.333.444 is my desktop computer's imaginary IP address. You'll, of course, will need to provide yours. Use What Is My IP (http://whatismyip.com/) if not sure.)

Of course, prefer defining a playlist .pls file instead of entering URL’s like these into a player to make your life even easier because of the direct file access in most of these apps. The contents should be as follows:

[playlist]
numberofentries=2
File1= http://111.222.333.444:8000/iskelma
Title1=Radio Iskelmä
Length1=-1
File2=http://111.222.333.444:8000/radioVaasa
Title2=Radio Vaasa
Length2=-1
Version=2

(Note that you can leave out the Title and Length attributes. However, if you do so, the current beta of Nokia Internet Radio will crash and will be needed to reinstalled for it to work again.)

You can use any mount point name and you don’t need to explicitly configure the Icecast2 server to know anything about them. That is, you don’t need to tell Icecast2 “hey, I want to use the mount point “mystation”; let me configure you” at all. This is certainly very good news: only the original clients (transcoding the original Internet radios and streaming the transcoded contents to Icecast2) and the mobile players need to be aware of (that is, use) the same mount points.

An Icecast2 screenshot of showing several mount points being in use at the same time, with VLC acting as a streaming client:

http://www.winmobiletech.com/122007StreamTranscodingBible/ManyMountPointsInUseAtthesametime.png

1.4.2.1.2 Connecting to your Icecast2 server

In this section, I elaborate on how streaming clients and mobile multimedia players can connect to your Icecast2 server.

1.4.2.1.2.1 Streaming clients

As has already been mentioned, for a streaming client to connect to Icecast2, it must know the streaming source password (set in the icecast / authentication / source-password), the address: port (127.0.0.1:8000 if it’s running on the same desktop PC) and, finally, the arbitrary mounting point.

For example, in the above-shown VLC batch file,

start vlc.exe --sout-shout-name="Iskelmä Radio" --sout-shout-description="Iskelmä Radio (Finnish)" http://217.30.180.250:8050/ :sout=#transcode{acodec=mp3,ab=32,channels=2}:duplicate{dst=std{access=shout,mux=ogg,dst=source:[email protected]:8000/iskelma}}

the bold text, source:[email protected]:8000/iskelma, contains all this information.

Here, “source” is the username by default for streaming clients like VLC or the Oddsock.org apps. “mennpwd” is the password I use; “127.0.0.1:8000” is the IP address and port number of the Icecast2 server. In this example, it’s running on the local PC; hence the localhost address. Finally, “iskelma”, as we’ve already seen, is the mount point name.

1.4.2.1.2.2 (Mobile) receiver clients

As has already been mentioned in section “1.4.2.1.1 Mount points”, you can either directly enter the URL (of the form http://your desktop computer IP : port (8000 by default)/mount point) into the player or, alternatively, can create a .PLS (http://en.wikipedia.org/wiki/PLS_(file_format)) and/or (preferably extended, so that it also contains the station name) .M3U (http://en.wikipedia.org/wiki/M3u) file with the URL and a description. Note that these playlist files can have several URLs with separate descriptions. (Also note that I only use PLS files as examples in this tutorial because Nokia Internet Radio doesn’t support M3U files.)

An example PLS file having seven entries:

[playlist]
numberofentries=7
File1=http://111.222.333.444:1234/
Title1=Radio Peili
Length1=-1
File2=http://111.222.333.444:8000/iskelma
Title2=Radio Iskelma
Length2=-1
File3=http://111.222.333.444:1236/
Title3=Arkisto
Length3=-1
File4=http://111.222.333.444:8000/radioVaasa
Title4=Radio Vaasa
Length4=-1
File5=http://111.222.333.444:8000/rspo
Title5=RSPO
Length5=-1
File6=http://111.222.333.444:8000/klf
Title6=KLF
Length6=-1
File7=http://111.222.333.444:8000/rhesa
Title7=Radio Helsinki
Length7=-1

Version=2

Note that it has two non-8000, that is, two non-Icecast2 ports: 1234 and 1236 in the first and third records. I’ll elaborate on this a bit later, in the VLC section. All the other URL’s point to the same Icecast2 server with, of course, different mount points.

Colleting your favorite stations into one PLS file is pretty much useful because, then, it’ll become far easier for you to switch between the radio stations after opening the playlist file. For example, the above PLS file is rendered by Nokia Internet Radio the following way:

http://www.winmobiletech.com/122007StreamTranscodingBible/NIRPLSPlayListContents.png

By TCPMP, this way:

http://www.winmobiletech.com/122007StreamTranscodingBible/TCPMPPLSPlayListContents.png

and, by CorePlayer, this way:

http://www.winmobiletech.com/122007StreamTranscodingBible/CPPLSPlayListContents.png

Note that the two latter apps automatically start playing the first station in the playlist (Nokia Internet Radio doesn’t); if it’s a problem, you will want to separate your stations in separate PLS (or M3U) files. Also note that you can transfer these streams to your built-in "favorite" playlists in all these radio clients. Then, you won't need to click / import PLS files more than once.

Menneisyys
01-02-2008, 09:56 AM
1.4.2.2 Oddsock.org (http://www.oddsock.org) apps

Oddsock.org is the most important source of both MP3- (for Symbian users, the best solution) and HE-AAC v2- (for WM users) compliant encoding / transcoding server with direct output to Icecast.

Note that for some of them (except for the most recommended WinAMP plug-in version) to work with HE-AAC v2, you’ll need to copy two DLL’s to the home of the app (and NOT to the WinAMP home directory, no matter what the installer states): enc_aacplus.dll and nscrt.dll from the WinAMP plugins directory and home, respectively, if you’ve already installed WinAMP (you don’t need to install it for these apps to work). You’ll find all the two DLL’s (along with libfaac.dll – see next paragraph) in THIS (http://www.winmobiletech.com/122007StreamTranscodingBible/StreamTranscoderV3DLLs.rar) RAR file. After decompressing, just copy the DLL’s to the home (c:\Program Files\StreamTranscoderV3\ or C :\Program Files\OddcastV3 if installed on the c: drive in an English-language Windows).

For simple AAC(-LC), you’ll only need libfaac.dll if you plan to use it at all. I wouldn’t – it doesn’t seem to work with mobile clients. TCPMP announces it’s plain incompatible with the stream; CorePlayer and Nokia Internet Radio just endlessly buffer it – without playing anything. With desktop clients (for example, WinAMP) that do play it back, the sound is seriously distorted and is MUCH worse than with even MP3, let alone Ogg. I, however, have included it in the RAR file, should you still want to play with it. (Again, it’s not recommended.)

For MP3 streaming under OddcastV3, you’ll need to acquire the Lame MP3. I haven't included it in the RAR file.

1.4.2.2.1 StreamTranscoderV3 (http://oddsock.org/tools/streamTranscoderV3/)

One of the most useful, albeit in no way flawless Icecast2 source clients is StreamTranscoderV3, which, as the name implies, transcodes an input radio stream to another format. Note that the input stream must be either an MP3 or an OGG one. That is, it can’t transcode RealAudio and WMA streams at all. For the latter two, you must use other alternatives: Orb (if the problems – lack of HE-AAC v2 and MP3 etc. – aren’t an issue), OddcastV3 or WME (the latter if RealAudio is the source).

1.4.2.2.1.1 Installation, configuration

After installing the app, go to c:\Program Files\StreamTranscoderV3\ and, after you’ve copied the AAC DLL’s in there (if you want to transcode into HE-AAC v2), start streamTranscoderUIv3.exe. (Note that you can also do the same by clicking the streamTranscoderUIv3 icon on the desktop. It isn’t put in the Start menu.)

Using the ST3 is pretty straightforward. All you need to do is giving it the (source) stream URL (for example, http://81.175.250.3:8000/) in the uppermost text input field, pressing the upper arrow in “Num encoders” so that it becomes at least 1 and double-clicking the resulting, just-displayed “Disconnected” row in the main text area. An instance of Notepad pops up with an XML configuration file. In there, first, you must set the source password in the fifth row (ServerPassword=sourcepwd in the screenshot below) and the mount point to your choice (in the example, /iskelma) in the (sixth) row just under it.

Then, set the “Encode” attribute in the “# Output codec selection” section to “AAC Plus” and set BitrateNominal to, say, 32 (corresponding to 32 kbps). Note that you don’t need to alter the BitrateMin and BitrateMax parameters at all – the HE-AAC v2 encoder doesn’t take their value into account. Also note that you don’t need to touch the parameters in the “# AAC (FAAC) specific settings” section either. It’s only with streaming in AAC-LC (that is, using the old faac.dll) that these values have any meaning. For ~32 kbps streams, then, you’ll need to use AACQuality about 10 instead of 100. Again, streaming plain AAC-LC with ST3 is in no way recommended – even MP3 produces far better results at these low, GPRS-friendly bit speeds.

http://www.winmobiletech.com/122007StreamTranscodingBible/configureST3.png

The above configuration assumes you want to stream HE-AAC v2 contents. If you’d prefer MP3 (because, for example, you’d like to stream to Nokia Internet Radio, which, currently, doesn’t support HE-AAC v2 – or, for that matter, would like to use a non-HE-AAC v2-compliant Windows Mobile radio app), of course, you’ll need to use the string “MP3” in the Encode attribute. Then, in addition, you will want to reduce the sampling frequency as well. You shouldn’t do the same with HE-AAC v2: there, you must use the default 44.1kHz; otherwise, the encoder will fail right at connecting.

Note that you may also want to change at least the “ServerName=This is my server name” attribute so that meaningful values are displayed as the server name in your clients, instead of “This is my server name”.

After this, you can press the Start button and the streaming to Icecast2 will start:

http://www.winmobiletech.com/122007StreamTranscodingBible/RunST3.png

You can easily check this with the Icecast2 console:

http://www.winmobiletech.com/122007StreamTranscodingBible/RunST3Src.png

As can clearly be seen, Icecast2 is already broadcasting the stream coming from the stream source; in this case, StreamTranscoderV3.

1.4.2.2.1.2 Problems with ST3

Most importantly, it doesn’t seem to have a (working) dynamic volume limiter. This means some sources will be far too loud, which results in very annoying distortion in the transcoded stream. Some affected radio streams are as follows: Basso (http://83.145.201.209:8000/), Iskelmä (http://217.30.180.250:8050/), and, to a lesser degree, Radio Voima (http://81.175.250.3:8000/). You will NOT want to transcode these (and similar) radio stations with ST3 but go for an alternative solution; for example, OddcastV3 or, if low-bitrate MP3 is sufficient / preferable (instead of HE-AAC v2), VLC.

Second, the transcoded version of original OGG streams (as opposed to MP3 ones), like Radio Suomipop (http://217.30.180.242:8000/rspo.ogg) or Radio Classic (http://217.30.180.242:8000/clsr.ogg) will have heavy skips, while their MP3 stream (HERE (http://217.30.180.245:80/) and HERE (http://217.30.180.242:8000/clsr.mp3), respectively) of the same stations work OK. It seems ST3 has similar problems with other OGG sources as well. If you encounter cases like these, go for an alternative solution - fortunately, there’re several of them.

1.4.2.2.2 OddcastV3

It’s the WinAMP plug-in version of OddcastV3 that I recommend the most of all these transcoders, particularly when you are a Windows Mobile user and only have GPRS access and, therefore, would like to prefer HE-AAC v2 all the way. It has unmatched capabilities, which, paired with the excellent remote controllability features of WinAMP, make OddcastV3 without doubt the best solution for transcoding.

First, I explain the usage of the WinAMP plug-in; after this, the standalone one. You can download both HERE (http://www.oddsock.org/tools/oddcastv3/). Select either the WinAMP or the Standalone version. I heavily recommend the former; only go for the standalone version if you know, for some strange reason, you hate WinAMP and would never touch it because it can be used with any sound source, not only WinAMP.

1.4.2.2.2.1 WinAMP plug-in version

This version is integrated into WinAMP and should be accessed / controlled from in there (not as a separate entity, unlike with the standalone version). After installation, start playing a stream (the one you’d like to transcode) in WinAMP (this is VERY important – something must be played back in order the plug-in to be able to connect to Icecast2), go to Options / Preferences / Plug-ins / DSP/Effect and click oddcast DSP v3 (dsp_oddcast_v3.dll):

http://www.winmobiletech.com/122007StreamTranscodingBible/OddcastWinampPlugin.png

Click Add Encoder and, inside it, configure everything like with the standalone version of the same OddcastV3. That is, click “Add encoder” first. After adding one, double-click it (just like in ST3) to configure the outgoing stream.

It can be configured in a much easier way than ST3: instead of having to edit an XML file, you can edit the stream encoding parameters in a dialog box. For example, the following dialog box shows a 32 kbps HE-AAC v2 stream going to the Icecast2 server installed on the localhost, using the source password “menneisyyspwd” and using the mount point /iskelma:

http://www.winmobiletech.com/122007StreamTranscodingBible/OddcastConfig.png

After this, just click “Connect” in the main OddcastV3 GUI and the streaming will start right away.

Note that, as, by default, it uses the output of WinAMP, you don’t need to click the crossed-out mike icon, http://www.winmobiletech.com/122007StreamTranscodingBible/WAMPOddcastV3MikeIcon.png, in order to set up the mixer to act as the source. Instead, it’ll directly get use the output of WinAMP as the source. This has the huge advantage of it not “picking up” other noises / sounds of the desktop PC. Also, it lets for setting WinAMP’s output volume to zero (as opposed to the generic, non-WinAMP-plugin version). Finally, you don’t end up having to play with the system (Windows)-level recording volume controls in order to make it work and/or fine-tune the sound volume so that it’s neither too quiet nor too loud and, consequently, distorted – see the distortion problems explained with StreamTranscoderV3. Incidentally, I’ve tested the same radio stations causing severe volume overload-related distortion. I haven’t run into the same problems with this title. Also, it has no problems with OGG sources either.

One of the best features of the plug-in version is the ability to directly transfer song-specific metadata. Several Internet radio stations (for example, 977music.com) stream title-specific metadata along with the streamed audio. An example of this is shown HERE (http://www.winmobiletech.com/122007StreamTranscodingBible/WAMPOddcastV3TitleInfoTransferredToo.png), showing both the stream source (WinAMP in the background) and the mobile client running in SOTI's excellent Pocket Controller). Very few alternative technologies are capable of this feat – for example, anything based on the system audio mixer (and not direct stream transcoding) isn’t, including the standalone version of the plug-in.

A screenshot of the WinAMP plug-in version of OddcastV3 streaming the direct output of WinAMP:

http://www.winmobiletech.com/122007StreamTranscodingBible/OddCWinamplugininaction.png

The problem with this plug-in is the lack of support for original streams not played back by WinAMP; most importantly, RealAudio. However, you can stream them too (if you plan to stick with this stream source) if you quickly change the audio source from the WinAMP (internal) DSP to the system-level mixer of the PC in exactly the same way as with the standalone OddcastV3 client. This will also be elaborated on in the next section.

Note that, as with all the other Oddsock.org apps, the WinAMP plug-in OddcastV3 supports several output streams of the same input. The following screenshot shows it producing both a HE-AAC v2 and a plain MP3 stream, both at 32 kbps:

http://www.winmobiletech.com/122007StreamTranscodingBible/OddcastpluginTwoOutputs.png

There are many cases you’ll want to make use of this feature. Just an example. I, generally, keep several Windows Mobile and Symbian handsets with me. Without having to remote control my desktop computer with a fully-fledged, bandwidth-hungry desktop controller (see their Bible HERE (http://www.pocketpcmag.com/blogs/index.php?blog=3&p=1571&more=1&c=1&tb=1&pb=1)), I can quickly select from between the Windows Mobile-compliant, high-quality HE-AAC v2 and the Symbian-compliant, low-quality MP3 stream. That is, I don’t need to use the “lowest common denominator” approach to streaming (that is, streaming using the low-quality MP3) when I don’t know beforehand what operating system I will want to listen to radio stations – I can select the right one at runtime.

1.4.2.2.2.2 Standalone OddcastV3 client

http://www.winmobiletech.com/122007StreamTranscodingBible/OddcastStandaloneMain.png

This utility is vastly different from both ST3 and the WinAMP plug-in version of the same OddcastV3 introduced in the previous section in that it gets its source from the sound card mixer and not an external stream (as with ST3) or directly WinAMP (as with the WinAMP plug-in version of OddcastV3). That is, only stick to this if you in no way want to use WinAMP as the stream source.

This also means, compared to the WinAMP plug-in version, it has an extra configuration step (in addition to the initial AAC / MP3 encoder DLL copying to the home, C :\Program Files\OddcastV3, of course, which is also necessary with ST3). After installation, start it and set it up in exactly the same way as the WinAMP version. In addition, however, you’ll also need to set the default audio mixer of your desktop PC in the “Live recording” group. On my desktop PC, it’s “Realtek HD rear audio input”; on yours, it will be something else.

If you’re a newcomer to utilizing the built-in audio mixer of Windows, do the following in order to be absolutely sure you’re using the right input (and not, say, the default mike): click the loudspeaker / volume icon in the system tray (if you can’t find it, go to Start / Programs / Accessories / Entertainment / Volume Control), select Options / Properties and select the input mixer device you’ve defined (see the “Mixer device” drop-down list):

http://www.winmobiletech.com/122007StreamTranscodingBible/OddcastConfigSndSrc2.png

Now, click OK and make sure the “Stereo Mix” checkbox is ticked in:

http://www.winmobiletech.com/122007StreamTranscodingBible/OddcastConfigSndSrc3.png

In the above screenshot, the mouse cursor is just hovering over the checkbox so that you can easily find it.

1.4.2.3 VideoLAN VLC

There may be cases when you will want to prefer VLC to the other solutions, particularly when you have several streams you’d like to broadcast at the same time without relying on remote switching between them from a Web browser running on your handset. In this regard, VLC is probably the best solution.

Also, it’s heavily scriptable, which means, in general, you only need to create a batch file to quickly start transcoding. You just click on a batch file and a whole slew of transcoding processes start.

It, while is able to act as an Icecast2 / SHOUTcast source client, can also be directly connected by clients (it has server functionality too). Then, the stream it sends out won’t be SHOUTcast/Icecast2-compliant, which means for example no compatibility with Nokia Internet Radio. However, for other (for example, Windows Mobile) clients, it will still be usable and connectable. This is the mode you’ll need to use when transcoding WMA.

Finally, opposed to Orb (exactly like the other clients in here), it is completely SHOUTcast-compliant when used with an external Icecast2 client, which means it’s able to broadcast (some – unfortunately, not all!) SHOUTcast streams. This also means it’s fully compatible with Nokia Internet Radio (currently, the only really usable SHOUTcast client) on Symbian – and, of course, all the SHOUTcast-compliant clients on Windows Mobile.

However, it has problems as well; most importantly, it in no way supports HE-AAC v2 output (transcoded) streams. In addition, it’s not possible to remote control it, unlike with WinAMP-based solutions (most importantly, the most recommended OddcastV3) or Orb. Finally, VLC only supports (http://en.wikipedia.org/wiki/VLC_Media_Player#_note-18) (also see THIS (http://www.videolan.org/vlc/features.html)) one codec type (of the many), Cook (http://en.wikipedia.org/wiki/Cook_Codec), of RealAudio. This means it’s unable to play back for example Sipro Lab Telecom ACELP-NET (http://en.wikipedia.org/wiki/ACELP) (sipr) streams used by, for example, YLE (example stream at rtsp://ra.yle.fi/live/radiopeili.rm).

As there are a lot of tutorials explaining how the GUI should be used for streaming, I don’t elaborate on these issues. Instead, I provide you with something that you’ll find much more interesting, particularly if you need a way to mass-invoke the encoding process. Here, I show you how you can invoke VLC from the command line to quickly start transcoding (as opposed to the GUI-centric tutorials written by others).

I’ve already shown you a batch file (excerpt) in section “1.4.2.1.1 Mount points”. Let’s go over it again; this time, I explain what the parameters mean. First, these two commands (preferably when put in a batch file) invoke the main executable, vlc.exe, and pass several parameters to it, telling it which source stream to transcode and what Icecast2 server to send the transcoded stream to. In addition, it has additional parameters (static station names).

Let’s start with the first command,

start vlc.exe --sout-shout-name="Iskelmä Radio" --sout-shout-description="Iskelmä Radio (Finnish)" http://217.30.180.250:8050/ :sout=#transcode{acodec=mp3,ab=32,channels=2}:duplicate{dst=std{access=shout,mux=ogg,dst=source:[email protected]:8000/iskelma}}

Here, I used the Windows batch command “start” to start vlc.exe in the background. Should I have left this out, the batch file wouldn’t go on after invoking the first vlc.exe – that is, only the first stream would be transcoded.

--sout-shout-name="Iskelmä Radio" instructs vlc to use a user-defined string, “Iskelmä Radio”, to identify the station. The next parameter, --sout-shout-description="Iskelmä Radio (Finnish)" provides a somewhat more elaborate description of the station. These are in no way mandatory parameters. (Note that there're other SHOUTcast parameters usable with VLC; they, however, didn't work with me.)

The next parameter, http://217.30.180.250:8050/, is the source stream’s URL and, therefore, much-much more important than the first two.

Finally, the last parameter:

:sout=#transcode{acodec=mp3,ab=32,channels=2}:duplicate{dst=std{access=shout,mux=ogg,dst=source:[email protected]:8000/iskelma}}

is pretty much intimidating at first. Don’t be afraid, however, I explain it all.

The first section between the {} marks, acodec=mp3,ab=32,channels=2, tells the system to 1, use the MP3 encoding; 2, use 32 kbps and, 3, use two channels (stereo) in the transcoded stream. This section is very easy to modify; for example, if you want a mono MP3 stream, just change 2 to 1 after channels=. This will give you somewhat better audio quality and is preferable when you wouldn’t, otherwise, benefit from the source being stereo – for example, with mono talk programs. However, if you listen to streamed music via headphones, you’ll want to stick with the stereo mode, even at the expense of the (slight) sound quality degradation.

Similarly, if you need a 16 kbps MP3 stream instead of the 32 kbps one, just change 32 to 16 after ab=. (Then, you’ll also want to switch to mono mode, of course.)

The contents (access=shout,mux=ogg,dst=source:[email protected]:8000/iskelma) of the inner parentheses after “duplicate” defines some other parameters; namely, the target of the stream, which, in this case, is an Icecast2 server. “source” is the standard name for Icecast2 (‘back-end’) stream sources; mennpwd is the password I use. 127.0.0.1:8000 is the address of the Icecast2 server I (and, most probably, you also will) use (that is, as can clearly be seen, it’s running on the same PC) and /iskelma is an old friend of us: the mount point.

Based on the information above, you’ll recognize everything in the following direct invocation batch file snippet:

start vlc.exe --sout-shout-name="Radio Vaasa" --sout-shout-description=" Radio Vaasa (Finnish)" http://webcast.vlp.fi:8000/radioVaasa :sout=#transcode{acodec=mp3,ab=32,channels=2}:duplicate{dst=std{access=shout,mux=ogg,dst=source:[email protected]:8000/radioVaasa}}

Now, let’s take a look at a somewhat different batch file snippet: two VLC invocations that don’t use an external Icecast server as the middle tier in the transcoding process, but opens two ports in itself and waits for incoming client connections. (In this way, it implements the classic two-tier, client-server architecture.)

start vlc.exe mms://mediau.yle.fi/liveradiopeili :sout=#transcode{acodec=mp3,ab=32,channels=1}:duplicate{dst=std{access=http,mux=mpeg1,dst=:1234}}

start vlc.exe http://194.252.88.103/eanettiradio :sout=#transcode{acodec=mp3,ab=32,channels=1}:duplicate{dst=std{access=http,mux=mpeg1,dst=:1236}}

These commands are pretty much similar to the previous ones, except for:

1, they completely lack the --sout-shout-name and --sout-shout-description parameters (they can only be used together with an external Icecast2 server)

2, here, the dst (destination) parameter only has one port number (1234 with the first and 1236 with the second commnd) – and nothing else. This instructs VLC to open up server ports in itself, waiting for listening clients (for example, your handset) to connect. Instead of making an external Icecast2 server do this task.

Why would you want to use the second case? It’s pretty easy: there are streams that VLC is just unable to correctly transcode into an Icecast2-compliant format. WMA streams (just like the two in this example; that is, THIS (http://194.252.88.103/eanettiradio) and the WMA stream at mms://mediau.yle.fi/liveradiopeili) too belong to this category. In these cases, you can still directly access VLC.

Incidentally, if you encounter Icecast2 vs. VLC compatibility problems with some source stream types (like the above), you can easily determine if a given stream type can’t be streamed to VLC by checking out the total_bytes_read (highlighted HERE (http://www.winmobiletech.com/122007StreamTranscodingBible/0bytesreadBIcecast.png)) of the particular stream. If it’s 0 (as in the just-linked screenshot), then, the stream is just not compatible with Icecast2. WMA streams are exactly like these.

Note that I haven’t managed to test the RealAudio transcoding capabilities of VLC because of the limited compatibility. In this regard, Orb fares without doubt the best – that is, use Orb to transcode an initially RealAudio-only stream into a more handset / NAT-compliant one.

1.4.2.4 Windows Media Encoder (http://www.microsoft.com/windows/windowsmedia/forpros/encoder/default.mspx) (WME)

This free, system audio mixer-based (meaning it also needs a system-level audio source like WinAMP) and easy-to-use tool doesn’t require an outgoing Icecast2 server. That is, you can directly connect to it from your handset. However, its usability is pretty much hampered, particularly if you are stuck with GPRS because HE-AAC v2 delivers MUCH better sound quality at the same (low, GPRS-compliant) bitrates. Therefore, you’ll always want to prefer HE-AAC v2-capable transcoding solutions (for example, WinAMP with the OddcastV3 plug-in and an external Icecast2 server) to WME.

I don’t elaborate on configuring it in server mode because


there are several tutorials on it – use Google
as has already been pointed out, I do NOT recommend using it. In general, other formats are much more efficient at (24…32) low bitrates


The only reason I include it in this Bible (and in the final Comparison Chart) is that you can compare its capabilities with the competing technologies.

1.5 Remote controlling WinAMP

As has already been seen, currently (before Orb finally introduces Icecast2-based HE-AAC v2 streaming) WinAMP, together with the OddcastV3 plug-in, is probably the best way to transcode your streams. And, if you use a transcoder getting its audio input from the operating system mixer, you may still want to prefer WinAMP because of its high compatibility ratio (of the major radio streaming formats, it’s only RealAudio that it doesn’t support; Windows Media Player is far worse in this respect, unless you manually install additional codecs for it) and excellent remote controllability.

As using WinAMP (both with the OddcastV3 plug-in and a third-party, mixer-based encoder like WME or the standalone version of OddcastV3) it’s strictly a one-stream-at-a-time solution (as opposed to VLC or StreamTranscoderV3), you MUST know how it can be remotely controlled from your handset when you want to switch to another station.

Fortunately, there’re several remote media controller tools compatible with WinAMP. I’ve elaborated on all of them in the Remote Media Controllers Bible (http://www.pocketpcmag.com/blogs/index.php?blog=3&p=1707&more=1&c=1&tb=1&pb=1). Please make sure you VERY thoroughly read it and go for a solution that supports both WinAMP and remote, TCP/IP-based access.

1.6 Other goodies

All of the reviewed tools allow for not only transcoding radio stations, but also saving the stream to your desktop computer, into a file.

Note that, however, none of them has the same functionality as that of Streamripper (http://streamripper.sourceforge.net/). That is, even if they support music metadata, they don’t create separate files based on them. As has already been mentioned in my previous, radio streaming-related “sneak peek” (http://www.pocketpcmag.com/blogs/index.php?blog=3&p=2350&more=1&c=1&tb=1&pb=1), Resco’s excellent SHOUTcast client, Pocket Radio also supports this on Windows Mobile.

2. Feature & comparison chart

In the following chart, I compare the reviewed applications. The three main groups are as follows: Input compares the input formats they’re able to transcode; Output compares the streaming formats they are able to produce and, finally, Misc elaborates on issues already touched on in this Bible.

http://www.winmobiletech.com/122007StreamTranscodingBible/t31.png
http://www.winmobiletech.com/122007StreamTranscodingBible/t32.png
http://www.winmobiletech.com/122007StreamTranscodingBible/t33.png

3. Verdict

As usual, there’s no winner because several factors may influence your decision. Let’s walk over some of them.


If reducing the bitrate to 32 kbps or less is very important because you only have a GPRS connectivity or want to save bandwidth usage: your best choice is HE-AAC v2 (preferably, the WinAMP plug-in version of OddcastV3) if you have a Windows Mobile device. If you have a Symbian one, either a SHOUTcast MP3 stream-capable one or, if you’re lucky enough to have direct connection to the Net (non-NAT’ing mobile operator), you can (also) use Orb’s 3G AAC or RealAudio formats. Given that Orb has the best remote controller / stream selection interface, the latter choice is the best, particularly if you plan to listen to / switch between more than one stream.

You may also want to decide how many radio stations do you plan to transcode. First, let’s assume you don’t want to use Orb either because of the inferior transcoded sound quality at low bitrates (no HE-AAC v2 support – any sane person striving for using really low data usage will want to use HE-AAC v2 and nothing else) or the full incompatibility with your client (Symbian player in a NAT’ed environment).

If only one, then, you can use any of these technologies – even VLC and StreamTranscoderV3 (the two direct transcoders that can’t really be remote controlled without a fully-fledged and, as opposed to remote media controllers, heavily bandwidth-wasting remote desktop controller tool) will do.

If you’d like to easily switch between, say, 2...20 transcoded radio stations without any kind of remote sound source control (WinAMP remote control – again, see the related Remote Media Controllers Bible (http://www.pocketpcmag.com/blogs/index.php?blog=3&p=1707&more=1&c=1&tb=1&pb=1)), you might want to take a look at VLC (started from a batch file so that you don’t need to set up each transcoding session manually each time) or, again, StreamTranscoderV3. These are the best tools for parallel transcoding of some tens of radio stations (depending on your CPU speed and maximal usage you’d like to let). Note that, however, both of these solutions are a bit suboptimal. First, you may also run into the volume overdriving problems I’ve explained with StreamTranscoderV3 – and its limited source compatibility. And, with VLC, you can’t output HE-AAC v2 in any way.

If you need to transcode more than 20…30 stations (so that you can arbitrarily select from them on your handset), you can forget about parallel transcoding at once because of its CPU needs. Then, you WILL need to install a remote media controller to directly control (switch source stations) the sound source on your desktop computer. While there’re remote controllers for all major desktop players, you may still want to prefer WinAMP – particularly because of the excellent integration of the plug-in version of OddcastV3.

If using Orb isn’t a problem with you because
- the lack of HE-AAC v2 isn’t a problem because, for example, you (also) have an EDGE connection and, therefore, aren’t forced to using GPRS speeds and/or
- you have a direct, non-NAT’ed connection and/or
- you have a Windows Mobile device (remember: on Symbian, you MUST have a direct, non-NAT’ed connection for Orb to work! That is, orb is completely ruled out if you’re NAT’ed),

it might be the best choice for you because it’s really easy to set up and use: no need to set up and configure any transcoders and/or remote media controllers at all. Its Web interface is really intuitive, powerful and consumes very little bandwidth – as opposed to some other web interfaces (most importantly, that of VLC, which is really bad in these respects).

Menneisyys
01-03-2008, 07:52 PM
UPDATE (01/03/2008): as an addition to bullet 3 of section “1.2 When you prefer optimizing an, otherwise, working stream...”, I’ve made some 3G vs 2G power consumption tests on the HTC Trinity / P3600 (http://pdadb.net/index.php?m=specs&id=533) running the official February 2007 ROM version (http://www.pocketpcmag.com/blogs/index.php?blog=3&title=htc_releases_official_gps_enabled_htc_tr&more=1&c=1&tb=1&pb=1) so that I can prove that the “streaming over 3G consumes way more power than streaming over pre-3G connections, even at the same bitrate” rule-of-thumb is right with every single chipset used in contemporary handsets. The results speak for themselves:

http://www.winmobiletech.com/122007StreamTranscodingBible/Trinity3GvsGPRS.png

The first section shows playing back a stream over HSDPA, the second shows playing over exactly the same HE-AACv2 stream over GPRS, in TCPMP.

Let’s do some math: ~500 mA / ~280 mA = 78%! That is, if you stick with 3G on the Trinity for streaming, your battery life will be about 80% worse!

CPU usage vs power usage

Still looking at the above screenshots, the third (and all section after that) shows switching from the more CPU-intensive HE-AACv2 stream to an MP3 stream (still using GPRS – as in the next benchmarks) to find out whether the decreased CPU usage results in any change in the power usage. As can clearly be seen, there’s not much difference – they’re unmeasurable.

In the following screenshot:

http://www.winmobiletech.com/122007StreamTranscodingBible/Trinity3GvsGPRS-30min.png

I’ve enabled A2DP audio transfer to stereo Bluetooth headphones. A2DP, for some (for me, unknown) reason, is very CPU-intensive on all Samsung-based Windows Mobile devices. As I’ve already stated in some of my articles (see for example THIS (http://www.pocketpcmag.com/blogs/index.php?blog=3&p=1697&more=1&c=1&tb=1&pb=1)), it raises the CPU usage by about 50 (fifty) percents. (For comparison, at 400 MHz, the same Microsoft A2DP implementation “only” results between 10...20% of CPU usage increase on Intel Xscale (pre-PXA-3xx, where I still haven’t tested this) and on TI OMAP CPU’s.) Therefore, switching on A2DP is a great way to quickly “bump up” the CPU usage. In the first (short) test, I’ve continued playing the same MP3 stream (for quite a short time; therefore, the (relative) results aren't very dependable); in the second (much longer) test, I switched back to the original, more CPU-intensive HE-AACv2 stream. Then, the CPU usage was constantly at 100% (again, "thanks" to the huge CPU usage of A2DP on all Samsung-based Windows Mobile handsets) and the audio started to stutter. As can be seen, there was no measurable increase in power usage, compared to the case of only about 30% CPU usage.

This certainly shows the Samsung CPU’s do have some strengths; albeit, in many other ways, they’re definitely behind the current crop of CPU’s. For example, they still use the ancient ARMv4T architecture (approximately the same as that of the 9-year-old Intel StrongARM - yes, the CPU used in the first, h31xx/h36xx-series iPAQ's released in May 2000), while

even the oldest (much older than those of Samsung!) Intel PXA-series CPU’s are already ARMv5TE,
let alone the latest Texas Instruments OMAP2420 (http://pdadb.net/index.php?m=pdamaster&posted=1&cpu=a2420) generation (used in, for example, the Nokia N95 or, as far as Windows Mobile devices are concerned, (only) the Samsung SGH-i616, BlackJack II and the Moto Q9h Global – note that the Texas Instruments OMAP 850 Windows Mobile phones almost exclusively (http://pdadb.net/index.php?m=pdamaster&posted=1&cpu=a850) used in HTC’s “lower-end”, and the OMAP 1710 in some MS Smartphones (http://pdadb.net/index.php?m=pdamaster&posted=1&cpu=a1710) are still ARMv5TEJ only)
and the Qualcomm MSM7200 (used in many contemporary, higher-end HTC devices - HTC Kaiser etc.), which are ARMv6. That is, two generations more advanced than those of Samsung.