Play DVD audio via AirTunes and VLC

Oct 26, '04 09:03:00AM

Contributed by: nhamblen

Encouraged by the success of channeling sound to iTunes and then AirTunes with NiceCast, I thought I would try doing the same thing with VLC, since it also can stream audio. VLC's interface is almost purposefully cryptic, and it's hard to find a reference to it streaming 'Shoutcast' (the stream that iTunes can receive), but Shoutcast's ICY protocol is so simple that you can replicate it just by telling VLC to stream an MP3 to HTTP with raw (no) encapsulation.

VLC's streaming configuration panel doesn't really work (or at least I can't figure it out), but after significant googling, I deciphered their MURL scheme enough to write my own streaming MURL. Here it is:
#transcode{acodec=mpga,ab=192,channels=2}:duplicate{dst=std{access=http,
mux=raw,url=:8080}, select=novideo, dst=display, select=noaudio}
Note: the above should be one long line, and do not add a space after the comma at the line break...

What this says is to transcode audio to 192 bit/sec MPEG layer 2 (the MP3 encoder is much slower), to display the video only, and to stream the audio to HTTP port 8080. Copy and paste this MURL to the "Choose a stream output" input box of the Stream output page of VLC's preferences. You'll need to check "Advanced" to see this page. Don't change any other streaming controls.

It turns out that VLC 0.7.2 is not a very efficient transcoder. You'll likely need to use the crash-happy but fast 0.8 test2 version. Play a DVD with these settings, and you should see video with no audio. Open iTunes and go to Advanced -> Open Stream. Tune to icy://localhost:8080 and select your AirTunes speakers. You should hear your movie with a considerable delay. On my computer, this delay is reliably 2.85 seconds. On the audio page of VLC's prefs, put in -2850 for the desynchronization compensation. Close your movie and open it again (you have to do this for any preference change to take effect, it seems). When your movie opens, it should be more closely synchronized. If it's not perfect, you may need to fiddle with the compensation. Pausing the movie, or clicking through menus, will require some patience since everything is affected by the audio delay.

The volume control in VLC seems to have no effect, so you'll need to use the one in iTunes. Seeking in a movie is VLC's weakest point; in the beta version, you'll need to pause before you seek or it will probably crash.

My 1Ghz PowerBook is able to do all of this at less than 50% CPU utilization. Increasing the audio bitrate helped lower it, so you may want to increase it more if your CPU is overloaded. Also, it's conceivable that you could stream the audio to another computer's iTunes to offload some of the work. Either of these changes will increase the audio delay and require adjustment in the compensation.

Setting this up is a bit of work, but in my wireless household, we wouldn't have it any other way. Good luck!

Comments (14)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20041023154910602