Monday, April 05, 2010

Stream, Baby, Stream

Run StreamBaby and it will stream video recordings from your computer to your TiVo. You fire StreamBaby up on your computer and let it sit there "listening" for the TiVo to command it to play a video. You go to your TiVo and from there select which video recording to play. Almost instantly, StreamBaby starts to stream the video through your TiVo into your TV.

It is a bit like TiVo multi-room viewing, which allows one TiVo in your house to feed a video to a different TiVo in a different room. With MRV you can begin watching the video in the other room as soon as the stream has started to transfer; in that way StreamBaby is basically like MRV with, as a source device, a PC or Mac, not another TiVo.

But StreamBaby is better than MRV. With MRV, if the bitrate of the program exceeds the speed of your network, you get a "hard pause" — one that will not automatically go back to playing the video after more of it has been streamed. You wait a bit, hit play, and pretty soon there's another hard pause. You manually go through the play-pause-play dance over and over and over again. Not wonderful.

StreamBaby will do the manual play-pause-play dance if you want it to, but it also gives you the option of throttling the bitrate down so that the video will play all the way through without interruption. That is wonderful.

And StreamBaby plays videos in a number of formats that the TiVo ordinarily can't deal with. For example, if on your computer you have a video in the MPEG-4/h.264/AVC format with the file extension .m4v, the TiVo ordinarily won't play it. StreamBaby plays it. StreamBaby plays .wmv, .avi, and .mkv videos too.

StreamBaby will swiftly seek to anywhere in the video, and play the video from that point in time. MRV won't. And StreamBaby will also fast forward/rewind to any point in the video, with low-quality static images appearing on the screen as a preview. (Unfortunately, videos in the .mpg, or MPEG-2, format don't present those static "thumbnail" images readily the first time they are played, until the static thumbnails are all cached for later use. That takes about five minutes for a two-hour movie. The cache is saved for the next time the video is played, however.)

StreamBaby lets you punch in, from the number pad on your TiVo remote, a sequence of digits, and then it will seek to that minute in the video. For example, if you punch in 1-8, minute 18 of the video will come up on your TV screen. Again, that's not something MRV can do.

StreamBaby responds to other key presses on the TiVo remote. For instance, if you use the FF or REW button and then the skip-forward or skip-back button, StreamBaby will jump forward or back in 15-minute increments.

StreamBaby remembers your position in a video when you stop watching and automatically starts at that position next time you watch. If you have more than one TiVo, it will do that even if you are using a different TiVo when you return to watching the video. Nice.

And the thing that really sells this hard-of-hearing guy on StreamBaby is that it puts subtitles on the screen along with the video. You have to go to a bit of trouble to turn the closed captions embedded in the video itself into subtitles, or to otherwise obtain the subtitles file, but once you do that, StreamBaby shows them.


StreamBaby First Use

After I wrote this, I learned about a much easier way to begin using StreamBaby — see Viva pyTivo!


StreamBaby runs under Windows, under Mac OS X, and also on Linux-based platforms. I'm using it on a Mac. According to the StreamBaby project website, getting started with StreamBaby is relatively easy under Windows. However, on a Mac there are complications. I'll detail some of them here.

(1) First, download the StreamBaby ZIP file from the website. At the time of this writing, it's the 0.29 version of StreamBaby, available here. But check the website to make sure that there isn't a later version for you to download.

(2) Unzip the ZIP file to get a folder called streambaby-0.29 (or whatever). You can put the folder wherever you want; I keep mine on my Desktop. In that folder, you're looking for the Unix executable named, appropriately, streambaby; it will run in Terminal. You're also looking for a crucial initialization file, streambaby.ini. Save a copy of the latter in its original form if you like, because you're going to  modify the original to (among other things) point to the folders that contain the videos you want to stream.

(3) Edit the original streambaby.ini file in TextEdit (drag the streambaby.ini icon to TextEdit on the Dock) to include the path to the top level of your video folder hierarchy. Here's mine:

dir.1=/Volumes/New 2TB Drive/TiVo Transfers
dir.1.name=TiVo Transfers

Notice that I also told StreamBaby by what name it should call my top-level folder. That's optional. If you don't specify your own dir.1.name, the default one that comes in the .ini file is "My Videos." The dir.1.name, whatever it is, will show up on your TV screen later on.

Notice also that there are embedded spaces in the dir.1 path name to my "TiVo Transfers" folder, and also in the dir.1.name. They're fine. You don't have to put an "escape" character ('\', a backslash) in front of the spaces. In fact, the streambaby.ini file won't work right if you do.

If you have no videos to stream using StreamBaby, then for the time being you will need to create (anywhere you like) an empty folder for this step.

But how do you ascertain the full path name to your videos folder? Download Copy Path.workflow.zip to your Desktop as a file named Copy Path (its extension, .workflow, is hidden), and then move or copy that file to become /Users/[username]/Library/Workflows/Applications/Finder/Copy Path.workflow. Substitute your own username for [username]. It then becomes a Finder plugin. To use it, select any folder or file in Finder, right-click on its icon, and choose More -> Automator -> Copy Path. Wait a few seconds for the plugin to do its work. The full path name is now on your Clipboard and, in TextEdit, you can paste it into streambaby.ini as dir.1!

In the streambaby.ini file, any line that begins with a '#" character is a comment. It has no effect. There are several of these in the original file to give you and idea of the kinds of things you can put in the file. (To find out all the things that can go in the file, click here.)

The active streambaby.ini file has to be in the same folder as the streambaby Unix executable.

(4) Your mileage may vary on this one. I found I had to put


ip=10.0.1.201


in my streambaby.ini file to get StreamBaby to work for me. 10.0.1.201 is the IP address of my iMac, set in Network Preferences. In that Preferences panel I've set my Built-in Ethernet connection (I'm using that connection and not AirPort) to "Configure: Using DHCP with manual address" and have entered 10.0.1.201 as my IP address. My iMac connects via an Ethernet cable to my AirPort Extreme base station (which is basically a wireless access point/router/Ethernet hub) and I run another Ethernet cable from the base station to my TiVo Series3. StreamBaby works for me only if I include the above line in my streambaby.ini file. If you try StreamBaby (see below) and find its "Stream, Baby, Stream" menu item won't show up on your TiVo, you might try looking at Network Preferences to find out your Mac's current IP address and entering it as a line like the one above in your streambaby.ini.

