Monday, January 28, 2013

Stream Videos From Mac To AppleTV Without iTunes

I have been looking for a solution to stream videos from my iMac to Apple TV without needing to use iTunes.

I don't like to keep vidoes in iTunes because my iTunes library is already rather unwieldy. Adding gigabytes of videos to it, and then subjecting the bloated thing to Time Machine backup? Does not sound like fun. I could opt to not copy the videos into my iTunes library when I add them, but that same setting will apply to my music as well. No joy there. So how can I stream these videos?

First there was AirFlick, but that stopped working with Lion. Then I thought perhaps Mountain Lion's AirPlay Mirroring would do the trick, except my iMac isn't recent enough to use it. Bummer. I even purchased a copy of AirParrot to wirelessly use an AppleTV connected HDTV as a second monitor to a MacBook when it's in the same room as the TV. But no joy to streaming videos stored on an iMac, which is in an adjacent room.

Then a solution hit me. Here is what I did to set things up:

  1. Open Termninal, and create a symbolic link under /home/me/Sites/Videos, pointing to where I have my videos stored.
  2. Edit /etc/apache2/users/me.conf thusly (sudo required):
  3. # Adding the "*" at the end enables the server to serve up sub-directories.
    <Directory "/Users/me/Sites/*">
        Options Indexes MultiViews
        AllowOverride None
        Order allow,deny
        Allow from all
  4. Go to System Preferences > Sharing, and turn on Web Sharing.
  5. Turn on and configure AirPlay on my AppleTV.

Now, whenever I want to watch a video stored in my iMac on my HDTV, I just:

  1. Open up Safari on an iOS device, and browse to http://myimac.local/~me/videos. Better yet, bookmark it.
  2. From the simplistic index page generated by Apache, choose a video to play.
  3. Once the video starts to play on my mobile device, tap on the AirPlay icon and choose AppleTV.
  4. In a few seconds, the video will start playing on the AppleTV. At this point, I can use the Remote app or the Apple Remote to control the playback on AppleTV.

This solution works perfectly, except for when my iMac is asleep. To overcome this, I installed the free mWOL app on my iOS devices and configured them to be able to remotely wake up the iMac as needed to stream videos.

By the way, the last two steps about choosing AirPlay to AppleTV are optional, especially when using an iPad.

Sunday, January 27, 2013

Stitching Together .m4v Files on OS X Lion

So I have a bunch of segmented .m4v files that I wanted to join together into one single file. A bunch of googling & experimentation later, I came across this solution:

  1. Download the most recent/stable version of GPAC, mount the disk image, and drag the application into the /Applications folder. Then, unmount the image.
  2. Open Terminal, and cd into the directory where my video files are.
  3. Suppose my files are named 1.m4v, 2.m4v, and 3.m4v, etc. Execute the following commands:
    • /Applications/ -force-cat -cat 1.m4v movie.m4v
    • /Applications/ -force-cat -cat 2.m4v movie.m4v
    • /Applications/ -force-cat -cat 3.m4v movie.m4v
    • ... and so on ...

Voila! Now I can just play the one file instead of having to either playing each one individually to creating some sort of play list to do so.