#!/bin/bash # CT-IP500 摄像头推流到 Cloudflare Stream (WHIP 协议) # 摄像头 IP: 192.168.0.100 # 账号: admin / admin # 编码: H.264 (640x480) # RTSP 路径: /cam/realmonitor?channel=1&subtype=0 (大华风格) RTSP_URL="rtsp://admin:admin@192.168.0.100:554/cam/realmonitor?channel=1&subtype=0" WHIP_URL="https://customer-pj89kn2ke2tcuh19.cloudflarestream.com/8c108b4025d3278b188b443e8a6c5503kb51e49994b6fd9e56b6f1fdfcd339fe6/webRTC/publish" BEARER_TOKEN="ZrpMoQ15dCCe6rX0pKINzcb0eNdakSih-TmQrbq-" /usr/local/ffmpeg-whip/bin/ffmpeg \ -rtsp_transport tcp \ -i "$RTSP_URL" \ -map 0:v:0 -map "0:a?" \ -c:v libx264 \ -preset veryfast \ -tune zerolatency \ -profile:v baseline \ -level 3.1 \ -pix_fmt yuv420p \ -g 30 -keyint_min 30 \ -b:v 2500k -maxrate 2500k -bufsize 5000k \ -c:a opus -strict -2 -ar 48000 -b:a 128k \ -f whip "$WHIP_URL" \ -headers "Authorization: Bearer $BEARER_TOKEN"