Don't forget to save your modified streambaby.ini file before you try to use StreamBaby. If you have already started StreamBaby on your Mac, you should quit it, modify streambaby.ini as desired, save the modified streambaby.ini, and restart StreamBaby from the Terminal window again. See below for more on how to do all that.

(5) This next part is a bit complicated. Bear with me. To get certain parts of StreamBaby's functionality to work, you have to install FFmpeg on your Mac. That's not easy, but doable.

First, download this ffmpeg.zip file to your Desktop. Then unzip it to put a folder called ffmpeg on the Desktop.

You are going to copy the ffmpeg.bin file within that folder to the /usr/bin/ directory, and then you will copy all five of the other files (the ones with the .dylib extension) to /usr/lib/. To do those things, you need to open a window in Terminal and enter

defaults write com.apple.finder AppleShowAllFiles TRUE; killall Finder;

followed by hitting return. Copy and paste the above to avoid typing errors.

That will cause hidden files and directories to show up in Finder. Next, navigate to /usr/bin/. /usr/ is at the top folder level on your main hard drive. /bin/ is one of the items at the top folder level within /usr/. Holding down the option key to make a copy, not move the original file, you need to drag ffmpeg.bin from the ffmpeg folder to /usr/bin/.

Then go back out to the /usr/ directory and open its /lib/ subfolder.  Option-drag all five of the .dylib files from the ffmpeg folder into that subfolder.

Now go back to the Terminal window and enter (via copy and paste):

defaults write com.apple.finder AppleShowAllFiles FALSE; killall Finder;

That will restore all hidden files to being hidden in Finder. Congratulations, you have just installed FFmpeg along with its five dynamic libraries!

(6) You're almost ready to try StreamBaby, but before you do, you'll need a video to try it out with. In Pt. 2 of this series I'll tell you how to create your own videos from recordings on your TiVo — you'll use your computer as an archive for them, plus decrypt them so they will stream in StreamBaby.

For now, you'll just download NxNW Clip.zip and unzip it to your Desktop. Then you'll edit


dir.2=/Users/[username]/Desktop/NxNW Clip
dir.2.name=NxNW Clip

into the streambaby.ini file, replacing [username] with your username. (Use the "Copy Path" Finder plugin mentioned earlier to simplify the whole thing.) Notice that this time, dir.2 and dir.2.name are used; this is your second StreamBaby folder. You specified the first one earlier, even if you had to create an empty folder somewhere to do it.

(7) Now that you have something to stream, it's time to fire up StreamBaby:
  • Open a Finder window for your streambaby-0.29 (or whatever) folder
  • Launch the Terminal application (it's a good idea to keep Terminal in your Dock); open a new window in Terminal, if none opens automatically
  • Drag the streambaby Unix executable file to the Terminal window and hit return
  • Expect to see something like 04/05/10 16:56:22 Listener: added factory and then 04/05/10 16:56:22 Main: streambaby ready & listening in the Terminal window, while ...
  • com.unwiredappeal.tivo.streambaby.StreamBabyMain opens as a separate application on your Mac; it's a Java app, and if it can't open properly, check that Java 1.5 or above is installed on your Mac; retry the above after you have obtained the latest release of Java for the Mac
StreamBaby is now running, so it's time for the acid test.

Go to your TiVo and from the TiVo Central menu choose Music, Photos, & Showcases. That will (after a couple of seconds of hesitation) bring up a list of items you can play, near the bottom of which (scroll down if necessary) is Stream, Baby, Stream.



If you don't see it, check near the bottom of the list for Enable Home Network Applications ... . If you see that, select it and comply with the instructions: hit the Thumbs Up button on your remote three times, then hit Enter. After you navigate back to the bottom of the Music, Photos, & Showcases menu, you should now see Disable Home Network Applications ... , just as in the picture above.

Or, if you see the "Disable" option already, you have a more serious problem. One possibility is that StreamBaby is using an IP address that the TiVo is blind to (see above for how you specify an IP address in streambaby.ini). You do have your TiVo on a wired or wireless network with you Mac, correct?

If so, then sorry, but solving problems like that is beyond the scope of this article. To get further advice, visit this thread at the TiVo Community Forum.

Once you do see Stream, Baby, Stream on your TiVo, select it. You should see a NxNW Clip screen with one item in its menu: NxNW Clip. Select that, and you should see NxNW 1 min.mpg. Select that, and you'll see a Play button, along with some others. Select Play. You will probably see a "Please Wait ..." icon and also some subtitles that begin playing even though there's no picture yet. After a few seconds, the picture and audio should snap in, and the subtitles will sync up with it.

The subtitles come from the NxNW 1 min.srt file in the same folder as NxNW 1 min.mpg, by the way. They were extracted from the closed captions in the original TiVo recording. In a later post, I'll tell you how I did it ...

Meanwhile, congratulations! You are just about ready to Stream, Baby, Stream ...

No comments: