
Show HN: A Simple terminal-based video chat – renders in ASCII and has audio - emgram769
https://github.com/mofarrell/p2pvc
======
bwy
This is awesome! Wonder how it compares with mine
(github.com/billyeh/termchat). Would love to share notes with the maker, since
audio was something I did not even consider while I was making it. The image
processing part is fun, though!

~~~
emgram769
I helped create it at a recent hackathon. the ascii is rendered by calculating
the intensity of any given pixel, mapping that intensity to a character based
on how much that character fills up space ('@' would be bright and '.' would
be dark) and then approximating the color of the pixel to fit within the 256
available

I've noticed your implementation uses websockets, which are built on top of
TCP. we used UDP and encapsulated everything is a pretty simple to use (and
easily the most well documented part of the project) p2plib.c. the fear was
that video and audio can get backed up if we were to use TCP. so audio and
video were sent via UDP packets and rendered every time a UDP packet was
recieved.

~~~
13
You can go a bit further to get significantly higher color depths using ASCII
block characters 176, 177, 178. By using the foreground and background ANSI
colors and blending them by using these three characters (25%, 50%, 75%) you
can achieve some quite realistic images. If you're more interested in
resolution, using half block characters like 220 and 223 can allow you to
double your vertical resolution at the cost of not being able to use the color
trick.

~~~
dhotson
I made something similar to this using a combination of 256 color mode and
unicode halftone characters for "dithering" between the foreground/background
colors.

[https://github.com/dhotson/txtcam](https://github.com/dhotson/txtcam)

Another thing I'd like to try to get a bit more resolution is to perhaps use
the braille character set in combination with 256 color mode:
[https://github.com/asciimoo/drawille](https://github.com/asciimoo/drawille)

Also, some terminals are starting to support 24bit color (iTerm2 nightlies)
which could pretty drastically improve the possibilities of terminal based
video:
[https://github.com/frytaz/txtcam/tree/color](https://github.com/frytaz/txtcam/tree/color)
:)

------
onderkalaci
Its one of the most interesting github projects that I've seen so far!

------
chappar
Looks very cool. Sorry for nitpicking, there seems to be off by one at
"ascii_values[min((intensity + 40) / 9, sizeof(ascii_values))];" :-)

------
kfei
The audio part is cool!

I made a similar project to this (but without sound).

[https://github.com/kfei/sshcam](https://github.com/kfei/sshcam)

Which uses SSH connection, 256-colors, Unicode block characters and CIE94
algorithm to compute color distance when mapping colors to 256 palette.

Watch it in action: [https://www.youtube.com/watch?v=pAa-
pGda9kY](https://www.youtube.com/watch?v=pAa-pGda9kY)

------
atmosx
> p2pvc does not get around NAT, so you may need to port forward. It uses
> ports 55555 and 55556 for audio and video respectively.

Nice use case for IPv6.

~~~
zackmorris
Unfortunately from what I understand, IPv6 has the option for NAT. Once it
goes mainstream we'll probably find ourselves right back in this situation
with multitudes of users stuck behind firewalls as second class netizens.

------
zaroth
It's almost _too_ high fidelity. Wow.

One request - what's the bitrate? (I know it's probably possible to measure in
1 line of shell)

~~~
emgram769
well it is 100x40 in number of characters and there are 10 different
characters that can take on one of 256 colors. that's 4000 x (8 (256 colors
can be represented in 8 bits) + 4 (10 characters in 4 bits)) = 48Kb per frame,
with about 20 fps. so maybe 120 KB/s?

------
ivan_ah
Who needs skype when you've got ascii...

~~~
colmvp
The dream of the 60s is alive in your computer

------
Alfwich
Needs ncurses headers

sudo apt-get install libncurses5-dev

~~~
captn3m0
Also pulseaudio headers:

sudo apt-get install libpulse-dev

------
thewizardofmys
Amazing. Is the image(frames of the video) converted to ascii text in the
server or on the terminal?

------
ledzep2
It would be awesome if it supports XMPP/SIP. And btw is there a image
previewer for terminal?

~~~
marquis
I recently started looking into building a similar web cam project using
WebRTC, except sending ascii images over the datachannel instead of encoded
video. So, I was pleased to see this project making it happen. You could
easily implement this with XMPP/SIP over WebRTC.

~~~
ledzep2
That's interesting. But if you already have a graphical browser which supports
WebRTC, why do you still need the ascii? Or is there a terminal browser with
WebRTC support?

~~~
marquis
Bandwidth: I'm often in areas where bandwidth is a premium but I'd still like
to video chat with family. And besides, I absolutely hate dropped frames,
rebuffering etc etc: I just want to engage in a conversation with friends and
I don't care that it's HD video. Applications like Skype don't let you drop
the bandwidth (for reasons I don't understand) and dropping it in WebRTC makes
the compression almost unreadable. As this project has shown, ASCII video can
really be quite legible and probably a lot more forgiving for lower frame
rates.

------
rhgraysonii
:( Anyone get the error

"VIDIOC_STREAMON: Invalid argument libv4l2: error turning on stream: Invalid
argument

Can't seem to get it to work trying anything on github etc and want to get
enough around to file a real issue.

~~~
emgram769
We actually got this error as well and had to update to a newer version of
OpenCV. 2.4.10 seemed to fix it

------
dangayle
Wouldn't something like this be easier to encrypt for transmission than normal
video? Plus, in the case it comes up, "that ascii representation doesn't look
anything like me and you can't prove it was me."

I like it.

~~~
jacobparker
Why would it be any easier to encrypt? It's data just the same.

I wouldn't rely on terrible quality video for plausible deniability but if you
want to there are of course many ways to make your webcam feed shitty looking.

~~~
dangayle
Easier in the sense of less data, which would make it faster. One of the
issues with encrypted video chat is that most implementations have a max
amount of people you can chat with because of the computing overhead.

~~~
vidarh
It's only less data because the resolution is low. You'd get exactly the same
result with "normal" video chat by reducing the resolution.

------
aregularguy
This would be awesome with audio. Stream audio over ssh and into a dependency
like mplayer, and you have full a full, terminal chat application!

~~~
bybjorn
It has audio.

------
imcn
Really cool. I like the idea a lot.

------
shitgoose
Very nice!

------
CoryG89
I made something like this once. Doing it in color is pretty awesome though.

------
eridal
great project!!

I remember watching the world cup on an ASCII terminal

:)

------
MyNameIsMK
WOW

------
failed_ideas
That's pretty awesome, now if I can fins a decent terminal browser that
supports javascript and vim keybindings and the equivalent of chromes
devtools, I can spend all of my time in the terminal (save design of course,
but that wouldn't even make any sense). It's probably unreasonable to think
that I'll fin that, but I'll keep looking.

