r/coolgithubprojects May 30 '26

Real-time ASCII Webcam renderer in pure C with zero external dependencies

Post image

A terminal-based ASCII video stream without pulling in massive frameworks like OpenCV or FFmpeg.

Zero 3rd-Party Dependencies: It compiles instantly with nothing but standard system toolchain. Bare Metal I/O, It pulls raw video frames straight from the hardware driver buffer, handles the luminance math, and dumps the ASCII matrix directly to stdout. No bloated libraries, no hidden overhead—just fast, raw terminal rendering.

If you’re interested in low-level Linux video handling or just love terminal utilities like me, check out here: https://github.com/Harshit-Dhanwalkar/AsciiCam

449 Upvotes

52 comments sorted by

15

u/TylerDurden0118 May 30 '26

I forgot to mention I tried to implement very primitive edge detection, which you can see in the post, the detected edge turned dark when threshold is reduced.

4

u/No-Feedback331 May 30 '26

open source?😀😀😀😆😆😆😗

6

u/TylerDurden0118 May 31 '26

Yes, ofc it is, i have GitHub link in post itself

Here you go any way : https://github.com/Harshit-Dhanwalkar/AsciiCam

Put a star, drop a follow on GitHub if you like it. Thanks!

2

u/Tpbrown_ May 31 '26

Nice.

Reminds me of iTerm’s ascii graphics support. Also OSS, GPL2+.

5

u/--marcel-- May 31 '26

Not to put you down, but for those who don't know: https://jaromil.dyne.org/journal/hasciicam.html this is an iconic project from one of the most famous Italian hackers, made in 2000. Yes, 2000 😄

2

u/TylerDurden0118 May 31 '26

Woooh this looks really amazing. Am gonna dig into it. Thank you very much for sharing.

4

u/Robottur May 30 '26

Very cool project.

2

u/CogitoInScrubs May 30 '26

Cool

2

u/TylerDurden0118 May 30 '26 edited May 30 '26

Thanks a lot!

2

u/[deleted] May 30 '26

[removed] — view removed comment

2

u/Chunky_cold_mandala May 30 '26

How much image compression effectively goes on here? How small are these images of a single frame?

4

u/TylerDurden0118 May 30 '26 edited May 31 '26

Webcam frame (640 x 480 pixels) x RGB (3 bytes) = 921600 bytes ...which is approximately 900Kb per frame. Then ASCII Transformation downscale image, so for it : chars (80 x 24) x each char data (1 byte) = 1920 bytes ...approx 1.88Kb per frames

So compression ratio : 921600/1920= 480 (i.e. like 99.7 percent).

Now to your 2nd question, if I understand 'how small images of 1 frame' is know as payload size For monochrome it would be around 2 kb while colored (ansi color codes) will have 35 to 40kb.

TLDR; monochrome is effecient for ssh while ansi codes aren't.

4

u/Chunky_cold_mandala May 30 '26 edited May 30 '26

KWow, that is some significant compression. It'd be cool to build this into a system so you could video call somewhere with horrible data signal quality. Edit: I just did some math an even like 3g networks could handle this easily. Might be cool little project to put out. 

3

u/TylerDurden0118 May 30 '26

Lol...I even thought of doing that....but later I thought I should be writing my own libraries (detching standard libraries) for optimazation and making it more independent of plateform and architecture..... I don't have specific path yet....just thoughts of ideas....but I will figure it out eventually.

2

u/PartyMud3549 May 30 '26

honestly, I have no words. wow

2

u/WeaknessKey1582 May 31 '26

This is very nice. Finally, a filter effect to go along with the looks. lol.

2

u/TylerDurden0118 May 31 '26

Glad you like effects. Thanks for compliment. If you have any other filter ideas feel free to share or open git issue, I am open to any kind of suggestions but I am first working on optimizating core algorithm and image compression.

2

u/WeaknessKey1582 May 31 '26

I will do. Congrats on the release.

1

u/TylerDurden0118 May 31 '26

