Welcome to iPadForums.net Guest - Click Here to Register

HOWTO: Stream videos to Apple TV 2, using iPad under Ubuntu

This is a discussion on HOWTO: Stream videos to Apple TV 2, using iPad under Ubuntu within the AirPlay forums, part of the iPad Help category; Playing around with my iPad/iPhone and Ubuntu, I got an idea that could help Ubuntu Users who have an Apple TV 2... The goal is ...

Register with iPad Forums
+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    iPad Junkie
    Member #
    29813
    Liked
    20 times
    Join Date
    Jan 2011
    Location
    Quebec
    Posts
    642

    Lightbulb HOWTO: Stream videos to Apple TV 2, using iPad under Ubuntu

    Playing around with my iPad/iPhone and Ubuntu, I got an idea that could help Ubuntu Users who have an Apple TV 2...

    The goal is to be able to stream any movie (mp4 format) from a local drive using the iPad/iPhone as the streamer to the Apple TV 2. First, I looked as a few free apps to see what was possible. In the end, I needed to download the movie on my device and then stream to the Apple TV 2. That's not what I wanted to do. I want the stream directly from the remote disk without having to download the file on my device.

    So I figured out that some websites allow AirPlay to be used on their website... After a few searches, I found out how to embed a video in a webpage, so it would be airplayable using the iOS device. Here is the basic HTML 5 code:

    Code:
    <video controls='true' width='120' height='80' x-webkit-airplay='allow' src='somemovie.mp4'></video>
    Next step was to create a webpage that would scan a folder, and embed all those movies into a HTML page...

    So to make it quick, I created a small bash script to do the job. Of course, PHP or other web language can be used to do the same job, but I wanted to do a fast proof of concept...

    Here is the script:

    Code:
    #!/bin/bash
    echo "<HTML>">index.html
    echo "<body>">>index.html
    echo "<H3>Movies List</h3>">>index.html
    for f in *.m4v; do
    echo "$f<br>">>index.html
    echo "<video controls='true' width='120' height='80' x-webkit-airplay='allow' src='$f'></video><br>">>index.html
    done
    echo "</body>">>index.html
    echo "</HTML>">>index.html
    You have to install Apache2 to have a webserver, and create a symlink in "/var/www/" that will point to your videos folder

    Code:
    sudo ln -s /home/patrick/Videos /var/www/videos
    Run the script in the folder of your videos so it will create a file called "index.html". Then, using your iDevice, goto "http://192.168.1.6/videos" (Put your own ip adress, of course!)

    The results will give you this (using my iPhone):



    Then just play any movie and activate AirPlay towards your Apple TV 2...

    This is a pretty basic script, but a lot more can be done. If you use some language like PHP, then you could scan dynamically for sub-folders, any supported media type, have more details about each movie, etc...

    So that means for Ubuntu fellows, iTunes is not needed anymore if you want to watch your local movies on your Apple TV 2!

    Have fun!
    Attached Thumbnails Attached Thumbnails HOWTO: Stream videos to Apple TV 2, using iPad under Ubuntu-img_0253.png  
    iPhone 4S 16Gigs 5.01
    iPad 1 16 Gigs Wifi 5.01
    Canada / Rogers

  2. Ads


  3. #2
    iPad Junkie
    Member #
    29813
    Liked
    20 times
    Join Date
    Jan 2011
    Location
    Quebec
    Posts
    642

    Lightbulb AirPlay using pure HTML for Apache2 (or else)

    Ok, I've made some more tests using my Ubuntu Laptop, an external USB hardrive and, yep, movies...

    Since I was using an external hardrive, I had to give Apache2 my credentials so it could read my USB drive. Surely there is a better way, but, this is a proof of concept...

    I've modified the script to create a lighther index.html page since the iPad is trying to create a thumbnail of all movies. This was giving some bottle neck on the USB drive. To solve that issue, I created a webpage called "viewer.html" which takes as parameter "movie" making it easy to reuse for each movie. No PHP is needed since all is done in javascript.

    So basically, you run the script "updateFolder.sh" in the folder containing the movies (mp4/m4v). This will create a file "index.html". You have also to copy the "viewer.html" at the same location (Yes, I know, it could have been created automatically...).

    In Apache2, make sure that the symlink is pointing to your movie folder. So the URL http://192.168.1.6/movies will end up loading the index.html file.

    I used Apache2, but any webserver should work. Actually, it would even work in Windows with IIS but you would have to convert the script file to VBS or CMD file (Not just renaming it...)

    Then, with your Safari on the iPad, you load that webpage, and you will have a list of all your movies. Click on one of them, and the viewer.html will be loaded with the title you selected. Click "Play" and watch your movie on your iPad, or redirect using AirPlay.

    See attachements for the scripts and html files...
    Attached Files
    iPhone 4S 16Gigs 5.01
    iPad 1 16 Gigs Wifi 5.01
    Canada / Rogers

  4. #3
    iPad Addict
    Member #
    39793
    Liked
    7 times
    Join Date
    Mar 2011
    Location
    Oxford, MS
    Posts
    1,044
    Noob ? What's ubuntu?
    [COLOR="] If you don't know me by now, I will never ever ever leave Apple. [/COLOR]

  5. #4
    iPad Junkie
    Member #
    29813
    Liked
    20 times
    Join Date
    Jan 2011
    Location
    Quebec
    Posts
    642
    Quote Originally Posted by HKWrite12
    Noob ? What's ubuntu?
    Linux, a distribution of it. Like red hat or Debian...

    VicoPad addict!
    iPhone 4S 16Gigs 5.01
    iPad 1 16 Gigs Wifi 5.01
    Canada / Rogers


Home | Forum | Active Topics | What's New

Advertisements

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Similar Threads

  1. Using ubuntu, how to enjoy the ipad...
    By DrHouse in forum iPad FAQ
    Replies: 11
    Last Post: 09-24-2012, 08:50 PM
  2. Replies: 9
    Last Post: 01-02-2011, 10:51 AM
  3. Ubuntu on iPad
    By ProjectiSlate in forum iPad Hacking
    Replies: 10
    Last Post: 05-27-2010, 10:16 AM

Search tags for this page

airplay from ubuntu to apple tv
,

apple tv ubuntu

,
linux steam airplay to appletv
,

linux stream to apple tv

,
mirror ubuntu to apple tv
,
stream from ubuntu to apple tv
,
stream video to apple tv linux
,
ubuntu airplay
,

ubuntu apple tv

,

ubuntu appletv

,
ubuntu stream to apple tv
,
using apple tv with ubuntu
Click on a term to search for related topics.

Tags for this Thread