MacDevCenter    
 Published on MacDevCenter (http://www.macdevcenter.com/)
 See this if you're having trouble printing code examples


Stream Live HDTV from Your Mac

by Erica Sadun
02/20/2007

EyeTV-compatible tuners, like those offered by Elgato and Miglia, are the television tuners of choice for the Macintosh. These tuners provide analog and digital, standard and high definition solutions for Mac TV-watching. You can sit in front of your Mac and watch your shows as they record. But say you want to watch a show in your living room or bedroom? Sure you can wait for the show to finish recording, copy it over your local network, and then watch it. Or you can put on your hacker's cap and stream it in real time.

This article shows you how to combine a little OS X trickery with Video Lan Client's (VLC) built-in streaming. Not only can you watch your streamed standard- and high-def TV on a remote computer, but you'll be able to control the playback from that remote computer as well. Here's how.

Getting Started with Mac Video Streaming

The equipment and software requirements for this project are fairly straightforward. You're basically sending video from one computer to another over your already-existing network connection. Here's a quick checklist of all the items you'll need on hand to make this happen:

A fairly recent Mac (sending). Your computer needs to be powerful enough to record video and stream it out at the same time. Neither of these are particularly demanding tasks processor-wise, but they do take a toll on your system. Yes, you can stream from a 733 G4 (and I have), but it's really not powerful enough to record video while exporting a steady video stream without constant breaks and interruptions.

A VLC-compatible networked computer (receiving). Any computer that runs VLC (Mac, Windows, or Linux) can receive the EyeTV recordings you stream over the network. The instructions in this article are for the Macintosh, but you can easily adapt them for other platforms. Also, while the receiving computer can be far less powered than the sending computer, the network itself has to be high-speed. (Wired or high-speed wireless is recommended.)

An EyeTV-compatible tuner with EyeTV software. The instructions in this article are limited to EyeTV-supported tuners, like the ElGato EyeTV Hybrid and the Miglia TVMini HD. These tuners, like all EyeTV-compatible tuners, record MPEG-2 streams from your cable or antenna connections. Although some compatible tuners (Plextor PX-402 and Elgato EyeTV 200) can optionally record MPEG-4, you need to use MPEG-2 streaming for this project. You can find a list of EyeTV compatible tuners here.

VLC. Install copies of Video Lan Client on both the sending and receiving computers.

Step 1: Create an Alias that Points to Your EyeTV Recordings

EyeTV stores its video in bundles, OS X folders that look and act like individual files. They really are folders with data stored in them, but they look like a file in Finder. Fortunately, you can use standard OS X commands to open these bundles and reveal the data inside. The bundles, which use an .eyetv extension, can be seen in Figure 1.

EyeTV Bundles
Figure 1. EyeTV uses bundles with the .eyetv extension to store video data. Both Heroes.eyetv and Live TV Buffer.eyetv contain hidden video and other files.

Open the EyeTV Bundle

To open an EyeTV video bundle, whether recording or already recorded, control-click (or right-click) the EyeTV file and select Show Package Contents from the contextual pop-up menu (Figure 2). A new window opens showing the bundle contents. The files will include several EyeTV management files, a thumbnail (the TIFF file), and an MPEG file (using the .mpg extension). EyeTV uses this file to store its video data.

Show Package ContentsContents revealed
Figure 2. Use Show Package Contents to open an EyeTV video bundle (left) and reveal the underlying MPEG video (right).

You cannot open this MPEG file in QuickTime, even if you have purchased an optional QuickTime MPEG-2 component. EyeTV stores video using what's called an MPEG transport stream, the raw data transmitted by broadcasters.

Even though QuickTime won't handle this MPEG video, VLC has no problem playing it back. If you like, you can drag the MPEG file onto your VLC icon and it will open and start playing. For this project, you'll make an alias to the MPEG file instead, so you can open it directly using a standard file selection dialog.

Create an Alias of the MPEG File

Control-click (or right-click) the MPEG file and select Make Alias from the contextual pop-up. A new OS X alias will appear and display a small arrow in its lefthand corner. Drag this alias out of the bundle and onto the desktop. By opening the alias in VLC, the program points to the recording file even as it grows.

Step 2: Preemptively Deal with Your Firewall

Your sending computer will use UDP port 1234 to stream video. Make sure your receiving computer will not block that port by adjusting its firewall settings. Open System Preferences -> Sharing. Click Firewall and then choose New. Set your Port Name to Other from the pop-up menu and enter 1234 as the UDP port number. Enter a description (like "VLC Streaming Video") so you'll be able to remember what this exception does (Figure 3). Click OK. The new item appears at the bottom of your "Allow" list. You may quit System Preferences on the receiving machine.

UDPPortOpen
Figure 3. To receive streaming video, you may need to create an "Allow" rule for your firewall.

Step 3: Use VLC's Streaming Wizard to Create Your Stream

On the sending Macintosh, launch VLC. Select File -> Streaming/Exporting Wizard (Command-Shift-W). The Streaming/Transcoding Wizard window opens:

  1. Select "Stream to network." This option is selected as the default. Click Next.
  2. Select your stream. With "Select a stream" selected, click Choose. A file selection dialog opens. Navigate to the alias you created on your desktop. Select it and choose Open. Click Next.
  3. Tip: When you select several files (or aliases) at once, VLC creates a playlist of those videos. The web interface you add in Step 5 allows you to select from that playlist and choose which video you want to watch. Very convenient!

  4. Choose your streaming method and destination. Make sure that UDP Unicast is selected and enter the IP address for the computer you wish to stream to (Figure 4). Click Next.

  5. Select Destination
    Figure 4. It is vital to connect to the proper address while streaming. Make sure you correctly enter the Destination address. On the Mac, you can find out the address for your computer by opening System Preferences and selecting the Network settings pane.

  6. Do not transcode. Leave both boxes unchecked on the Transcode page. Click Next.
  7. Use MPEG TS encapsulation. MPEG TS refers to MPEG transport stream. Click Next.
  8. Leave the additional options alone. Keep the Time-To-Live, SAP Announce, and Local Playback settings exactly as is, and click Next.
  9. Check the summary. The final page of the Streaming/Transcoding Wizard lists all the settings you've chosen. Make sure you're streaming UDB-Unicast to the proper destination with no transcoding and MPEG TS encapsulation. Click Finish. A new VLC Controller opens on your sending computer (Figure 5).

  10. VLC Controller
    Figure 5. After finishing the Streaming/Transcoding Wizard, this new controller appears in VLC. Just let it be.

Step 4: Watch Video on Your Receiving Computer

With VLC running on your destination computer, select File -> Open Network (Command-N). If you're not on a Mac, the Linux and Windows versions use essentially the same function, but I believe it's called "Open Network Stream" instead of "Open Network." On a Mac, the dialog shown in Figure 6 opens. All the default settings apply. Just click OK.

Open Source window
Figure 6. Use the default settings in the Open Source window. Just click OK to start watching your streaming EyeTV video.

Assuming you've set everything up correctly--and really, there's not a lot of rocket science here so you probably did--your video will start playing. Figure 7 shows the video playing on my old and cranky 733 G4.

Open Source window
Figure 7. If you pay attention, you'll notice an "HD" icon in the lower-left of this image. This is not a transcode. That's actual HD streaming from my Mac mini to my G4. You can view a full-size screen shot here. The video was so large, it ended up crossing from one of my two screens to the other. Fortunately, my SnapzPro screenshot utility was able to snap both screens at once to produce this image. The video played back with few jumps or delays. (Turning off extraneous programs like email is a big help in keeping the playback smooth!)

Step 5: Add a Web-based Remote Control

The web-based remote is one of VLC's least-trumpeted features, and this really shouldn't be the case. It's very cool. The remote allows you to control your VLC playback from another computer, in this case the one receiving the video you're streaming. To enable this feature, you'll need to return to the computer of origin, the one that's streaming the video.

  1. Enable the web interface. In VLC on the sending computer, choose VLC -> Add Interface -> Web Interface. Unfortunately, there will be no feedback that you've accomplished anything at all. The submenu will not be checked, and there will be no other visual confirmation whatsoever. However, once you've enabled this interface, you can move over to the destination computer and access it right away, so that's confirmation of a sort.
  2. Connect to the web interface. On the receiving computer, launch your favorite web browser and connect to port 8080 at the address of the sending computer, e.g., http://192.168.1.101:8080/. (Obviously, this will vary according to your local network.)
  3. Click Help. You'll find the Help button beside the words "VLC media player" at the top of the page. This option adds words to all the little icons and makes them a lot easier to use, as Figure 8 shows. Use the icons on this virtual remote to start, stop, and otherwise control your video stream experience.

VLC web interface
Figure 8. If you enable the VLC web interface, you can control your VLC stream directly from your remote computer. Very convenient!

CyTV

CyTV is another network streaming solution for EyeTV; it is still in beta development. Like the VLC solution discussed earlier in this article, it allows you to watch EyeTV content over a network. In fact, it even uses VLC to display its video.

CyTV ships with a CyTV client and a CyTV server to run on the two computers you're connecting. When running, the server controls EyeTV on the sending computer. Figure 9 shows the client in action.

CyTV
Figure 9. CyTV offers many of the same features as VLC streaming with a nicer interface, but actual performance takes a huge hit. Video delivery is slow and hesitant.

Although CyTV shows great promise, it's still in early development. When I tested it, response time was unacceptably slow. I could barely watch a standard definition TV stream on my G4. There were many halts and hesitations while streaming. High definition streams were out of the question. On the bright side, whereas VLC allows you to switch programs when you load items into its play lists, CyTV was designed to allow you to switch channels in real time, although I was unable to make this feature work in my tests.

Conclusion

Congratulations! You've just built a remote video streaming solution that you can use to watch video as it records in another room. You've learned how to access EyeTV's raw MPEG transport streams, create an alias that links to them, use VLC to stream that MPEG, and watch the video on another computer. It only takes a few simple steps to put all of this together and make it work. Best of all, outside of your initial investment in EyeTV, you can build this setup using equipment you already own and with free open source software.

Thanks to Nicholas Freeman and Adam Steinberg of Elgato for their technical insights during the preparation of this article.

Erica Sadun has written, co-written, and contributed to almost two dozen books about technology, particularly in the areas of programming, digital video, and digital photography.


Return to MacDevCenter.com.

Copyright © 2009 O'Reilly Media, Inc.