Monday, April 06, 2015

Playing music using omxplayer on the terminal

On my Raspberry Pi I use something called omxplayer on the command line to play MP3 & MP4 files. omxplayer by default should be installed on Raspbian. To play music using the hdmi monitor speaker issue the following command:
omxplayer -p -o hdmi my_music_track.mp3

Useful key bindings to control omxplayer while playing:
q exit omxplayer
p / space pause/resume
- decrease volume
+ / = increase volume

I use the following command in the terminal to play all my music in the directory ~/music in shuffle mode:
for f in $(ls ~/music/*.mp3 | shuf); do echo "Playing: $f";omxplayer -p --vol -1800 -o hdmi $f; done

No comments: