BillF
Posts: 11
Joined: Sun Jan 27, 2013 1:27 pm

how do I play MP3 or MP4a Files

Mon Feb 04, 2013 7:55 am

Hi,

I am getting up the learning curve with the help of people on this forum but got stuck yesterday trying to play MP3 or MP4a Files.
I have a music collection on a network hard drive that I can navigate to but cannot find a file associated with them, so they do not play. I really want a GUI option as I am not very good with command lines, and I will play through the HDMI cable to my TV.

I read that OMX player is a good simple player with a GUI option and tried to install it. using the procedure below that I copied from a forum, it seems to install OK (as far as I can tell) but at step 13 I do not see the "Sound & Video" option in the "open with" menu - so something has gone wrong.
I keep thinking I am one small step away fro achieving this but it has beaten me for the moment.
Can anybody help?

Bill

How to get omx player working
(through Graphical User Interface):
1) Power on Raspberry Pi
2) View GUI home page
3) Open LXterminal
4) (double click the icon on desktop)
5) Type
sudo nano /usr/share/applications/omxplayer.desktop
a blank screen will open
7) Type the following in the file:

[Desktop Entry]
Type=Application
Name=omxplayer
Categories=AudioVideo;Player;
Exec=lxterminal --command "omxplayer -o hdmi %f"
Icon=emblem-video


8) Press control+x to save the file
9) Press Enter
10) Open file manager (bottom left-hand corner)
11) Go to the directory where your file is.
12) Right-click on the file and select "open with..."
13) Under "Sound & Video", choose omxplayer
14) A new terminal will open, which will open your video
15) You can now control your video with keyboard

BillF
Posts: 11
Joined: Sun Jan 27, 2013 1:27 pm

Re: ow do I play MP3 or MP4a Files

Mon Feb 04, 2013 7:57 am

oops I meant M4a (not MP4a.......)

Bill

DBryant
Posts: 281
Joined: Sat Feb 02, 2013 12:41 pm
Location: Berkshire, UK

Re: ow do I play MP3 or MP4a Files

Mon Feb 04, 2013 9:26 am

The procedure you have listed adds OMX player to the GUI but are you sure its installed on your system?

You have entered the line:
Exec=lxterminal --command "omxplayer -o hdmi %f"

which means that omxplayer should be in the PATH for your desktop environment. Open an command line tool like xterm, or whatever its called in your distro, and type

which omxplayer

If installed and in the PATH (of directories) then it should report its full path - so it might return something like /usr/bin/oxmplayer. Insert that full path into the Exec line.

If there is no return it may be installed but not in the PATH. Try:

ls -al /usr/bin/omxplayer

this assumes the binary image is called exactly omxplayer and is in /usr/bin!

Or
ls -al /usr/bin

And trawl through the output looking for omxplayer

Or

sudo find / -name omx\*

which will scan your enter root filesystem looking for it, run as root since it will have permissions to scan the whole disk. It might take several seconds (5 - 10 ) to complete but will certainly find a filename beginning omx

sudo find / -ilname omx\*

will do the same but case-insenstive, should it be installed as Omx..., OMX... or whatever.

Or scan the list of installed packages to see if its been installed:
dpkg --list

you will have to scan the list that is output manually.

The current build is at http://omxplayer.sconde.net/ where the latest .deb packages is available.
You can retrieve the deb file to your Pi system and then install it with:
dpkg -i the-omx-package.deb

obviously make a note of the name of the file you download. The process described at that URL looks a bit mandrolic i.e. you have to work at it and you may find someone has bundled a known working version into a standard Pi software repository. Don't know 'cause I don't use it, tend to use vlc if pushed which works fine. mpg123 and mpg321 are command line utilities that will play music are easy to install etc. and verify the sound system is up and running. but I guess you know that.

Hope this helps

BillF
Posts: 11
Joined: Sun Jan 27, 2013 1:27 pm

Re: How do I play MP3 or MP4a Files

Tue Feb 05, 2013 6:37 am

DBryant
Thanks for spnding the time giving me such thorough advice - it's just what I need to get up this learning curve. I'll take a look at what you suggest. But I was interested to find out a bit more about VLC and mpg123, - I read somewhere that VLC uses more resources than omxplayer, although have used VLC in a windows environment and would happily have it on my Pi if I only knew how, especially as the next stage of my education is to play movies through the Pi.

I do not know about mpg123 -I can see a lot about it if I Google it but do not see much about it in Rasberry forums - how does it compare in your view.

By the way - the distro I am using is Raspbian Debian GNU/Linux 7.0 (“wheezy”)

Regards

Bill

Cloudcentric
Posts: 982
Joined: Fri Sep 14, 2012 9:13 am

Re: ow do I play MP3 or MP4a Files

Tue Feb 05, 2013 6:41 am

The Command Line OMX Player has a GUI Front End

https://github.com/KenT2/tboplayer
I know everything about nothing"

DBryant
Posts: 281
Joined: Sat Feb 02, 2013 12:41 pm
Location: Berkshire, UK

