Interactive ASCII video player built with HAProxy and Lua. Streams the famous "Bad Apple!!" video as ASCII art through a TCP connection.
- Place your
video.mp4
file in the project directory - Run with Docker:
docker-compose up --build
- Connect via socat:
socat - TCP:localhost:8888
- Space: Play/Pause
- R: Restart
- Q: Quit
- < / >: Previous/Next frame (when paused)
- - / +: Adjust playback speed
- 0: Reset speed to normal
- 8080: Web interface with connection instructions
- 8888: TCP player (main service)
- 8404: HAProxy stats (admin:badapple123)
- 8999: Health check
video_converter.py
converts the MP4 to ASCII frames using OpenCV- HAProxy loads the frames via Lua and serves them through a TCP service
- Players connect via socat/telnet and receive real-time ASCII video
Install HAProxy 3.2 with Lua support:
# Ubuntu/Debian
sudo add-apt-repository ppa:vbernat/haproxy-3.2
sudo apt-get update
sudo apt-get install haproxy=3.2.* lua5.4
# Convert video
python3 video_converter.py
# Copy files
sudo cp bad_apple.lua /usr/local/etc/haproxy/
sudo cp frames/bad_apple_frames.lua /usr/local/etc/haproxy/
# Start HAProxy
sudo haproxy -f haproxy.cfg -db
bad_apple.lua
: Main HAProxy Lua servicevideo_converter.py
: Converts MP4 to ASCII frameshaproxy.cfg
: HAProxy configurationdocker-compose.yml
: Docker setup
Based on HAProxy's interactive Lua capabilities introduced in version 3.2.