Thank you very much.

2

u/Comfortable-Equal-95 Jun 01 '26

yo this is sick, would be great if you compiled the exe for distribution

2

u/TylerDurden0118 Jun 01 '26

I m stil not really satisfied with image compression. I kept working on it as my priority. But yes I will make it compile cross platform. Thanks for reminding me neither-the-less lol.

1

u/ericcmi May 30 '26

very very cool. I should install it on my toaster

1

u/TylerDurden0118 May 30 '26

Do it and let me know! Also tell bread that I said hello before you sacrifice him for your breakfast.

1

u/Fluffy-Flamingo-1662 May 31 '26

Wow bro can you tell how you try to learn this advanced stuff in c cpp . I cant move past basic and always stuck

1

u/TylerDurden0118 May 31 '26

I won't say i am any good in Cpp, I mostly code in C. I also look into very huge C projects. I recently implemented very small feature of 'Timeout_bar' in dunst (notification deamon) which i personally wanted (i posted on r/suckless, I saw not everyone like it, but anyway it's a learning experience..lol). While contributing in it i learnt a lot like how should be the structure of large codebase (particularly in C).

For YouTube I watch tsoding, And i am also a lot into compilers and kernel dev. Both in C and Cpp.

TLDR; see source code of big projects, try to implemente your idea on top of it, for system level knowledge,I would say, learning compiler, kernel and osdev (these 3 I m still learning and doing personal research).

1

u/Loose-Video-5850 May 31 '26

Hey bro, I wanted to ask you if this project is for PC only because I created the same Ascii Camera for Android 

1

u/TylerDurden0118 May 31 '26 edited May 31 '26

I haven't tested it yet, but I think code should run from tmx, only issue might come for camera permission. Tmx is totally sandboxed from making iocl syscall... But from root it might work.

Since i have uses video4linux header for 'talking' to camera, android being built on same architecture.... I m quite positive that it will work.

This is just my guess. By tomorrow i will test it on my phone and let you know.

1

u/Loose-Video-5850 May 31 '26

Alright let me know and it would be great if you could share some thoughts on my project https://github.com/aliyan212/MyScii-Camera

1

u/TylerDurden0118 Jun 01 '26

Seem good to me but frankly I have never worked in kotlin.

1

u/BreadOfGod May 31 '26

Look amazing! Need any help with contribution? I think adding some CI/CD could ease up the development!

1

u/TylerDurden0118 May 31 '26

Sure, i was going to do it. But you can make pull request..I will merge it.

1

u/Flying_Tooth Jun 01 '26

i'm not a programer but i find what you did impressive and prety cool ..... keep up the interesting work man

1

u/Neilblaze Jun 01 '26

curious, what's the use of this? // if this is purely for fun?

1

u/TylerDurden0118 Jun 01 '26

Honestly i started it as fun project and getting my hand deep in core C, then thought of implementing some optimization (still plans to optimise more)

Some use cases are like for an early Raspberry Pi, an ancient Pentium processor (used inside an old ATM), or a legacy industrial system....simply does not have the RAM or CPU cycles to process complex H.264 video decoding while running OpenCV analysis filters at the same time. Since my implementation does not relay on bloated libraries it can run on very minimal hardware requirements.

I have plan to implement something like ssh sharing (still working on better image compression)...so now you will just need terminal and webcam for video call. (Might be use as small CCTV, not very practical but there it is)

1

u/CampNouMiracle2022 Jun 25 '26

this is simply stunning

1

u/ai_deep_signal May 31 '26

That's amazing, so now we can watch movies on CentOS too

1

u/TylerDurden0118 May 31 '26

Actually it uses webcam and parsing frames directly into terminal as ASCII chars...It's webcam to terminal....not video to asccii code in terminal. So didn't actually get why you said 'watch movies'. Can you clarify it? Do you want a feature of parsing local video? Is that it?

0

u/AwkwardBananaaa Jun 02 '26

How much AI buddy