Re: ow do I play MP3 or MP4a Files

Tue Feb 05, 2013 10:03 am

Always plenty of talk about resource usage and yes, they are limited, but it just comes down to how you wish to use them. I guess this is why some like Unix, they can slice and dice their system s to fit their own work processes, prejudices and so on.

Generally any tool using a GUI will require more resources, not least of all because they require a supporting environment from which they are invoked and subsequently execute. And those environments drag in lots of other stuff that you didn't know you needed or simply don't want. Hence the development of light weight managers that reduce their impact on the system, while still giving the user that point and click experience.

VLC does a job and perhaps is over the top in many scenarios. I was looking form the perspective of remote control and streaming stuff around the house in a 'Radio Bryant' sort of way. It does it but I don't really want to support a graphical environment in all receivers. But then I went off in a different direction and have been playing with XBMC installations for a day or week, the other end of the spectrum. These have shown me that the music can play without inter-track clicks etc. that I was hearing with a Wheeezy system.

I've digressed!

To install any software you first point of call should be the respository for the distro you've installed. Simply put you just run:
sudo apt-get install <package name>

It will go to the official site, seek the pack and install it, offering to install any dependencies too. What is installed is the working, maybe binary, image of the software which has hopefully been verified to run within that release of the OS. In most cases, for Ubuntu say, this is quite robust but as you go to smaller, niche software, whether distro or esoteric package, then that confidence may begin to wane. Simply because the numbers of folk testing and using is so small.

So in your case, I simply tried:
sudo apt-get install omxplayer

and it reported
E: Unable to locate package omxplayer

This is not uncommon, the package name is not always the name of the application. They might have called it 'omxplayer-mp3' for example.

Then, after a quick Google, I saw it was available on github, but this is more agnostic to the distro and may require support libraries that are not provided in the current release, are the wrong version and so on . Hence my mandrolic term - you have to put some work in, or at least be prepared for it.

So install VLC then:
sudo apt-get install vlc

And mpg123
sudo apt-get install mpg123

There's a variant called mpg321, I'll leave that installation to you. You can have both of course, they very similar and appear to exist because of some early licensing clause and lack of development. But running them is the same; open an xtem and type something like:
mpg321 ~/music/Hedonism

and there's text output of track etc and hopefully audio too! So one can ssh from a remote system, and play whatever tracks you wish.

I'd found their names in some Pi-related forum/site as I was looking for simple(r) ways to verify the sound system from the command line with less system running e.g. no display.

Note, that a man page is usually included with the package, so you can type 'man mpg123' to read the manual. But for Pi packages this is not installed, resources presumably. So just type it into Google instead will often get what you want; man mpg123 in Google results in the mpg123 and mpg321 man-pages as the first 2 results.

VLC will play audio although I did hear glitches on the line. This seems to be common, all audio players for the distro did the same i.e not a VLC bug, and fingers were pointed at codecs, ... but the XBMC distro is as clean as a whistle.

You will want to buy the hardware codec(s) for your video ideas. All the home video I've generated that display on our Sony TV (very picky about formats) run nicely on the Pi once the licence is purchased.

And if you want to run a graphical tool like VLC then you might like to investigate:
ssh -X <your Pis IP> vlc

The -X will forward all graphical stuff (its the X11) back to your system i.e. the VLC GUI will pop up in your local window manager (not Windows natively though).

Hope this helps. Good luck.

BillF
Posts: 11
Joined: Sun Jan 27, 2013 1:27 pm

Re: ow do I play MP3 or MP4a Files

Sun Feb 10, 2013 1:01 pm

Thanks for your help DBryant, I have now managed to get VLC media player working - I see what you mean how it jumps a bit but it's not too bad.

It has trouble with basic video files as it will play the sound but gets stuck on the first frame of the video. I also noticed that the task manager is at 100% so I clearly need to attend to the resources that the Pi is using. I need to find a way of seeing which tasks are using the resources.

I will try to to get mpg123 working to see if that is better, I see you use command line inputs to save the resources used by GUI but if I try that I end up with some very complicated commands as my music is in a sub directory on a network hard drive. So I am typing for almost as long as I am listening. I'm sure there must be a way round this too.

DBryant
Posts: 281
Joined: Sat Feb 02, 2013 12:41 pm
Location: Berkshire, UK

Re: ow do I play MP3 or MP4a Files

Sun Feb 10, 2013 1:10 pm

Jittery video playback could be a result of your network. Take a look at its performance by putting some video on your SD card and playing it from there. That will give you a level of performance, you should find it quite acceptable.

I've been playing with raspbmc and it happily plays a DVD over the network.

ghans
Posts: 7882
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: ow do I play MP3 or MP4a Files

Sun Feb 10, 2013 1:32 pm

No video player except omxplayer is harware-accelerated.
VLC is still OK for music , i've heard.

mpd (music player daemon) can be easily remote-controlled via Android apps or many other ways.

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

Return to “Beginners”