Monday, 6 August 2007

Video Enlightenment through MPlayer

I'm sitting in ForensiT's new office waiting for BT to turn up and connect us to the outside world. As the office is still an empty box, I've got some time to update this blog.

Last Christmas my wife and I got ourselves a HDD Sony camcorder; no more tapes; no more messing around transferring video off tape and onto a computer. When I plug the camera into my laptop, Fedora does that cool thing that Fedora does, and asks me if I want to import my photos. When I tried to play a video clip however, Totem just complained that I did not have a decoder installed to handle the mpeg2 file format.

Totem uses either the xine-lib or GStreamer libraries. On Fedora it uses the GStreamer libraries by default, so I set about making and installing the gstreamer-mpeg2 plugin. To cut a long story short, although I could make and install the mpeg2 plugin I got no where trying to play my videos. I've never been impressed by Totem and I'm even less impressed now... Then I found MPlayer.

Basically, MPlayer is awesome! You do have to make and install the software yourself, but it isn't difficult, and it is well worth the effort. There are excellent instructions here. MPlayer played my video clips immediately with no additional configuration.

The only problems I have found with MPlayer are to do with Beryl. With Beryl running, you get a “X11 error: BadAlloc (insufficient resources for operation)” error when you try to play a video. The solution is simply to use the X11(XImage/Shm) video driver: you can set this in the MPlayer “Preferences” on the “video” tab if you are using the GUI; you should also set vo=x11 in the .mplayer/config file in case MPlayer gets called from elsewhere. Using the x11 driver fixes just about everything. The only exception I found is playing wide screen videos: the x11 driver forces the video to play at 4:3. You need to switch to the Metacity Window Manager and change the MPlayer video driver back to “xv” if you want to watch wide screen videos in all their glory. The only other problem with Beryl is that the MPlayer skin stays in a rectangular window rather than showing up on its own.

My feeling is that this is a small price to pay. However, this is Linux and what I'm learning is that one size does not fit all – so another solution might suit you better. There is one other advantage with MPlayer, though. MPlayer can handle RealPlayer files. What's more, you can install a plugin so that MPlayer will play multimedia content embedded in Firefox. There are different versions available; I installed mplayerplug-in. (If you do this, SELinux jumps in when you try to watch a video. However, the SELinux Troubleshooter tells you what to do – you chcon a couple of files - and all is well.) After removing the links to the RealPlayer plugins in the /usr/lib/mozilla/plugins directory, I can now watch RealPlayer content in Firefox without having to launch an external viewer – something RealPlayer itself could never do.

2 comments:

Mauriat said...

Just out of curiosity, was there any particular reason you decided to compile MPlayer from source as opposed to using pre-built RPM's? :-)

David Rowe said...

There was... When I searched in pirut there was no MPlayer package available. However, I now see that there is RPM available via rpm.livna.org. Thanks for the tip!