Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm looking for a replacement for mplayer. mplayer is a audio player for the console. It works just fine when I use it like so:

 mplayer /path/to/audio.mp3

But when I start it in the background I get this error message:

 :~$ mplayer /home/.alarm-sounds/alien1.wav &
 [3] 15451
 :~$ MPlayer svn r34540 (Ubuntu), built with gcc-4.7 (C) 2000-2012 MPlayer Team
 mplayer: could not connect to socket
 mplayer: No such file or directory
 Failed to open LIRC support. You will not be able to use your remote control.

I'm trying to write a little alarm script because I want to practice some modified version of pomodoro.

share|improve this question

4 Answers 4

up vote 7 down vote accepted

From the manual:

Q: How can I run MPlayer in the background?
A: Use: mplayer options filename < /dev/null &

The redirect (note it's an input from /dev/null) is critical. mplayer is expecting input.

So in my case, the following works:

mplayer -nolirc ~/Music/Aqua/Aquarium/Aqua\ -\ 03\ -\ Barbie\ Girl.mp3 < /dev/null &

This is a shorter variation:

cat 0 | mplayer ~/Music/Aqua/Aquarium/Aqua\ -\ 03\ -\ Barbie\ Girl.mp3 &
share|improve this answer
    
That doesn't work either. I've tried it. Same LIRC error. –  Seth Sep 4 '13 at 14:40
    
@Seth The LIRC notice is not a terminal error and passing in -nolirc will stop it from showing. –  Oli Sep 4 '13 at 14:56
    
works just fine. –  schlingel Sep 4 '13 at 15:32
    
@Oli That's odd because it DID NOT work for me... –  Seth Sep 4 '13 at 18:43

If you're just dealing with wavs, you can use paplay.

For mpeg playback you'll need something else. You could mess around manually decoding it and piping that back around into paplay but one alternative to mplayer is mpeg321:

mpg321 ~/Music/Aqua/Aquarium/Aqua\ -\ 03\ -\ Barbie\ Girl.mp3 &

And now that's playing. Great. I need to pick a better example when I do this stuff.

share|improve this answer

You can use cvlc, the commandline version of vlc.

cvlc ~/Music/pathToSomeAlbum/someSong.mp3 &

If you want to hide all of the output as well as run it in the background use this neat trick:

cvlc ~/Music/pathToSomeAlbum/someSong.mp3 2>&1 > /dev/null &

That will route all the output into /dev/null.

share|improve this answer

The lirc message can be avoided completely by adding the following to $HOME/.mplayer/config:

lirc=no

Unless of course you actually use a remote control...

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.