How to Stream Favorite Movies (MP4 Files) From Linux Terminal to Your Apple TV

[‘

n

If you are in search of a solution to stream your downloaded movie content to an Apple TV on your home network, you may have hit a barrier that many Linux users hit, which is that Apple hasn’t made it easy to tap into their AirPlay technology.

n

Stream Movies to Apple TV from Linux
Stream Movies to Apple TV from Linux

n

There is a way however, to take your .mp4 video files and stream them to your Apple TV, thanks to a few nifty Ruby programs and the libraries used by the Airplay protocol.

n

Assuming you are using Ubuntu (or any Ubuntu based distro) you will need to install the following dependencies required to communicate with your Apple TV device.

n

1. Open a terminal window and install the package “libavahi-compat-libdnssd-dev” by typing the following command.

n

$ sudo apt-get install libavahi-compat-libdnssd-devrn

n

Install Libavahi Package
Install Libavahi Package

n

2. After that installation is complete make sure you have at least Ruby 2.0 installed on your system. Inside of your terminal type the following to ensure that it is indeed installed.

n

$ ruby --versionrn

n

You will receive an output that should look something like this:

n

ruby 2.1.4p265 (2014-10-27 revision 48166) [x86_64-linux]rn

n

Check Ruby Version
Check Ruby Version

n

If 1.9.x is installed, you will want to upgrade your version of Ruby to 2.x by adding the Ruby PPA to your apt sources list. You would do so by typing the following commands in your terminal.

n

$ sudo apt-add-repository ppa:brightbox/ruby-ngrn

n

When prompted hit ENTER. Next run,

n

$ sudo apt-get updatern$ sudo apt-get install ruby2.0-devrn

n

Add Ruby PPA
Add Ruby PPA

n

Update System
Update System

n

Install Ruby Package
Install Ruby Package

n

3. Now that Ruby is up to date, we will need to install two “gems” that will allow us to send our video to our Apple TV. The gems we will install are airplayer and airstream.

n

To install we will need to run the following:

n

$ sudo gem install airplayerrn$ sudo gem install airstreamrn

n

Install airplayer Package
Install airplayer Package

n

Install airstream Package
Install airstream Package

n

Note: This will automatically install the dependencies required to run these programs as well as the programs themselves.

n

4. We have the software we need to stream our video, but we need to know where on our network our Apple TV is (where to send our video). To do this we run,

n

$ airplayer devicesrn

n

This command will output something that will resemble,

n

0: Apple TV (Resolution: 1280x720, Version: 200.54, IP: 192.168.0.6:7000)rn

n

Search airplay Devices
Search airplay Devices

n

Note: Take note of that IP address (minus the ‘:7000’) portion.

n

5. Now go the path, where your favorite movies stored and then in a terminal window run the following command to stream the movie to your Apple TV.

n

$ cd /path/where/video/is/rn$ airstream -o IP.OF.APPLE.DEVICE ./nameofvideo.mp4rn

n

Play Movies to Apple TV
Play Movies to Apple TV

n

6. Now check out your TV and viola! You are streaming your video to your Apple TV.

n

Conclusion

n

Now, some knowledgeable on this subject may airplayer alone is sufficient to handle playback of video on Apple TV. It has been my experience that the airstream gem does this task more reliably. I simply use the airplayer gem to discover the IP address of the Apple TV.

n

If you have videos that are not in mp4 format and are .mkv, .avi, .mov, they will need to be converted in order for playback to work via airstream.

n

Feel free to post your questions, and I hope this will be a painless process to accessing what is rightfully yours.

n

‘]