Feb 12
20
Fun With Video in Linux Using MPlayer
Introduction
MPlayer has some features that you may not have noticed if you only use it to watch your videos or if you use a different video player. I use VLC as my video player because I like to shuffle large playlists and it works well, but if you check in the Bash Programming category of my blog you will find a post called “Media Shuffle Bash Script” which uses MPlayer. It is a very old script but I am sharing it as an example of bash programming, but the script does work.
Installing
I use MEncoder to convert video and it installs MPlayer with it. In an Ubuntu based operating system it can be installed with the following command:
sudo apt-get install mencoder
To install MPlayer without MEncoder use the following command:
sudo apt-get install mplayer
MPlayer Output Drivers
MPlayer can route the video through different drivers. Some of these will show the video in interesting ways. To list the output drivers available to MPlayer:
mplayer -vo help
A list will be displayed like this one:
mplayer: Symbol `ff_codec_bmp_tags' has different size in shared object, consider re-linking
MPlayer SVN-r33713-4.6.1 (C) 2000-2011 MPlayer Team
Available video output drivers:
xmga Matrox G200/G4x0/G550 overlay in X11 window (using /dev/mga_vid)
mga Matrox G200/G4x0/G550 overlay (/dev/mga_vid)
tdfxfb 3Dfx Banshee/Voodoo3/Voodoo5
3dfx 3dfx (/dev/3dfx)
vdpau VDPAU with X11
xv X11/Xv
gl_nosw OpenGL no software rendering
x11 X11 ( XImage/Shm )
xover General X11 driver for overlay capable video output drivers
sdl SDL YUV/RGB/BGR renderer (SDL v1.1.7+ only!)
gl OpenGL
gl2 X11 (OpenGL) - multiple textures version
dga DGA ( Direct Graphic Access V2.0 )
fbdev Framebuffer Device
fbdev2 Framebuffer Device
svga SVGAlib
matrixview MatrixView (OpenGL)
aa AAlib
caca libcaca
v4l2 V4L2 MPEG Video Decoder Output
directfb Direct Framebuffer Device
dfbmga DirectFB / Matrox G200/G400/G450/G550
xvidix X11 (VIDIX)
cvidix console VIDIX
null Null video output
xvmc XVideo Motion Compensation
mpegpes MPEG-PES to DVB card
yuv4mpeg yuv4mpeg output for mjpegtools
png PNG file
jpeg JPEG file
gif89a animated GIF output
tga Targa output
pnm PPM/PGM/PGMYUV file
md5sum md5sum of each frame
The Fun Part
You may have seen some ASCII art which is pictures or video displayed using text characters. MPlayer can do this with the videos you want to play.
To display the video using ASCII:
mplayer -vo caca <video file>
If you have seen the Matrix you would be familiar with the Matrix effect. This output driver looks really nice and is resizable.
To display the video using the matrix effect:
mplayer -vo matrixview <video file>
(Remember to replace <video file> with the file to play)
