command line audio player (gstreamer based?)

Forum: LinuxTotal Replies: 6
Author Content
Sander_Marechal

Jan 11, 2007
2:41 PM EDT
I'm having a cool new idea for a project. I hope to build it out of as many pre-made components as I can. One piece i'm missing is an audio player that I can control from the commandline and/or from scripts.

My idea started with an itch. I have a nice collection of music and so does a friend of mine. We both have a server that holds our libraries but we don't share with the outside world. We do occasionally rummage trough each other's library to see if any of us has discovered some neat new stuff.

Itch 1: rummaging is a pain. I have to either (a) copy the files or (b) mount his server as a remote filesystem.

Another thing is that I can't easily play my music. I'd like to be able to access my music without sitting behind my computer. I'd like to stream it from the server directly to my stereo set, either playing randomly as a jukebox or ideally with some simple kind of remote that allows me to skip forward/back through songs.

itch 2: streaming and control.

My idea: Create a jukebox daemon. It will do three things:

1) talk to other jukebox daemons that I have access to. It should be able to serve files from my local library as well as from my friend's library transparently (if he also runs the daemon).

2) access control. If I let my girlfriend access my library through the daemon, she should NOT have access to my friend's library. Just mine.

3) it should stream the music to either the local soundcard (which could be wired to the stereo set) or a local internet radio server (which makes it easy to simply buy a $50 internet radio receiver and have it listen to your server on the local network). I know you can feed the soundcard into the internet radio server as well, but that makes this kind of setup hard if your music server has no sound card (which is often the case).

So, I'm looking for a command line audio player that can play to the soundcard or to a radio server (e.g. Icecast). Gstreamer-based preferred because it makes plugin management so easy.
hkwint

Jan 11, 2007
3:32 PM EDT
If I were you, I'd definitely check VLC-media player. It is able to act as a server and a client, works over the TCP protocol, has a lot of support, and can be accessed via SSH if running on your friend's box. When I was at T-Dose in Eindhoven, they gave a nice presentation about it, streaming media from one computer to the other, and also over internet. It looks a lot like what you are proposing, except for the remote control (it supports LIRC, Gentoo says, so this should be working) and access restrictions, don't know about that (yet). VLC also works with video-content. Best of all, it has a 'click the checkboxes' gui, and once you click the right checkboxes, VLC shows what the commandline-command would have been to reach the same results as when using the gui.

From their site ( http://www.videolan.org/vlc/ )
Quoting:VLC media player is a highly portable multimedia player for various audio and video formats (MPEG-1, MPEG-2, MPEG-4, DivX, mp3, ogg, ...) as well as DVDs, VCDs, and various streaming protocols. It can also be used as a server to stream in unicast or multicast in IPv4 or IPv6 on a high-bandwidth network.


See this webpage to see what formats (input/output, subtitles, video etc.) VLC-player supports: http://www.videolan.org/vlc/features.html

I have my serious doubts about gstreamer, since it is rather prone to slightly different setups on your PC. I couldn't get gstreamer working on Gentoo, since it required all kinds of 'dirty hacks' and unusual configurations to make it work, and even after I tried all that, it still doesn't work. This says a lot about how its portability, which seems rather bad to me. VLC-player seems better at 'working out of the box' as far as I can tell, also on Mac, *BSD, Windows, BeOS, Linux for PDA's (familiar project) and Solaris.
Sander_Marechal

Jan 11, 2007
4:49 PM EDT
Quoting:When I was at T-Dose in Eindhoven, they gave a nice presentation about it


Grr... I knew I should have gone there anyway. I wanted to, but decided against it at the last moment because I was running low on money.

Quoting:I have my serious doubts about gstreamer


That will probably improve. As far as I can tell, gstreamer is being spun-off from gnome and made a desktop standard in it's own right. I read somewhere that KDE and XFCE are adopting gstreamer as well. Kind of like how Gnome and XFCE will probably get the KDE IO-slave setup.

I'll definately check VLC out. Thanks.
swbrown

Jan 11, 2007
9:24 PM EDT
You probably just want a jukebox based around icecast. "icecast jukebox" on Google should point you to some existing projects.
Sander_Marechal

Jan 16, 2007
4:28 AM EDT
I found a couple of interesting projects that use icecast as a jukebox but none that really fills my need. I've decided to try and hack something together myself using Gstreamer from Python (I needed an excuse to learn more Python anyway).

I must say that GStreamer is quite nice once you wrap your brain around it. Another nice plus is that gstreamer has TCP sources and sinks built-in so I can easily stream from one server to the other. Documentation is a pain though, but I'm not going to create very complicated gstreamer pipelines. 30 lines of code for a format agnostic, network transparent audio pipeline. Yay!
hkwint

Jan 17, 2007
12:58 PM EDT
OK, let LXer know when you're ready, we'll be happy to announce it!
Sander_Marechal

Jan 17, 2007
3:40 PM EDT
I will :-) At the moment I'm just programming test scripts. How to daemonize and control a daemon. How to transport gstreamer pipelines over TCP/IP, etcetera. I'll probably write up some tutorials in the mean time about these subjects. Once the code is done it's really very simple and small, but figuring it all out is hard due to the lack of documenation of a lot of non-core python modules.

Are tutorials about specific laguages/libraries welcome at LXer or should I just publish them on my own site?

You cannot post until you login.