#!/bin/bash # Set pipeline for MJPEG HTTP streaming SOCKET="/tmp/vizion_control.sock" PORT="${1:-8080}" # Check if gst-plugins-good with souphttpsink is available if gst-inspect-1.0 souphttpsink &>/dev/null; then echo "Using souphttpsink for HTTP server..." PIPELINE="videoconvert ! jpegenc quality=85 ! multipartmux boundary=\"--videoboundary\" ! souphttpsink port=$PORT" else echo "WARNING: souphttpsink not found. Using tcpserversink (may not work in browsers)." echo "Install gst-plugins-good: sudo apt install gstreamer1.0-plugins-good" PIPELINE="videoconvert ! jpegenc quality=85 ! multipartmux ! tcpserversink host=0.0.0.0 port=$PORT" fi echo "Setting MJPEG HTTP streaming pipeline on port $PORT..." echo "{\"command\":\"set_pipeline\",\"params\":{\"pipeline\":\"$PIPELINE\"}}" | socat - UNIX-CONNECT:$SOCKET echo "" echo "Pipeline set. Start streaming with start_stream.sh" echo "View stream in browser: http://localhost:$PORT"