#!/bin/bash # HTTP proxy wrapper for MJPEG stream from tcpserversink # This adds proper HTTP headers for browser compatibility TCP_PORT="${1:-8081}" HTTP_PORT="${2:-8080}" echo "Starting MJPEG HTTP proxy..." echo "Listening for TCP stream on port $TCP_PORT" echo "Serving HTTP on port $HTTP_PORT" echo "" echo "Configure vizionStreamer to use tcpserversink on port $TCP_PORT" echo "Then access the stream at: http://localhost:$HTTP_PORT" echo "" # Start socat to wrap TCP stream with HTTP headers socat -v TCP-LISTEN:$HTTP_PORT,reuseaddr,fork \ SYSTEM:"echo 'HTTP/1.1 200 OK'; \ echo 'Content-Type: multipart/x-mixed-replace; boundary=--videoboundary'; \ echo 'Cache-Control: no-cache'; \ echo 'Pragma: no-cache'; \ echo 'Connection: close'; \ echo ''; \ socat - TCP:localhost:$TCP_PORT"