Mplayer output to the TV

Alright, you have a Linux server connected to your television. You don’t want to have to plug a keyboard into it to play movies, right? You most likely have some other computer on the network you would like to launch mplayer from and then have the output to the television. Well thanks to xservers we can take care of this. 🙂

Log into your server and create a /usr/local/bin/mplaytv script like this:


#!/bin/bash
DISPLAY=:0.0 mplayer -fs -zoom "$1"

Make sure you make it executable.

chmod 755 /usr/local/bin/mplaytv

Now you can play something with the new script and the output will go to the xserver attached to the TV.
Make sure you run the mplaytv script as the user logged into the xsession on the server, or you will get xsession errors.

mplaytv Some_Video.avi

You should see some activity in your shell and mplayer controls are attached to that shell, So keyboard shortcuts also work remotely. 🙂

Linux Media, Done.
Simple ain’t it?

Leave a Reply

Your email address will not be published. Required fields are marked *