1

I use omxplayer to stream a internet radio, but omxplayer is printing a whole lot of stats on the terminal, i want it fully in background.
i tried redirecting the stdout and stderr with &> /dev/null &
but no luck.
here is the bash commands i run:

wget -O tmp.fifo http://url/stream.mp3 &> /dev/null &
omxplayer -o local tmp.fifo &> /dev/null &  
8
  • You should clarify the context here. Presumably you aren't using a GUI desktop, because you could simply minimize the terminal window and use another one.
    – goldilocks
    Dec 23, 2017 at 16:37
  • i actually do use a GUI desktop, but i wont in my final result, i want to keep one terminal open at all time. There is no way of completely hiding all those stats ?
    – Wadaane
    Dec 23, 2017 at 16:43
  • Try omxplayer whatevercommandgoeshere > /dev/null. This works for me.
    – user72982
    Dec 23, 2017 at 16:51
  • tried it, ddnt work, i think the issue is with the wget, i edited the question.
    – Wadaane
    Dec 23, 2017 at 17:04
  • 1
    Did you try wget -b Dec 23, 2017 at 17:26

2 Answers 2

1

The modified script below works for me ...

-g create as log file omxplayer.log ... watch that it's size increases overtime that's why /tmp /is used to remove it on each reboot

#!/bin/bash
# https://www1.wdr.de/unternehmen/der-wdr/empfang-technik/webradio-100.html
cd /tmp
url=https://wdr-wdr2-rheinland.icecastssl.wdr.de/wdr/wdr2/rheinland/mp3/128/stream.mp3
pgrep omxplayer
if [ $? -eq 0 ]
then
  echo "killing running omxplayer ..."
  pkill -9 omxplayer
fi
nohup omxplayer -g -o local $url &
0

Solved the issue by adding -b after the wget, but now a log file is added every time i run the script. So that's a new issue to solve.

[Update]: Solved the log file issue by adding -q to the wget. Also running the script with &> /dev/null &

here is the complete script:

#!/bin/bash
killall omxplayer.bin
wget -b -q -O radio.fifo http://url/stream.mp3 &> /dev/null & 
omxplayer -o local radio.fifo

And run it like this: sh script.sh &> /dev/null &, and all is good now.

1
  • Does not work properly. Music repeats and then stops Apr 18, 2020 at 10:11

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.