Mplayer is a great video (and audio) player, but I don't like the crap it spits out at the terminal everytime I run it. I'm trying to watch a movie after all, if I wanted to see text fly by in my terminal, I would've abused cat to show my logfiles.

You can force mplayer to be quiet like any other program in bash, just by redirecting all its input and output to /dev/null and you can background it with an ampersand. Both things combined:

mplayer myawesomevideo.mkv </dev/null >/dev/null 2>&1 &

Of course this isn't always a good solution, as it's pretty cumbersome to type. I came up with the following little script to solve this:

The script

#!/bin/bash

MPLAYERPATH=$(whereis mplayer | cut -d' ' -f2)
$MPLAYERPATH "$(pwd)/$@" </dev/null >/dev/null 2>&1 &

It does the job. It passes all the arguments to mplayer, so you can call it just like you would mplayer. Alias or link it to some command you can remember and you should be fine.

Ps. Does mplayer have some sort of obscure switch I don't know about to send it to the background?


Comments