To play mp3 files on raspberry pi you could use the omxplayer. Install it over terminal via:

sudo apt-get install omxplayer

To play a mp3 file just use:

omxplayer -l 00:00:00 -o local /path/to/fie.mp3

The parameter -o local defines the output to be local, which means on the raspberry pi to use the 3.5mm jack. The problem with omxplayer is, it doesn’t use the current system volume you set for example by the GUI.

You could get the current system volume by:

amixer cget numid=1 | /bin/grep -E -o -e ': values=[0-9+-]+' | /bin/grep -E -o -e '[0-9-]+'

omxplayer accepts a volume parameter. So if you use this command it will start the playback with the current system volume:

omxplayer -l 00:00:00 -o local --vol $(amixer cget numid=1 | /bin/grep -E -o -e ': values=[0-9+-]+' | /bin/grep -E -o -e '[0-9-]+') /path/to/fie.mp3


Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert