Wednesday, February 16, 2011

Stream Movies Mac-to-Mac with VLC

I wrote in Archive HDTV Recordings to Your Mac, Then Stream Them Back to Your TiVo! about how I capture TiVo-made recordings to my iMac's external hard drives, then (though they have been erased from the TiVo) watch them once again via the TiVo itself.

In another blog, in Stream iTunes Movies from Mac to iPhone Safari, I talked about watching the same recordings — mostly old movies from Turner Classic Movies — in the Safari app on my iPhone. And in a pair of posts, I detailed other, non-Safari ways to stream my archived movies to either an iPhone or an Apple TV.

See a pattern here? I like to stream archived video content from my Mac to other devices (including back to the original TiVo).

Streaming Mac-to-Mac

One of the "other devices" that I've been neglecting is my "other" Mac, a MacBook Pro laptop. Bought several years ago, it hasn't really gotten much use of late — until now.

There are several Apple-approved ways to stream video content from one Mac to another across a home network centered on a WiFi router such as my Apple AirPort Base Station. For generality, I'll assume the two Macs in question are the "server" Mac (in my case, my iMac) and the "client" Mac (my MacBook Pro). To use standard Finder methods to connect the client Mac to the server Mac, I simply open a Finder window — any Finder window; that for the main hard drive, Macintosh HD, will do — on my client Mac's desktop. Then I look for the client Mac in the window's sidebar, under "SHARED."

(If you don't see your server Mac in the Finder window of your client Mac, you need to read the "Browsing for shared computers and file servers on your network" Mac Help page, which you can locate via the Help menu in the Finder.)

I double-click on the client Mac's icon in the server Mac Finder window's sidebar. After a few seconds I see "Connected as: Guest" in the Finder window. (Note that there is no indication on the server Mac that all this is going on.) A Guest connection's not good enough, though, so I click on the "Connect As ... " button in the Finder window to bring up a dialog asking for a name and password to access the file server that my server Mac appears to be, from the point of view of my client Mac. I enter those two items and click the "Connect" button.

Now I see, in the same Finder window on the client Mac, the "Connected as: username" confirmation that indicates I'm no longer a Guest on the server Mac. A list of my server Mac's various external hard drives (as well as certain other folders) appears in this window on the client Mac as well. At this point, I'll just open the particular folder that contains the particular movie I want to watch, and then drill down until I locate the actual movie file.

For purposes of this discussion, I'll be playing my archive copy of the classic 1944 movie Gaslight, starring Ingrid Bergman, Charles Boyer, and Joseph Cotten. It's in a file called Gaslight.mp4, which has this fully specified file path on the server Mac:

/Volumes/Segundo Dos/iTunes Videos on Segundo Dos/Gaslight/Gaslight.mp4

Streaming Using QuickTime Player

QuickTime Player's icon
Once I drill down in the client Mac's Finder window to that Gaslight.mp4 file, the easiest way to play it on the client Mac is to open it in QuickTime Player on that Mac. If on that Mac I have QuickTime Player set as the default app for playing .mp4 files, all I have to do is double-click on the file's icon. A QuickTime Player window opens, and the movie starts to play.

If you don't have QuickTime Player set as your Mac's default .mp4 player, you can either drag the file's icon to the the QuickTime Player icon in the dock, or else you can right-click (control-click) on the file's icon and choose QuickTime Player in the Open With part of the popup menu that you see.

That method works fine ... with qualifications. One, it doesn't pick up the subtitles that, using an app called ccextractor, I've derived from the original file's closed captions and put in a companion file called (Slightly deaf, I like subtitles.) Two, in my household there are spots where my home WiFi network can't deliver the video to my client MacBook fast enough to avoid occasional stops, starts, and stutters. This happens because the amount of data that QuickTime Player caches in its playback buffer is small enough that if the network hiccups, the buffer runs out of data. I'd like to enlarge the QuickTime Player cache buffer, but I don't know how.

Home Sharing Streaming: iTunes

A second method is to stream the movie to my client Mac via the iTunes application. I have added the Gaslight.mp4 file to my iTunes library on the server Mac, so on the client I can just look for it in "iTunes on iMac," found under "SHARED" on the left side of the main iTunes window (not the left side of a Finder Window). This in turn works because I have selected the "Turn On Home Sharing" item in the Advanced menu in iTunes on both Macs and entered into the resulting dialog the e-mail address and password for my account at the iTunes Store.

This time the movie plays in an iTunes window. The results are decent, but with the same qualifications as before. Plus, this particular method does no let me use the elapsed time "scrubber bar" to move easily to any arbitrary point in the movie. This is something I like to be able to do if I stopped watching the movie at time (say) 1 hr. 9 min. and want to quickly resume at that point. iTunes, when streaming the movie from a server in this way, won't let me "scrub" past the small amount of video material that it currently has accumulated in its buffer at any given moment in time.

Home Sharing Streaming: Front Row

Because I'm using Home Sharing, in theory I ought to be able to use a third way to stream my Gaslight.mp4 file from server to client: Front Row.

Entering Front Row, either by using the Apple Remote of my server Mac or by typing Command-Esc from the keyboard, I navigate to the Sources menu and then open its "iTunes on iMac" item. After Front Row loads information from my "iTunes on iMac" library, it lets me select "Movies." From the onscreen list that I see then, I select "Gaslight," and I wait ... and wait ... and wait. No movie ever appears on my client Mac's screen ...

There is something about Front Row (at least in Mac OS X "Leopard" version 10.5.8, which I'm running on both Macs) that simply won't let it stream movies from Home Sharing server to client, even though the same movie files stream reasonably well in QuickTime Player or in iTunes on the client Mac.

So none of the three Apple-sanctioned methods fill my bill entirely. Enter VLC.

Streaming Using VLC

VLC's icon
VLC is "a free and open source cross-platform multimedia player ... that plays most multimedia files as well as DVD, Audio CD, VCD, and various streaming protocols."

In other words, if you have a computer video or audio file or a shiny digital disc that contains video or audio material, chances are VLC can play it. (The main exception: files that are copy-protected, such as movies you buy at the iTunes Store, won't let VLC play them.)

Gaslight.mp4, as the .mp4 filename extension implies, is an "MPEG-4 container file" — geek-speak for a file organized in the MPEG-4 format. Specifically, this MPEG-4 container file contains video information that was created by H.264 — H.264 is a "codec," i.e., a coder-decoder for digital video. I know which codec the Gaslight.mp4 file uses because I myself created the file, using ImTOO HD Video Converter 6. In that application I selected the "H.264/MPEG-4 AVC" video codec in making the Gaslight.mp4 file. (AVC is another name for H.264.)

VLC is capable of playing MPEG-4/H.264 video files. Once I have a Finder window open on my client Mac that contains the Gaslight.mp4 file, I just drag that file's icon to the VLC icon in my dock. VLC opens a player window in which the video begins playing. It's magic!

On the client Mac I can also make VLC the default player for .mp4 files. I do that by selecting any such file in Finder — Gaslight.mp4 will do fine — and typing Command-I to bring up its Get Info window. In that window I use the Open with: drop-down menu to select VLC.1.1.7. I click on the Change All... button to "Use this application to open all documents like this." A dialog appears: "Are you sure you want to change all similar documents to open with the application VLC?/This change will apply to all documents with extension '.mp4'." I click Continue and then close the Gaslight.mp4 Info window. Simple as that. Now all I have to do is double-click the Gaslight.mp4 icon, and VLC opens the video in a player window on the client Mac.

Very cool!