Most modern laptops come with built-in webcams—giving you an easy way to communicate visually with workmates, send video messages, and of course, admire your handsome self in the wide-angle mirror image.

Of course, if you've devoted your technological existence to the Linux terminal, your webcam may seem like so much unnecessary hardware bloat. But with asciicam, you can put your webcam to work, in the Linux terminal.

Why View Webcam Output in Your Terminal?

An external PC camera device

Most laptops have webcams built-in, and long gone are the days when you'd have to perch a unit on your laptop lid and plug it into a spare USB port.

Webcams are super useful for long-distance communication and remote meetings. But if you prefer to talk in person and conduct meetings over Slack, your webcam sits there like an unused and accusatory eye.

For terminal warriors, the webcam is an even bigger waste of space, and if you don't run a display server at all, how would you view webcam output?

asciicam is a utility that lets you use your terminal to see what your webcam sees, so you can admire your gorgeous visage using the entire ASCII character set. If you're feeling especially adventurous you can even use ANSI.

How to Install asciicam on Linux

asciicam is written in Go and you'll need to have Go installed on your system before you start.

An easy way to install Go is from the Snap Store. So if your system supports snap packages, you can use this command to install Go:

        sudo snap install go --classic
    

Now that Go is installed, you can use it to install asciicam. Clone the asciicam GitHub repository with Git:

        git clone https://github.com/muesli/asciicam.git ~/asciicam
    

Use the cd command to navigate to the new asciicam directory, then build the app:

        cd ~/asciicam
go build

You can create a symbolic link that allows any user to run asciicam from any location in the terminal with:

        sudo ln -s ~/asciicam/asciicam /usr/bin/asciicam
    

Use asciicam to Play With Your Webcam in Your Terminal

asciicam selfie on linux

Start asciicam with:

        asciicam
    

...and the terminal will fill up with an ever-shifting display of ASCII characters to make up your face. This is a live video, so the characters will change as you move around the screen or talk.

You can increase the apparent resolution of the feed by decreasing the size of your terminal font.

If you're lucky enough to have more than one webcam on your computer, you can choose which one to use by starting asciicam with:

        asciicam -dev=/dev/video0
    

asciicam comes with some neat visual tricks. You can set the entire output to a single color, and the following command will set your terminal to a gorgeous nuclear pink:

        asciicam -color "#e51283"
    

Creating a Virtual Green Screen With asciicam

You can also set a virtual greenscreen to remove the background of your ASCII video feed. Before you can do this, asciicam needs sample images, so it knows what not to display.

Make a new directory in which asciicam can store thumbnails:

        mkdir bgdata
    

The following command will start asciicam and start generating data:

        asciicam -gen=true -sample bgdata/
    

Quit after a few seconds with Ctrl + C, and run the next command to start asciicam with the background removed:

        asciicam -greenscreen=true -sample bgdata/
    

If you need to alter the greenscreen threshold, add the -threshold flag. For example:

        asciicam -greenscreen=true -sample bgdata/ -threshold=0.12
    

And for the blocky pixelation of ANSI, add -ansi=true to the command. While this works well with the greenscreen options, it doesn't work with monochrome output for obvious reasons.

ASCII Webcams Aren’t for Everyone

asciicam is a great toy and a fun way to pass the time in your terminal. But occasionally, you may want to do serious things with your webcam such as recording tutorial videos or snapping high-quality selfies.

Don't fret, as terminal-based webcam apps aren't everything Linux offers. You can install a plethora of GUI web camera apps that will work flawlessly on your computer.