View a video in ASCII


  

There are so many weird things that you can do with the help of a Linux system. Well, the  term ‘weird’ is relative since there is a good number of geeks who consider these as ‘cool’. You may try searching ‘weird things using Linux’ to get more entries like this in this blog.

 

Video in ASCII model

There are different ways for doing this. Here I’m gonna describe one of the easiest ways using MPlayer. Before you proceed further please make sure that you have installed mplayer in your system. This is available in the software repository of most of the popular Linux distributions.

After installing MPlayer, issue:

 

mplayer -vo caca file.avi

 

Replace ‘file’ by the name (and path if required) of your file. The parameter –vo is used to select the video output driver. You can also use –ao to select audio output driver. We also use the caca library which is the ASCII-art library for producing output text with color (you can learn more about it in this website).

 

I experiment with a video file (‘Stephen Fry in America’) and obtained this:

 

You may try using the parameter ‘nosound’ for playing it without any sound and  ‘fs’ for displaying in full screen.

You may have notice that it is not very elegant. You can improve it (not the quality!) by adding a subtitle file using the parameter ‘sub’.

And here is a set of libraries which you can try instead of  caca:

 

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

Be Sociable, Share!

Tags: , ,


TechBlog on Facebook

Leave a Reply