Difference between revisions of "Step by Step Guide to Playing DivX Files from a NAS"
m (Layout Changes)
m (Play dvix files on nas step by step moved to Step by Step Guide to Playing DivX Files from a NAS)
Revision as of 06:37, 8 October 2007
I wrote this around first week of October 2007 and used latest downloads of all the programs listed below this same week.
-This guide will show step by step you how to configure your AppleTV to watch dvix/xvid/quicktime files stored on a share drive on a NAS (using either NFS or SMB) without breaking iTunes funtionality. This is not original information, but a compilation of several pages to save you research and time. Everything here came from AwkwardTV pages, but there were no instructions that laid it all out step by step.
-Uses Patchstick for enabling SSH
-Uses Perian for the codecs
-Uses NitoTV for watching and browsing and deleting files from the NAS
-Uses Sharity Light for making the mount
-Uses AutoMounter for automounting at startup
-Uses vim to edit a file on the AppleTV so automounter will work
After you get everything working, use this link to find the various ways to use your remote to manipulate playback of files and delete them from the AppleTV. http://wiki.awkwardtv.org/wiki/NitoTV#Keymaps
Things you need
-You need to get a patchstick from somebody or make one yourself if you have an Intel Mac. The patchstick I borrowed installed Perian and AwkwardTV. This is the one part that this guide can't help you much with. http://wiki.awkwardtv.org/wiki/Patchstick
-You need a ssh client (PuTTY) and a secure copy client (PSCP). For windows, both are free at: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
-You need the smbfs mounter program called Sharity Light (shlight). Download at: http://atv.mylittleproject.co.uk/shlight.zip
-You need the automounter program to mount at startup: http://croozmissile.org/Automounter.tar.bz2 Discussion at: http://forum.awkwardtv.org/viewtopic.php?f=18&t=318
-You need vim (text editor) so you can view/edit files on AppleTV. Need to get it from an Intel Mac.
-Optionally, you can push the su command to AppleTV for scripting. Thought I was going to need it, but didn't. Could be useful for more advanced scripting. Need to get it from an Intel Mac.
Oct 2007. Currently 1.1 firmware is out. New ones are still likely to be 1.0 out of the box.
I started hacking my AppleTV after it was upgraded to firmware 1.1 through the normal routine. So this guide will work for 1.1 and probably 1.0. If you are still on 1.0, I suggest blocking the firmware upgrade process by pointing the AppleTV to a bogus ip address for mesu.apple.com URL as described below. Then do the hacks and then do a manual upgrade to 1.1 as described in the NitoTV help file to get youtube functionality. If you don't block the upgrade, it will upgrade by itself without your permission. And if you have had already done the below hack and it upgrades itself, you'll have to redo the patchstick again. This is confirmed, not speculation.
-Stick the patchstick in the AppleTV. Hold the "menu" key and "-" key for 6 seconds. AppleTV will reboot.
-AppleTV will launch from the patchstick and run through a script. It will be fast around 15 seconds and then output:
rebooting in 30 seconds
rebooting in 20 seconds
rebooting in 10 seconds
After the ATV starts to recycle (but not before it reboots itself!!) pull out the USB stick. AppleTV will reboot several times, ask you to select language, reboot a couple more times.
-Go into Awkward tv and enable SSH. It will hang, that's ok. Wait.
-Reboot with menu and - key. It will again ask for English.
-Go into Awkward tv and go to "download plugins" and download NitoTV. Ignore all other plugins.
-SSH2 into the ip address from your machine with putty. (Check settings and "about" for ip address). Use "frontrow" for both username and password. You get a bash prompt that looks like:
-Give yourself god rights.
line changes to
-Mount the boot volume read/write (resets at reboot). See following link if you want to make it permanent. Don't forget to do this after reboots. http://wiki.awkwardtv.org/wiki/Mount_ReadWrite
bash-2.05#mount -uw /
-Prevent AppleTV from upgrading on its own and add host entry for NAS. My NAS answers to the name "mynas" on my network. For example, I can ping mynas and get a reply. Test with pinging by name on your AppleTV after doing below. ping mesu.apple.com and confirm it uses the bogus address. Control Z will kill the ping. Somebody said sharity doesn't work with ip addresses (I think it does but didn't test it). If this is true, need to do this step for your NAS. I did this anyway.
bash-2.05#echo -e "127.0.0.1 mesu.apple.com" >> /etc/hosts
bash-2.05#echo -e "192.168.0.6 mynas" >> /etc/hosts
-Fix Nito Helper permissions. I don't know why, but got it from here. Probably not important, I did it anyway. http://wiki.awkwardtv.org/wiki/NitoTV#Fixing_Helper_Permissions
-Download Sharity and put the shlight file in c:\windows\ and use PSCP to transfer to AppleTV. Also, copy over vim, and su if you want to use su from scripts.
At a windows dos prompt, first copy from windows to the root of appletv:
c:\pscp -1 -r c:\windows\shlight email@example.com:~/
c:\pscp -1 -r c:\windows\vim firstname.lastname@example.org:~/
c:\pscp -1 -r c:\windows\su email@example.com:~/
Then move to proper bin directories. Note, shlight "belongs" in the /usr/sbin/ folder (because that is what the author recommends), but it also has to be in /sbin/ to work with Automounter...so I put it both places:
cp is copy, mv is move, rm is remove
bash-2.05#cp shlight /sbin
bash-2.05#mv shlight /usr/sbin
bash-2.05#mv vim /usr/bin
bash-2.05#mv su /usr/bin
Next fix ownership:
bash-2.05#chmod +x /sbin/shlight
bash-2.05#chmod +x /usr/sbin/shlight
bash-2.05#chmod +x /usr/bin/vim
bash-2.05#chmod +x /usr/bin/su
-You should be ready to start testing mounting of your NAS. First test a manual mount as follows. Once you get it working and can see your files from AppleTV, this is a good benchmark of success so far. When you reboot your AppleTV, it'll lose the mount and you'll need to SSH in again and do the mount command to see files. Or do the the automounter step.
bash-2.05#/usr/sbin/shlight //mynas/Media /Users/frontrow/Movies
A couple things about the above command. The first part invokes the shlight file, the second part is the name or ip of your server and share inside it, and the third part is the mount point on your AppleTV. There is already a mount point called "Movies" on your AppleTV so use it and it'll work without any additional setup in NitoTV. The only thing you should be changing from the above command is "mynas" to your server name or ip. And "Media" to what your share name is. See this URL for more details, like if you have a password on the share. If it asks you for a password and yours is blank, just hit enter. Also, take note of the output after you hit enter. It'll show connection type (SMB or NFS). This is good to know what protocol AppleTV uses to communicate with your NAS. I was expecting SMB but it used NFS. Look for what yours does. http://wiki.awkwardtv.org/wiki/Mount_a_Remote_Drive_via_SMBFS#Sharity_Light
-Type "mount" to see if it mounted. This command is useful when testing if auto mount is working after reboot. Saves from having to go to your AppleTV.
-Put a media file in root of your NAS share for testing. Go to your AppleTV and start NitoTV. Go to Files, and you should see the file. Play. Celebrate.
-If you can see and play a file, then you're ready to use automounter. The tricky thing about this is you need to use a text editor on the AppleTV to edit a file. This is what vim is for. Download the automounter.tar.bz2 file and unzip on your PC. http://forum.awkwardtv.org/viewtopic.php?f=18&t=318 I needed to download this file to unzip it on my PC. http://www.bzip.org/downloads.html
Then you are left with automounter.tar on your PC. Send it to your AppleTV:
c:\pscp -1 -r c:\windows\automounter.tar firstname.lastname@example.org:~/
Now you need to untar it:
bash-2.05b#tar xvf automounter.tar
Do an "ls" to see it left an "automounter" in your root directory.
And delete the original tar:
And install the program. Need to type the whole path to the program:
Here's the output you should get
/Users/frontrow/Automounter: Making root directory writable...
/Users/frontrow/Automounter: Copying Automounter binary to '/bin'...
/Users/frontrow/Automounter: Creating startup entries for Automounter...
/Users/frontrow/Automounter: Creating blank mounts XML at '/Users/frontrow/Mounts.xml'...
/Users/frontrow/Automounter: Creating example mounts XML at '/Users/frontrow/Mounts.xml-example'...
I wouldn't delete automounter at this point. May need to run it again someday.
-Now, do an "ls" to see it left two files that we're going to look at now.
Mounts.xml is where the real one where program engages. The example file is just that. I removed the Mounts.xml file and copied the example one to its place. Then edited the new real one.
bash-2.05b#cp Mounts.xml-example Mounts.xml
Here are the 3 or 4 lines you need to pay attention to in your Mounts.xml file. Vim is a complicated text editor. Use these few commands to get you started. It's all you need, but don't make any mistakes. If you do, just quit without saving and start over. I had to several times till I got it right.
To open the file:
This puts you in command mode. Cursor keys will work. "x" will delete a character, but then you are in edit mode and cursor keys won't work. Hit escape key again and you are back to command mode and cursor keys work again. "x" will delete characters. "i" will put you in insert mode and any characters you type will enter normal. Hit escape again to be able to use cursors. I had to quit without save several times to get it right without mistakes.
Use these to quit. Always hit escape before attempting these.
":q!" quit without save
Here are the four lines you need to be concerned with if you don't have a username/password on your NAS. I'm showing below the only lines in the file that I changed.
My server is "mynas" and my share name is "Media". Mine connects with nfs through sharity, but we specify "smb-sharity" in the file. Don't let that confuse you.
Extras and Notes
-Change the username and password
-You can reboot with "reboot" or force an immediate reboot
bash-2.05#shutdown -r now
-If using your AppleTV in wireless mode, then these network tweaks will help a lot. http://devroot.org/2007/05/01/optimize-network-throughput-on-your-appletv/
echo “kern.ipc.somaxconn=512? > /etc/sysctl.conf
echo “net.inet.tcp.mssdflt=1460? >> /etc/sysctl.conf
echo “net.inet.tcp.sendspace=98304? >> /etc/sysctl.conf
echo “net.inet.tcp.recvspace=98304? >> /etc/sysctl.conf
echo “kern.ipc.maxsockbuf=1048576? >> /etc/sysctl.conf
echo “net.inet.udp.maxdgram=57344? >> /etc/sysctl.conf
echo “net.inet.udp.recvspace=42080? >> /etc/sysctl.conf
echo “net.local.stream.sendspace=98304? >> /etc/sysctl.conf
echo “net.local.stream.recvspace=98304? >> /etc/sysctl.conf
echo “net.inet.tcp.delayed_ack=0? >> /etc/sysctl.conf
echo “net.inet.tcp.rfc1323=1? >> /etc/sysctl.conf
echo “net.inet.tcp.rfc1644=1? >> /etc/sysctl.conf
echo “net.inet.tcp.newreno=1? >> /etc/sysctl.conf
-Home directory when you log in is: