Monday, April 23, 2012

Linux / UNIX: mplayer Play mp3s From a Playlist File

I'm an extreme newbie to the Linux world, but any time I try to get play files according to a playlist file using mplayer command line it turns up this error:
$ mplayer playlist.m3u
MPlayer SVN-r1.0~rc3+svn20090426-4.4.3 (C) 2000-2009 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.
Playing playlist.m3u.
Cache fill: 0.00% (44 bytes)
Exiting... (End of file)
How do I fix this and play music without using GUI tools?

mplayer is a movie player for Linux and UNIX like operating systems (it may also runs on many other platforms). It plays most MPEG/VOB, AVI, ASF/WMA/WMV, RM, QT/MOV/MP4, Ogg/OGM, MKV, VIVO, FLI, NuppelVideo, yuv4mpeg, FILM and RoQ files, supported by many native and binary codecs. You can watch VCD, SVCD, DVD, 3ivx, DivX 3/4/5, WMV and even H.264 movies, too.

mplayer: Playing Music Using a Playlist File

First, make sure your playlist in ASX, Winamp, SMIL, or one-file-per-line format. Next, you need to use the following syntax to play any media file from playlist. Open a command-line terminal (select Applications > Accessories > Terminal), and then type the following command:
mplayer -playlist {yourlist.input.file}
mplayer -playlist playlist.m3u

A Sample One-file-per-line Playlist Format

$ cat playlist.m3u
Sample output (tracks):
track1.mp3
track2.mp3
track3.mp3
track4.mp3
You can create a playlist called mylist.txt as follows by searching all .mp3s in /home/vivek/music directory:
find /home/vivek/music/ -type f -iname "*.mp3" > mylist.txt
To play mp3 from a playlist, enter:
mplayer -playlist mylist.txt

No comments:

Post a Comment