Skip to content

Anulo2/HAProxy-BadApple

Repository files navigation

Bad Apple ASCII Player

Interactive ASCII video player built with HAProxy and Lua. Streams the famous "Bad Apple!!" video as ASCII art through a TCP connection.

Quick Start

  1. Place your video.mp4 file in the project directory
  2. Run with Docker:
    docker-compose up --build
  3. Connect via socat:
    socat - TCP:localhost:8888

Controls

  • Space: Play/Pause
  • R: Restart
  • Q: Quit
  • < / >: Previous/Next frame (when paused)
  • - / +: Adjust playback speed
  • 0: Reset speed to normal

Ports

  • 8080: Web interface with connection instructions
  • 8888: TCP player (main service)
  • 8404: HAProxy stats (admin:badapple123)
  • 8999: Health check

How it works

  1. video_converter.py converts the MP4 to ASCII frames using OpenCV
  2. HAProxy loads the frames via Lua and serves them through a TCP service
  3. Players connect via socat/telnet and receive real-time ASCII video

Local setup (without Docker)

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

Files

  • bad_apple.lua: Main HAProxy Lua service
  • video_converter.py: Converts MP4 to ASCII frames
  • haproxy.cfg: HAProxy configuration
  • docker-compose.yml: Docker setup

Based on HAProxy's interactive Lua capabilities introduced in version 3.2.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published