For those of you who don’t know what Airvideo is, it’s a little piece of software which runs on a server in your home and allows you to watch videos on your iPod Touch, iPhone or iPad both in your home via WiFi and when you’re out and about on a 3G network. It transcodes video (including MKV) into something your iDevice can play, then streams it out at the ideal bit rate for the available bandwidth. The server software is free, and the client software is available on the App store for around $2, which is a phenomenal bargain considering what it does.
A while ago I wrote a howto on installing the Windows version of the Airvideo server on Ubuntu using the Wine environment, because the Linux version of the Airvideo server was a little… well, confusing.
Since then, I was contacted by RubioJr (Gracias, Rubio!), who has put together a PPA (a list of packages) to allow Ubuntu and Debian users to enjoy a super simple installation method of Airvideo, without the need to install Wine.
Same as last time, I’ll be doing all my work with Gnome, so if you’re afraid of heavy terminal work, there’s no need to run for the hills.
Easy mode: Install Airvideo Server with (almost) no command line work.
Before we go to far, we’ll have to add RubioJr’s PPA. Basically, your software packages are all part of a big list of apps out on the net. Whenever you want to install a new app, or when the software update tool checks for updates, you’re looking at the remote version of this list and comparing it with yours. We need to add this special list to the main one so that we can install stuff from it.
Go to Applications > Ubuntu Software Center. Once launched, click Edit and select Software Sources.
Make a note of your system version in the first window of the sources screen. For example, mine is Lucid as I’m using Ubuntu 10.04.
Go to the Other Software tab and click Add Source. In the APT line field which appears, enter :
deb http://ppa.launchpad.net/rubiojr/airvideo/ubuntu [yourdist] main
Then press Add to apply your changes. This means that when your software update checks for new versions of the programs you have installed, it’ll also check RubioJr’s list of apps. It also means you can install things from that list, which we’ll do now.
When you search in Software Center for Airvideo, you should now see the following entry:
Mine says that it’s already installed, because I’ve already installed it (obviously), but yours should have an install button. Click it, and all the required stuff to run Airvideo will download from the net and be installed on your machine.
Before we start Airvideo, we need to tell it which folders we want it to serve out to us. Click the Applications button, go to the Accessories menu and open terminal.
I know I promised as little terminal work as possible, and I’m hoping this isn’t too complex. In the terminal which appears, type sudo gedit and press enter.
You’ll be prompted for your password, and a big boy version of the Gedit text editor will start.
Press the Open button, and browse File System (in the left hand bar), opt, airvideo server. In this folder, you’ll find a file called AirVideoServerLinux.properties:
Open the file and it should look something like this:
In the folders section, we need to add some entries for the folders we want to serve. You’ll need to add them so it’s FOLDERNAME:/PATH/TO/FOLDER and each entry should be separated by a comma – like this:
Press Save to commit your changes and you’ll be ready to fire up Airvideo. In the Applications menu, under Sound and Video, you’ll see a new program called AirVideo Server. Click it to start AirVideo.
Once started, you’ll see the Airvideo logo in the notification area on the top right of your screen. Right click and select Start Server.
The icon changes to blue to let you know that your server is running.
You’re done! Fire up Airvideo on your iDevice and browse to your server for some awesome streaming streamyness!
Hard Mode: Install AirVideo Server from command line.
Actually, this is probably simpler than the point-and-click variant, but I understand that the terminal seems a little daunting to some users. For those who are OK with it, do the following steps:
Fire up a terminal and enter:
sudo add-apt-repository ppa:rubiojr/airvideo
This adds RubioJr’s repository, allowing his package list to be installed/updated.
Refresh your apt repositories:
sudo apt-get update
Install AirVideo Server:
sudo apt-get install airvideo-server
Edit the config file:
sudo [nano|vi|emacs|your_text_editor_of_choice] /opt/airvideo-server/AirVideoServerLinux.properties
After folders, enter [Name you want the folder to be called]:/path/to/folder,[folder2]:/path/to/folder2
Save the file.
Launch the server:
airvideo-server
or launch in the background
nohup /usr/bin/airvideo-server
God Mode: Create an autostart script so AirVideo launches when your computer does.
This one’s best used if you have a Linux server humming away in the corner of your office, and it’s BIOS is set so it’ll resume after a power outage, so that no matter what, your AirVideo is going to be running.
Fire up a terminal and enter
sudo [text editor of choice] /etc/init.d/airvideo-server
In the file (which should be blank), paste the following:
#!/bin/bash case "$1" in start) echo "Starting AirVideo" start-stop-daemon --start --quiet -b -m -p /var/run/airvideo-server.pid --chuid airvideo --exec /usr/bin/java -- -jar /opt/airvideo-server/AirVideoServerLinux.jar /opt/airvideo-server/AirVideoServerLinux.properties ;; stop) echo "Stopping AirVideo" start-stop-daemon --stop --quiet --pidfile /var/run/airvideo-server.pid rm -f /var/run/airvideo-server ;; *) echo "Usage: /etc/init.d/airvideo-server {start|stop}" exit 1 ;; esac exit 0
Save the file out, then create the user which is going to be used to run the file. You should also double check to make sure that /opt/airvideo is readable by this account.
Make the file executable, then add it to the startup defaults.
When you next reboot your system, airvideo should start automatically.
Enjoy!
More info:
http://blog.frameos.org/2011/02/08/installing-airvideo-linux-server-in-ubuntu/
http://inmethod.com/air-video/index.html
http://wiki.birth-online.de/know-how/hardware/apple-iphone/airvideo-server-linux
http://www.inmethod.com/forum/posts/list/1856.page
https://launchpad.net/~rubiojr/+archive/airvideo
https://gist.github.com/905291 – Init script update – thanks aq1018!
Thank you – great guide and it works a treat
Nice one!
Your init-script didn’t work for me. The killall command won’t kill the process. I ended up wrote one with start-stop-daemon:
#!/bin/bash
touch /var/lock/airvideo-server
case “$1” in
start)
echo “Starting AirVideo”
start-stop-daemon –start –quiet -b -m -p /var/run/airvideo-server.pid –chuid shared –exec /usr/bin/java — -jar /opt/airvideo-server/AirVideoServerLinux.jar /opt/airvideo-server/AirVideoServerLi$
;;
stop)
echo “Stopping AirVideo”
start-stop-daemon –stop –quiet –pidfile /var/run/airvideo-server.pid
rm -f /var/run/airvideo-server
;;
*)
echo “Usage: /etc/init.d/airvideo-server {start|stop}”
exit 1
;;
esac
exit 0
I didn’t copy correctly, here is the correct init-script that I use:
#!/bin/bash
case “$1” in
start)
echo “Starting AirVideo”
start-stop-daemon –start –quiet -b -m -p /var/run/airvideo-server.pid –chuid shared –exec /usr/bin/java — -jar /opt/airvideo-server/AirVideoServerLinux.jar /opt/airvideo-server/AirVideoServerLinux.properties
;;
stop)
echo “Stopping AirVideo”
start-stop-daemon –stop –quiet –pidfile /var/run/airvideo-server.pid
rm -f /var/run/airvideo-server
;;
*)
echo “Usage: /etc/init.d/airvideo-server {start|stop}”
exit 1
;;
esac
exit 0
Here is a link to my init-script formatted, commented, and syntax highlighted:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
airvideo-server
hosted with ❤ by GitHub
Hi aq1018,
Yeah, my init script was a bit broken. Thanks for the tip about using start-stop-daemon. I’ll add it in to the main article 🙂
Brilliant. Worked without any issues. After getting Air Video to work (thanks for your instructions) I’m loving Ubuntu even more.
Thanks so much. This worked PERFECTLY. Very well-written and straightforward. Much appreciated.
Thanks a lot … airvideo is working when manually launched but unable to make it autostarted … i spent 3h and no success
ubuntu 11.04 x64
i have given +777 for /opt/airvideo-server
note the warning above
update-rc.d: warning: /etc/init.d/airvideo-server missing LSB information
update-rc.d: see
Adding system startup for /etc/init.d/airvideo-server …
/etc/rc0.d/K20airvideo-server -> ../init.d/airvideo-server
/etc/rc1.d/K20airvideo-server -> ../init.d/airvideo-server
/etc/rc6.d/K20airvideo-server -> ../init.d/airvideo-server
/etc/rc2.d/S20airvideo-server -> ../init.d/airvideo-server
/etc/rc3.d/S20airvideo-server -> ../init.d/airvideo-server
/etc/rc4.d/S20airvideo-server -> ../init.d/airvideo-server
/etc/rc5.d/S20airvideo-server -> ../init.d/airvideo-server
when i try to start with webmin , i have access denied
when i am in /etc/init.d , i can run airvideo-server:
root@ks2851:/etc/init.d# airvideo-server
DEBUG: SnapshotCache: Initializing Thumbnail Cache; Java Version: 1.6.0_22
DEBUG: SnapshotCache: Loaded existing Snapshot Index BTree with with 1 items.2011-07-23 19:39:38.524::INFO: Logging to STDERR via org.mortbay.log.StdErrLog
2011-07-23 19:39:38.549::INFO: jetty-6.1.x
2011-07-23 19:39:38.596::INFO: Started SocketConnector@0.0.0.0:45631
DEBUG: PortMapperAction: Scheduling task PortMapperAction$2 (2117846131)
however, when i am in another place , i have access denied for /etc/init.d/airvideoserver which don’t make sense for me:
root@ks2851:/# /etc/init.d/airvideo-server
-bash: /etc/init.d/airvideo-server: Permission denied
root@ks2851:/#
why i cannot run airvideo-server with full path ? i think my issue is linked to that
can you help a newbie please …
Thanks by advance
fixed … i did a sudo chmod 777 /etc/init.d/airvideo-server
it’s probably “too high” ? is anyone can see what was exactly my problem here ? even if i recognize it has nothing to with the topic …. but why the command here did not work for me ?
Thanks 😉
Hi extenue – Looks like there was a typo in my original code. I said that after creating the init.d script, you should chmod +w, but that’ll just make it writable. It should have been chmod +x to make it executable. Whoops!
anyone have any problems live converting 3gp video files? I have a fresh install on ubuntu 10.10 (installed it yesterday) and followed the above directions. Everything works except for the playback of 3gp videos.
im adding the apt but airvideo wont show up in the software center
disregard that last comment, i got it working..
but now a different problem occured, i see no files in the folders on airvideo on iphone
i see the folders i shared but thoose are empty.
(but when using it from my windows-server i can see files and watch em, so im pretty sure it isnt with my iphone application)
Did you make sure to change the permissions on tsmuxer?
What about the PIN function under Linux? Is it possible to get an connection via internet, also not just in my own network at home? thx
New guy here.
Love the tutorial,
Just one problem, how do I get. A PIN number?
I can only access my AriVideo server on my local networke. When I leave home I need a pin.
You seemed to be able to do it in the tutorial for 10.10.
How do you make it work in 11.04?
Kai
Hi Fuchs and Kaizoku, and thanks for commenting.
PIN support hasn’t been written in to Airvideo for Linux just yet, so if you want to access your videos while you’re on the road, you really only have the option of manually adding your server to Airvideo on your iPhone/iPad.
You’ll either need to have a static IP address on your home connection, or use a service like dyndns.org, combined with opening port 45631 on your router and pointing it at your Linux server. I’d also suggest declaring a password in /opt/airvideo-server/AirVideoServerLinux.properties to ensure anyone who’s portscanning your home connection can’t get in to your movies collection!
The reason why my old (10.10) howto allowed it, Kaizoku, is because that was using the Windows application within a Wine wrapper, allowing all of the features of the windows version to be used. You can still use that method if a server PIN is something you really need, although in my testing I found it to be a bit slower than the native Linux version.
Hope this helps!
-Leigh.
I followed these instructions and when I start the server I get the following errors and the Terminal hangs:
root@server:/opt/airvideo-server# airvideo-server
DEBUG: SnapshotCache: Initializing Thumbnail Cache; Java Version: 1.6.0_20
DEBUG: SnapshotCache: Created new Snapshot Index BTree2011-10-13 20:32:21.671::INFO: Logging to STDERR via org.mortbay.log.StdErrLog
2011-10-13 20:32:21.753::INFO: jetty-6.1.x
2011-10-13 20:32:21.860::INFO: Started SocketConnector@0.0.0.0:45631
DEBUG: PortMapperAction: Scheduling task PortMapperAction$2 (1024180126)
Any clues as to how I can fix this?
Thanks!
Dave
Hi there. Thanks for the tutorial.
Sorry for this noob question:
– What exactly do you mean by “making sure that /opt/airvideo is readable by this account.” (airvideo user ?!).
How do I check that? What if that folder is not “readable”?
I need help please.
I followed the instructions and when I run AirVideo I get a message: “I couldn’t detect any system tray on this system”
Sorry guys….I’m pretty green but very interested in learning.
Good tutorial, but you used the same graphic for the before path edit and after ’08’ show there isn’t an example showing the paths…
put correct paths in but still cant see on i phone ! ideas ??
Hi mark, when you say it doesn’t appear, do you mean that you can connect to the server (via the IP address), but you can’t see any items?
Leigh,
Thank you so much for the easy guide! Very quick and painless to setup.
However I’m wondering if you can assist me in diagnosing an issue I’m having. I’m able to connect to my server fine, and can start up a video… however it only plays fine for about 25-30 seconds before the audio quality reduces dramatically, and the video cuts out entirely.
I’ve watched my server’s system monitor during this time and the CPU jumps up close to 95% as soon as I hit the play button… stays there while streaming… and then as soon as the video cuts out (audio continues at reduced quality) I can see the CPU going down to 50-65%.
Granted, my server’s CPU is quite pathetic (last gen 3Ghz P4 w/ HT), but does it sound to you like my computer is finding it can’t handle the stream, and it’s cutting it off or something? Is there a way I can simply force it to buffer instead of cutting off the video, or maybe even reducing the quality a bit so it can stream fine?
Considering some of the other things I do on my network, it’s safe to rule out network speeds.
Anyways, thanks for any input you can give me!
Hi Chris,
No worries, thanks for the comment!
High CPU usage is fairly normal – the 2.4GHz Core2Duo in my server jumps to ~175% during transcoding, meaning that one core is pulling 100% and the other is hitting 75%.
It’d be my guess that ffmpeg (the program which AirVideo uses to do the transcoding) is struggling for CPU cycles, and can’t keep the bitrate up. The stream cache (which is 512Kb) is getting emptied before ffmpeg can fill it again, your remote airvideo client is saying “hey, this is coming down too slowly, which is probably a slow network connection. Can you drop the quality/bitrate and try again?”
Airvideo server complies, and tells ffmpeg to cycle through the settings until it gets to something it can output at a reasonable rate – probably to the lowest preset available, which is no video and 64k audio, which is about the quality of a phone call.
You can hard set the maximum conversion rate by selecting “conversion settings” when you’re looking at a video, then selecting “global conversion settings” up the top. The CPU utilization of ffmpeg on my server looked like this:
256K: ~98%
512K: ~130%
1024K: ~165%
1536K: ~175%
The last setting looked like I was hitting the limit of what my system could handle. Give it a try and you might find something which your system can handle, but your mileage may vary.
The only other thing you could do is to perform a ‘convert’ instead of ‘play with live conversion.’ This will create a new file in the same directory as the target video with an m4v extension, a format your iphone can handle natively.
Once the file is converted, it can stream without using much CPU at all. You can use this to watch stuff via local wifi, but it won’t work over 3G. If you really need 3G streaming, or don’t want to have to convert everything before watching it, I’d say it’s time for an upgrade, I’m afraid.
Cheers,
Leigh.
Hello, I was able to get the server running until I tried to add a password to the server. I put the password in the properties file and start the server but when I type it in the client it doesn’t work. Any ideas?
Hi Matt,I’d be checking to make sure the password system is working correctly by changing the password in your config file to something simple, like 1234, then restarting the server and trying again. If it works ok, then it might be a problem with a special character in your old password, or you might have simply mistyped it.If it still fails with 1234, I’m not sure what to do. Might have to go on to the airvideo forums and see if anyone there has had a similar issue.Cheers,Leigh.
I can watch the Airvideo streaming video on my ipad but still can’t get the Airvideo to start automatically after each reboot on my text-only Ubuntu Natty Narwhal. I have executed “sudo chmod 777” on both “/etc/init.d/airvideo-server” and “/opt/airvideo-server”. When I logged in using Putty (SSH) using the newly created user “airvideo”, I can see the content of /opt/airvideo-server.
Also when I executed the command “nohup /usr/bin/airvideo-server”, it will not return to the command prompt.
Hi rty, did you remember to do the update-r.d airvideo defaults part?
Yes Leigh. I did execute the “update-r.d airvideoserver defaults”. I’ll troubleshoot again later tonite. Meanwhile if you can throw me some direction or pointer, I will appreciate it very much. Thank you.
Yeah, it’s working now. I just used the built-in editor of Webmin to reload and save the /etc/init.d/airvideo-server script and then rebooted the server. So the issue was most probably related to file encoding (ANSI, utf-8?) because I created the l script with my Win 7 Notepad before copying it over to the server.
By the way, I am only using an old HP laptop with Intel(R) CPU T2400 @ 1.83GHz and Airvideo streaming works beautifully even at Live conversion bit rate of 2048 on my iPad 2. No stuttering, no frame dropping… but my Ubuntu Natty Narwhal is a text-only version. It also runs MiniDLNA, rTorrent, Samba, Apache, MySQL.
Nice work 🙂
Yeah, Windows and Linux have slightly different file encodings, so when you save a file in Windows and copy it over, the line breaks will be a little off. The way around this is to either use a Linux text editor (if vi is too scary, try nano), or an editor like Notepad++ which allows saving in unix format.
Happy viewing!
Thanks Leigh. I did use Nano to reload and save the script but apparently with my case Nano retains the original file encoding.
I have installed airvideo under Ubuntu 10.04, but i can’t seem to get air video to start on Ubuntu.
I have followed the method above and started air video from the applications list, but it won’t show the icon at the right top of the screen. What can there be wrong?
I have installed airvideo under Ubuntu 10.04, but i can’t seem to get air video to start on Ubuntu.
I have followed the method above and started air video from the applications list, but it won’t show the icon at the right top of the screen. What can there be wrong?
I have followed the tutorial above and there wher no errors. I have then tried to start the air server on Ubuntu 10.04 but the icon doesn’t show in the right corner so I cannot start air server. What can the be wrong?
I got it working for the most part, but I can’t play mp4 format via the play button. Live works though.
What is the purpose of adding a user? This was the step I didn’t perform? Would this be my issue?
work like a charm!!!! thanks for the article
Hi,
I am attempting to simply add the source at this point and it Ubuntu Software crashes when i enter the address…I am sure I am doing this correctly, if I have made a type -o- please let me know…this is what I enter:
deb http://ppa.launchpad.net/rubiojr/airvideo/ubuntu precise main
Thank you:)
Apparently there isn’t a version for Ubuntu 12.10?
My SSD failed and I had to do a clean install so noticed I can’t get the Air Video to work this easy way… Otherwise this is a great help page, installed the Air Video Server to the 12.04 with these instructions.
Brilliant! Just what I was looking for.
Unfortunately, the Software Center still cannot find Aitvideo after adding the new source, as described.
I am running on Ubuntu 12.10 (Quantal), which I see may not be supported (yet?). In my ham-fisted, newbie way, I tried setting “[yourdist]” to “precise”, but did not seem to make a difference.
Are there plans to release Airvideo for Quantal?
Wow, your airvideo install worked perfectly. I initially tried this on a Centos box, and while I got it working it took a lot of searching and head scratching. Your install was quick and easy, thank you very much
This worked perfect….until I upgraded to 12.10. now it won’t open at all.
running from the commandline, I just get
DEBUG: PortMapperAction: Scheduling task PortMapperAction$2 (8786116)
DEBUG: StatusReportAction: Scheduling task StatusReportAction$2 (4008536)
I followed the instructions above and it works great in both 10.04 & 12.04. This is FANTASTIC! Thanks you all so much!
I would like to ask if there is any way to change or specify a different port number? I ask because I run more than one of these servers and since the PINs don’t work, I need to specify a different port for the second server.
Thanks!
Awesome post! I got it installed ok but am having an odd issue. I am able to connect just fine to the server but it asks me to enter the server password. Originally I hadn’t entered one, but then went into the config file and added a password. Still doesn’t work…keeps popping up the dialog on my ipad. Any help here would be greatly appreciated!