#!/bin/bash # Optimized pipeline for cameras that already output MJPEG format # Passes through MJPEG data without re-encoding 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 (no re-encoding)..." PIPELINE="multipartmux boundary=\"--videoboundary\" ! souphttpsink port=$PORT" else echo "WARNING: souphttpsink not found. Using tcpserversink (requires HTTP proxy)." echo "Install gst-plugins-good: sudo apt install gstreamer1.0-plugins-good" echo "Or use: ./scripts/mjpeg_http_server.py $PORT 8080" PIPELINE="multipartmux ! tcpserversink host=0.0.0.0 port=$PORT" fi echo "Setting optimized MJPEG passthrough pipeline on port $PORT..." echo "NOTE: This pipeline is optimized for cameras with native MJPEG output." echo "" echo "{\"command\":\"set_pipeline\",\"params\":{\"pipeline\":\"$PIPELINE\"}}" | socat - UNIX-CONNECT:$SOCKET echo "" echo "Pipeline set. Start streaming with start_stream.sh" if gst-inspect-1.0 souphttpsink &>/dev/null; then echo "View stream in browser: http://localhost:$PORT" else echo "Start HTTP proxy first: ./scripts/mjpeg_http_server.py $PORT 8080" echo "Then view stream: http://localhost:8080" fi