Ascii video output from your webcam in your terminal.
Find a file
2026-06-17 15:54:08 +05:30
assets Implementing my own C libs 2026-06-08 13:36:51 +05:30
C Add character sets 2026-06-17 15:53:36 +05:30
Cpp Update README and organise file structure 2026-05-15 01:27:35 +05:30
tests rename file to security_tests.c 2026-06-01 23:26:51 +05:30
.gitignore Update Readme and gitignore 2026-06-17 15:54:08 +05:30
LICENCE Add PolyForm non-commerial LICENSE 2026-06-01 17:08:59 +05:30
README.md Update Readme and gitignore 2026-06-17 15:54:08 +05:30

AsciiCam

Real-time ASCII video from your webcam in the terminal - pure C99, no heavy runtime dependencies.

Edge detection + threshold plugin


Features

Feature Details
YUYV to grayscale SSE2 SIMD (yuyv_to_gray_simd) - 16 pixels per iteration on x86_64, NEON on ARM64
YUYV to RGB Fixedpoint BT.601 conversion for truecolor output
Multiple render modes Braille (), Blocks (█ ░), ASCII ramp, Halfblock, Dots - switch live with m/M
Edge detection Sobel, Sobel with direction, Laplacian - toggle with x/X
Hotreloadable charsets Load .txt ramps from a directory, switch with n/N, monitor with inotify
Pseudo3D depth pop Parallax effect based on brightness - adjust with +/-/v
FloydSteinberg dither Errordiffusion to reduce banding
ANSI truecolor \033[38;2;R;G;Bm percell coloring
Hotreload plugin system inotify + dlopen - rebuild a filter .so, it reloads live
FPScapped render loop CLOCK_MONOTONIC + nanosleep frame pacing
Producer/consumer threads Doublebuffered capture + render (stubbed in main loop, active in thread_sharing.c)
Crossplatform Linux (V4L2, nolibc) and macOS (AVFoundation, system libc)

Linux: requires gcc, linux/videodev2.h (kernel headers), libdl, libpthread. macOS: requires Clang and AVFoundation frameworks (linked automatically).

No other external dependencies.


Build

git clone https://github.com/Harshit-Dhanwalkar/AsciiCam.git
cd AsciiCam/C/
make

Requires: gcc, linux/videodev2.h (kernel headers), libdl, libpthread. No other external dependencies.

build/webcam_ascii --help

Run

# Basic (grayscale, 80×40, /dev/video0)
./build/webcam_ascii

# Truecolor output
./build/webcam_ascii -C

# With all three plugins
./build/webcam_ascii -p build/invert.so -p build/threshold.so -p build/edge_detect.so

# Edge detection mode, custom resolution
./build/webcam_ascii -e -w 320 -h 240 -W 120 -H 50

# Dithering + inverted charset
./build/webcam_ascii -D -i

Plugin system

Plugins are shared objects (.so).

gcc -O2 -fPIC -shared -Iinclude filters/my_filter.c -o build/my_filter.so
./build/webcam_ascii -p build/my_filter.so

Hot-reload: the binary watches the .so with inotify. Recompile it while the viewer is running and it reloads automatically within $\approx$100 ms.

Runtime controls:

Key Action
/ select plugin
[ / ] param $\pm$1
{ / } param $\pm$10
r reset param to 128
q quit

TODO

  • Adjustable capture resolution
  • Producer/consumer thread split (double-buffered)
  • Brightness / contrast adjustment
  • Invert brightness to charset mapping
  • ANSI truecolor output
  • Floyd-Steinberg dithering
  • Sobel edge detection
  • SIMD YUYV to grayscale (SSE2)
  • Hot-reload plugin system
  • nolibc - zero libc calls
  • Custom charset via config file
  • Record to .mp4 / .gif
  • Inter-frame delta compression
  • LUT cache optimization
  • Replace pthread with raw futex syscalls
  • Replace dlopen with a minimal ELF loader
  • Custom threading library using clone() + futex to eliminate -lpthread (pthread functions) dependency
  • Implement an ELF loader (or statically link plugins) to eliminate -ldl (dlopen/dlsym/dlclose which are part of libdl.so also glibc) dependency
  • MacOS support
    • Color support for MacOS
  • Windows support

Fixes


Project is under PolyForm Noncommercial License BY-NC. For commercial use contact harshitpd1729@gmail.com.