Files
OpenIPC_RTL8812AU_Forword_cpp/tools/play-udp.sh
T
2026-09-13 13:30:21 +08:00

18 lines
784 B
Bash

#!/usr/bin/env bash
# 低延迟播放:从 UDP/RTP 直推端口拉流并显示(Linux 接收端)。
# 用法: ./play-udp.sh <端口> [h265|h264] 默认 h265
set -e
PORT="${1:?用法: ./play-udp.sh <端口> [h265|h264]}"
CODEC="${2:-h265}"
if [ "$CODEC" = "h264" ]; then
CAPS="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264"
DEPAY=rtph264depay; DEC=avdec_h264
else
CAPS="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H265"
DEPAY=rtph265depay; DEC=avdec_h265
fi
echo "== 低延迟播放 UDP:$PORT ($CODEC) Ctrl-C 退出 =="
exec gst-launch-1.0 udpsrc port="$PORT" caps="$CAPS" \
! "$DEPAY" ! "$DEC" \
! fpsdisplaysink video-sink=autovideosink text-overlay=false sync=false