MatrixCam is a Linux V4L2 “ASCII-art camera” program written in C. It reads frames from a real webcam device, converts each block of pixels into an ASCII character based on brightness, then renders those characters (using stb_truetype.h) back into a green, text-looking video frame and writes it to a V4L2 output device (a virtual camera) made with v4l2loopback. It's named "MatrixCam" because green colour and 1 and 0 gives off matrix vibes.
matrix_cam_demo.mp4
On Fedora: ensure v4l-utils and v4l2loopback-utils are installed, then compile:
cc -o matrix_cam matrix_cam.c -lmCreate a virtual webcam device (/dev/video10) using v4l2loopback and run the program:
sudo modprobe v4l2loopback devices=1 video_nr=10 card_label="matrix cam" exclusive_caps=1
./matrix_camThen you can find your virtual camera in apps like Discord or test it out using ffplay:
ffplay -f v4l2 -framerate 30 -video_size 920x720 /dev/video10In the .c file you can find image resolution constants, block sizes (each ASCII character is corresponds to average brightness from a block) and font size (if you decrease/increase block sizes, then you should also do the same with font size; otherwise it isn't going to look good) and an array of used characters. Increasing resolution or decreasing block sizes (make sure you keep vertical block size higher to account for tall symbols) will increase video quality, but this can lead to less "matrix" effect and smaller framerate. Also you can change colours in draw_char(). Currently, code isn't in it's best form, so, don't expect much "cleanness" in it. I will try to add beauty to it later. I promise to do it (or not; not sure yet) :)
Have fun!