The command:

omxplayer -o local sample.mp3

works fine - sound is good - but I have to wait for return until the music stops.

I want to put this in a backround. I run:

omxplayer -o local sample.mp3 &

It creates the new process in a background as it should but there is no sound. when I list jobs I can see:

[1]+  Stopped                 omxplayer -o local sample.mp3

There is a stopped job. When I start it by running fg music plays but not in a background. When I start the job by running bg it goes back to stopped jobs.

Any ideas?

  • Just to be that lazy guy who doesn't post a real answer: have you taken a look at mpd yet? I believe headless background music playing is what it was designed for. Jun 17, 2016 at 12:25
  • None of the offered solutions work on bluetooth devices. Any suggestions?
    – MikeB
    Oct 22, 2020 at 0:36

5 Answers 5


There should be a man page (man omxplayer); the options are also explained here. I do not see a "background" or "damonize" (similar concept) option there.

This is probably because omxplayer was written specifically for the pi to exploit hardware acceleration for video playback (it may be less unique now in this sense than it once was); it will play audio mp3's simply because (educated guess) it needs to include that decoding/playback code anyway.

However, using the audio system on the pi does not require any special software written for it, so if all you want to do is listen to mp3's you can use anything that runs on linux. For a command-line interface that I think will background, try mpg123 (apt install mpg123); I believe this should be set up to use ALSA as the soundsystem so if you are using pulseaudio and don't hear anything, that's why (it could also be vice versa). Checking here (man mpg123), you can list the possibilities with:

mpg123 --list-modules

And use one, e.g.:

mpg123 -o alsa

It does mention being able to use a "comma separated list" there too (which probably means commas with no spaces).

Finally, if this is a big issue for you with omxplayer and you are using a GUI, it is obviously no big deal to open another terminal or an extra tab in the current one and just let it run there. They cost very little in memory as most of it is shared. The same logic applies if you aren't using a GUI; on the real console (i.e., screen and keyboard), try cycling through ctrl-alt + F1-F6. If you are using ssh or something, multiple connections are also cheap (and there is the screen option mentioned by PandaLion; see also tmux).

  • 1
    It does not have to be omxplayer and I don't want to use GUI in any way. Using mpg123 solved my problem. I used this command to run the process in background: mpg321 sample.mp3 >/dev/null 2>&1 & simple mpg321 sample.mp3 & sitll requiered from me to press enter. Jun 11, 2016 at 12:47
  • mpg seems a bit limited. As another alternative I can recommend mpc, which is a CLI client for mpd.
    – Blake
    Jul 28, 2018 at 12:34

Here's an alternative

  1. Open up a screen session using the command screen. Install it if you have to.
  2. Run omxplayer -o local sample.mp3 from there.
  3. Press Ctrl+A then press D to send the screen to the background (i.e. Disconnect from the session). To connect, run screen -X.

It should continue playing in the background.

One caveat of this is that I'm not sure how to integrate this into a script (haven't done any research at the moment). I'm guessing it's possible. EDIT: Check Patrick Cook's comment.

  • 1
    If you want the screen to start in the background you can pass the -d -m arguments. Ex: screen -d -m one player -o local sample.mp3. To reattach the screen, you can use screen -r as well. Jun 11, 2016 at 15:19

You can do exactly what you described by:

omxplayer --no-keys -o local sample.mp3 &


This worked very well for me. All you have to do is change C:\Windows\Media\Windows Critical Stop.wav to whatever your file name is.

@echo off

title ERROR

::"setting up" error sound - creating vbs file to make sound
set "file=C:\Windows\Media\Windows Critical Stop.wav"
( echo Set Sound = CreateObject("WMPlayer.OCX.7"^)
  echo Sound.URL = "%file%"
  echo Sound.Controls.play
  echo do while Sound.currentmedia.duration = 0
  echo wscript.sleep 100
  echo loop
  echo wscript.sleep (int(Sound.currentmedia.duration^)+1^)*1000) >sound.vbs
  ::playing sound
start /min sound.vbs

::wait 1 second for vbs to let go of file
ping n- 1>nul

::delete vbs file
del sound.vbs

You should lead with the nohup command:

nohup omxplayer -o local sample.mp3 &

omxplayer (like many other commands) wants to write its "standard output" (stdout) to the terminal. When put in the background, it can't do that, so it winds up just waiting - not playing music. You need to give omxplayer an outlet to use! That's what nohup does.

When using nohup, anything going to stdout from omxplayer will go to the file /home/yours/nohup.out. If you don't want/need that output, you can redirect it (and stderr if you like) as follows:

nohup omxplayer -o local sample.mp3 >/dev/null 2>&1 & 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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