/ tuesdaytooling

Tuesday Tooling: hasciicam

Render yourself in The Matrix!

So what is it?

Hasciicam is an application to render webcam video output using ASCII.

What is ASCII?
"American Standard Code for Information Interchange, is a character encoding standard for electronic communication. ASCII codes represent text in computers, telecommunications equipment, and other devices. Most modern character-encoding schemes are based on ASCII, although they support many additional characters." Source: Wikipedia

No really, what does it do?

Hasciicam takes live video output from your webcam, and renders it using text and we can alter the configuration of the output in many ways.

Animated-GIF-downsized_large--4-

Hi reader!

I never put my blog posts behind paywall or pop ups because quite frankly that is annoying and prevents anyone from accessing the content. I will always keep my blog content free of charge. But I do ask that if you are able and willing, that you buy me a "coffee" as it helps me to pay for hosting this blog, and to buy stuff to hack from Poundshops / Dollar Stores / Aliexpress which are used in free projects and reviews on this blog. It is You dear reader who make this possible, and I am immensely grateful for your support.
Thanks!

So how do I install it?

Hasciicam is only available for GNU / Linux systems.There is an installation candidate for Debian / Ubuntu available via APT. Open a terminal and type

sudo apt install hasciicam

So how do I use it?

To run the command type...

hasciicam

This should find your webcam, but just in case it doesn't we can specify the device. In this case my Lenovo X390 has a built in webcam at /dev/video0 and so to use it...

hasciicam -d /dev/video0

Screenshot-from-2020-06-14-11-52-19
Hey Les all I see is about 5-10 lines of garbage on the screen!
Yeah I got this too, it seems that I need to use the webcam with another application before I can use it with hasciicam. The simplest way is to use something like Cheese (pictured above) or if you would like a pure terminal way then we can use mplayer.
mplayer tv:// -tv driver=v4l2:device=/dev/video0:width=1280:height=720:fps=30:outfmt=yuy2

So what can I do with it?

Let's try a quick test to render the video to a terminal.

hasciicam -d /dev/video0

Close the window and lets now try something a little more complex.

hasciicam -d /dev/video0 -m html -r 0.1 -S 1 -B 000000 -F FF0000 -a arial

In this example I open hasciicam and set the following options.

  • -d /dev/video0
    • Use my laptop webcam.
  • -m html
    • Send the output to an html file, by default called hasciicam.html and in the saeme directory as where the command has been run.
  • -r 0.1
    • Sets the speed at which the image is updated. The default is 2, 2 seconds. But in this case I set it to 0.1 seconds.
  • -S 1
    • Text size defaults to 1, but we can increase it up to 4.
  • -B 000000
    • Sets the background colour using a HEX value, in this case black.
  • -F FF0000
    • Sets the foreground colour using a HEX value, in this case red, for a Terminator vibe.
  • -a arial
    • Uses an HTML safe font to render the ASCII text.

Screenshot-from-2020-06-14-13-05-58
Sarah Connor?
So now we can open that file using a web browser and it will automatically update.

Anything else?

Hasciicam can also send the output to an FTP server -f --ftp. If you want to set this up, give hasciicam your FTP details, and your content will be shared with the world. Fun!

Happy Hacking!