#!/system/bin/sh # Launched from WebUI. Never runs at boot. RTSP_URL="${RTSP_URL:-rtsp://192.168.1.100:8554/stream}" V4L2_DEVICE="${V4L2_DEVICE:-/dev/video0}" WIDTH=1920; HEIGHT=1080; FPS=30 [ -e "$V4L2_DEVICE" ] || exit 1 if command -v ffmpeg >/dev/null 2>&1; then exec ffmpeg -rtsp_transport tcp -i "$RTSP_URL" \ -f v4l2 -input_format nv21 -video_size "${WIDTH}x${HEIGHT}" \ -framerate "$FPS" -pix_fmt nv21 "$V4L2_DEVICE" elif command -v gst-launch-1.0 >/dev/null 2>&1; then exec gst-launch-1.0 rtspsrc location="$RTSP_URL" latency=0 ! \ rtph264depay ! h264parse ! v4l2h264dec ! v4l2sink device="$V4L2_DEVICE" fi exit 1