Wednesday, 20 February 2013

run mplayer in background from command line

Tested and proven way to make mplayer work in background when invoked from command line in Linux.

mplayer filename.ogg < /dev/null > /dev/null 2>&1 &;

When i searched on internet . I saw the following two options.

  1. mplayer file.ogg < /dev/null &;
  2. mplayer -noconsolecontrols file.ogg &;
Both of them fails for me. To my surprise first method is from mplayer official website faq.
The second method is from stackexchange. Though it doesnt work for me, it has comments on the site saying it work for him.

Finally got the above  comment to make it work from As stated in the post. mplayer reads from stdin and writes to stdout and stderr.