Real-time ASCII art rendering of your webcam with WebRTC communication and compression.
# Install dependencies and start both signaling server + client
npm run client
# Or run them separately:
npm run server # Starts signaling server on port 8080
npm run dev # Starts Vite dev server on port 5173Then open http://localhost:5173 in two different browsers and use the same room code to connect!
npm run devOpen http://localhost:5173 and choose "Local Demo" to test in a single browser.
npm run client- Start both signaling server and Vite dev server (recommended)npm run server- Start only the WebRTC signaling servernpm run dev- Start only the Vite development servernpm run start- Alias fornpm run clientnpm run build- Build for productionnpm run preview- Preview production buildnpm run video-to-ascii- Convert video files to ASCII art (see scripts/README.md)
- Webcam feed converted to ASCII characters
- Adjustable contrast and frame rate
- Mirror mode support
- Real WebRTC: Connect two different browsers/computers
- Local Demo: Test WebRTC features in single browser
- Room-based connections with shareable codes
- Custom ASCII compression algorithm
- 60-80% data size reduction
- Convert any video file to ASCII art
- Customizable resolution, frame rate, and contrast
- Compressed output for efficient storage
- Standalone HTML player for playback
- Real-time compression statistics
- Optimized for WebRTC transmission
- Real-time text messaging
- Separate ASCII and chat displays
- Message timestamps
- Connection status indicators
Browser A ←→ Signaling Server ←→ Browser B
↓ ↓ ↓
WebRTC Data Channel (direct P2P connection)
// Chat message
{ type: 'chat', content: 'Hello!', timestamp: '...', sender: 'user' }
// ASCII art (compressed)
{ type: 'ascii', content: '8 8.8 ', compressed: true, originalSize: 1024 }Convert any video file to ASCII art and play it back in your browser!
# Convert a video file
npm run video-to-ascii input.mp4 output.txt
# With custom settings
node scripts/video-to-ascii.js input.mp4 output.txt --width 100 --height 75 --fps 15Then open ascii-video-player.html in your browser to play the converted video.
- Any Video Format: Supports all formats that FFmpeg can process
- Customizable Output: Adjust resolution, frame rate, and contrast
- Efficient Compression: Uses LZ-string for optimal file sizes
- Browser Player: Standalone HTML player with full controls
- Responsive Design: Works on desktop and mobile
For detailed documentation, see scripts/README.md.
- Camera Access: Uses
getUserMediaAPI to access webcam - ASCII Conversion: Canvas image data converted to ASCII based on pixel brightness
- Compression: Custom RLE + character mapping algorithm compresses ASCII data
- WebRTC: Direct peer-to-peer transmission via data channels
- Signaling: WebSocket server coordinates initial connection setup
- Frame Extraction: FFmpeg extracts frames at specified resolution/FPS
- Image Processing: Sharp library processes each frame to grayscale
- ASCII Mapping: Pixel brightness mapped to ASCII characters:
.,:;i1tfLCG08@ - Compression: LZ-string compresses the entire ASCII video data
- Playback: HTML player decompresses and displays frames sequentially
Works on browsers supporting getUserMedia and WebRTC APIs:
- Chrome 21+
- Firefox 17+
- Safari 11+
- Edge 79+
├── script/
│ ├── app.js # Local demo version
│ ├── app-real.js # Real WebRTC version
│ ├── webrtc.js # Local WebRTC loopback
│ ├── webrtc-real.js # Real WebRTC with signaling
│ ├── compression.js # ASCII compression algorithm
│ ├── chat.js # Chat functionality
│ ├── camera.js # Camera access and processing
│ └── ascii.js # ASCII conversion logic
├── scripts/
│ ├── video-to-ascii.js # Video to ASCII conversion script
│ └── README.md # Video conversion documentation
├── signaling-server.js # WebSocket signaling server
├── index.html # Version selector page
├── index-real.html # Real WebRTC interface
├── ascii-video-player.html # ASCII video player
└── package.json # Dependencies and scripts
Feel free to submit issues and pull requests!
MIT
