Monday, May 04, 2009

[SW] CLI: playing the video in ASCII art

I am just a normal PC user, but I like working with command line or text mode very much. The reason might be I think text mode is ``pure'' and ``simple.'' Of course, the word ``simple'' never mean it is simple for the users, but means the way of appearance or presentation.

After learning something useful in command line, e.g., writing and debugging code (gcc and gdb), surfacing the internet (elinks or w3m), and play audio files (mp3blaster), I began to curious about how to play video in command line mode.

To play a video, there are also methods to do it with the command line.

For VLC, try:

vlc -I ncurses yourVideoFile

For Mplayer, try:

mplayer -vo aa yourVideoFile
mplayer -vo caca yourVideoFile

where -vo means video output driver. The drivers aa and caca are used for monochrome and color ASCII art video output, respectively.

The results are funny. When you look at the monitor at normal distance, you may hardly figure out what are you watching. There is only rapidly changed ASCII symbols! As you step back form the monitor, however, you will find all the dynamic images become clear and meaningful. You are watching video consists of many ASCII symbols!

Here is one screenshots captured on my monitor. Use mplayer with -vo caca:
(Original video can be viewed on YouTube: 元ちとせ-春のかたみ. By the way, I love songs of 元ちとせ [Hajime Chitose] very much.)

Of course, the above image was captured by playing the video using Terminal in the desktop environment (pty?). I don't know how to output the ``image'' in the real command line mode (tty?).

Also, there are still some problems I don't understand. The first one is when I invoke the vlc with -I ncurses option using pty, the video still be played via the GUI but not the expected ASCII way. Another problem is that the aa option of mplayer cannot paly the video properly. Only part of the image was shown, as the following scrrenshot:

The final problem is that, when invoked under the tty, the mplayer did not do these works as well as it did under the pty. The reverse is true for vlc, however. Maybe someday I will realize the underlying reason about all these problems... maybe. :-p

No comments:

Post a Comment