Girish Venkatachalam is a UNIX hacker with more than a decade of
networking and crypto programming experience.
His hobbies include yoga, cycling, cooking and he runs his own
business. Details here:
There is an old joke that Windows folks swear by VLC and UNIX folks swear by mplayer.
What are these?
Both play multimedia files - both audio and video. But the approach taken towards solving this problem is quite different.
For programmers there is a whole world of difference between the two projects.
VLC is a French project and Mplayer a Hungarian one.
Both use FFMPEG backends - libavcodec library and friends to do the multimedia heavy lifting.
For some reason UNIX people always love mplayer for its flexibility, power and the smell of UNIX.
How do you smell UNIX?
It is about the power of the command line,the rich options and the intuitiveness of the interface.
VLC on the other hand is a GUI app and that is why without a doubt Windows people love it.Both are free and open source and incredibly powerful.
VLC has certain features like EPG(Electronic Programming Guide) extraction from DVB Satellite feeds which is lacking in mplayer.
And Mplayer has loads of features that VLC does not have.
Throw any file at mplayer and it will handle it. Really well.
I face problems with obscure audio formats that the medical transcription industry uses and mplayer barks.
sndplay can handle it but not well.
sox is also only so so.
VLC is smarter than mplayer in many ways particularly if you are interested in embedding into the browser or if you wish to have largely a Windows audience with ports done to Linux and Mac.
Mplayer is also embeddable into the browser and runs admirably well on Windows.
But as I said above and have been saying again and again mplayer is 100% UNIX. And no mistake. Windows people can use it and there are plenty of GUI frontends for mplayer - technically called as skins.
And with skins mplayer can be a better GUI than VLC but still there is no single official GUI. Lack of consistency makes it hard for people from the Windows world.
What I love most about mplayer is its ability to get your work done with the least bit of effort.
For instance if you wish to obtain details about a playing file like file name, offset, playlist manipulation and so on, you can start mplayer like this.
$ mkfifo /tmp/inputfifo $ mplayer -input file=/tmp/inputfifo file.mpg
By the way mplayer can play youtube flash videos perfectly well.
Now once you start mplayer like this you can obtain several pieces of interesting info from mplayer whilst it is playing like this.
$ echo "get_file_name" > /tmp/inputfifo
You can see that it spits out the details on STDOUT.
You can look at the list of full commands that mplayer understands here:
$ mplayer -input cmdlist seek Float [Integer] edl_mark audio_delay Float [Integer] speed_incr Float speed_mult Float speed_set Float quit [Integer] stop pause frame_step pt_step Integer [Integer] pt_up_step Integer [Integer] alt_src_step Integer loop Integer [Integer] sub_delay Float [Integer] sub_step Integer [Integer] osd [Integer] osd_show_text String [Integer] [Integer] osd_show_property_te String [Integer] [Integer] volume Float [Integer] balance Float [Integer] use_master mute [Integer] contrast Integer [Integer] gamma Integer [Integer] brightness Integer [Integer] hue Integer [Integer] saturation Integer [Integer] frame_drop [Integer] sub_pos Integer [Integer] sub_alignment [Integer] sub_visibility [Integer] sub_load String sub_remove [Integer] vobsub_lang [Integer] sub_select [Integer] (Output snipped for brevity)
You can of course change volume, load files at runtime and so on.
Mplayer's playlist manipulation features are a bit primitive but you can get around it by combining various input commands.
Mplayer also comes with full support for LIRC IR remote control.
Of course these days people simply use iPhone over Wi Fi.
Mplayer has trouble handling high definition video streams from satellite and its caching engine does notunderstand a thing about UDP memberships to read from a UDP multicast stream spat out by a satellite headend.
But it does a fairly decent job.
VLC excels at playback in Windows. Under UNIX it has not been properly tested I think.
Both projects are raw in certain ways and you can know that they are open source and not completely done.
But if you are building a commercial product with multimedia capabilities on an embedded platform thensurely mplayer is king.
It is 100% ANSI C code.
Its performance is what makes it what it is.
It has a whole bunch of audio and video drivers. It can rip DVDs and so on.
I wrote this article long ago.
Still the novelty does not seem to wane...
Got something to add? Send me email.
More Articles by Girish Venkatachalam © 2011-10-19 Girish Venkatachalam
As soon as an Analytical Engine exists, it will necessarily guide the future course of the science. Whenever any result is sought by its aid, the question will then arise — by what course of calculation can these results be arrived at by the machine in the shortest time? (Charles Babbage)