Przeglądaj źródła

refactor(push_stream_anpviz.sh): optimize ffmpeg parameters for video streaming

- Updated ffmpeg command to remove audio stream and adjust video encoding settings.
- Set video resolution to 1280x720 and frame rate to 25 fps for improved performance.
- Removed Bearer Token as WHIP URL now includes authentication key, simplifying the script.
yb 1 tydzień temu
rodzic
commit
1a103d17ab
1 zmienionych plików z 13 dodań i 12 usunięć
  1. 13 12
      go_stream/push_stream_anpviz.sh

+ 13 - 12
go_stream/push_stream_anpviz.sh

@@ -7,21 +7,22 @@
 # RTSP 路径: /Streaming/Channels/101
 
 RTSP_URL="rtsp://admin:123456@192.168.0.96:554/Streaming/Channels/101"
+# WHIP URL 已包含认证密钥,无需额外 Bearer Token
 WHIP_URL="https://customer-pj89kn2ke2tcuh19.cloudflarestream.com/8c108b4025d3278b188b443e8a6c5503kb51e49994b6fd9e56b6f1fdfcd339fe6/webRTC/publish"
-BEARER_TOKEN="ZrpMoQ15dCCe6rX0pKINzcb0eNdakSih-TmQrbq-"
 
+# 注意: ffmpeg WHIP muxer 目前不支持同时发送音视频 (SDP mid 冲突)
+# 暂时只发送视频流
 /usr/local/ffmpeg-whip/bin/ffmpeg \
     -rtsp_transport tcp \
     -i "$RTSP_URL" \
-    -map 0:v:0 -map "0:a?" \
+    -map 0:v:0 \
     -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"
+    -profile:v baseline -level 3.1 -pix_fmt yuv420p \
+    -preset veryfast -tune zerolatency \
+    -vf "scale=1280:720" \
+    -r 25 \
+    -g 25 -keyint_min 25 \
+    -b:v 2000k -maxrate 2000k -bufsize 4000k \
+    -an \
+    -f whip \
+    "$WHIP_URL"