This is specially helpful if you are using your Apple TV wireless adapter instead of plugging it directly to the network with an Ethernet cable.

This small tweak assumes that you already have sshd access to your Apple TV, if not please check out AwkwardTV on how to do that.

I had some problems watching HD DivX files in my AppleTV, they were skipping frames and freezing in the most awkward moments, I have all of my files in a mac mini and shared on the network using AFP. The files are mounted in the Apple TV using the ATVFiles plugin and the aTV-ShareMounter plugin.

What needs to be added to give the network buffer enough buffer space on the network is tweak the kernel options at startup, that can be done as in Mac OS X editing the file /etc/sysctl.conf which in the Apple TV version of Mac OS X does not exist by default, you’ll have to create it, don’t worry I’ll put here two quick ways to do it.

How to edit /etc/sysctl.conf (if it does not exist)

First Option – The fast kamikaze strategy (will work for everybody, but be really careful!).

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

Second Option – The slow wise monk strategy (this will work in all cases)

Edit a sysctl.conf in your computer (just be sure that if you’re in a Posix system you’re not editing your local /etc/sysctl.conf).

Add these values to the file

kern.ipc.somaxconn=512
net.inet.tcp.mssdflt=1460
net.inet.tcp.sendspace=98304
net.inet.tcp.recvspace=98304
kern.ipc.maxsockbuf=1048576
net.inet.udp.maxdgram=57344
net.inet.udp.recvspace=42080
net.local.stream.sendspace=98304
net.local.stream.recvspace=98304
net.inet.tcp.delayed_ack=0
net.inet.tcp.rfc1323=1
net.inet.tcp.rfc1644=1
net.inet.tcp.newreno=1

Copy it to your Apple TV through scp and make sure it ends up in its correct position at /etc/sysctl.conf on your Apple TV

The changes you do will be available on the next reboot, I find it better to do it this way so you’re 100% sure that all the changes are loaded at the same time.

I hope this solves Leo Laporte streaming problems to his Apple TV ;)