Files
2026-03-28 02:39:29 -05:00

31 lines
1.2 KiB
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# 从本机 SRS 拉 SRT 流并用 ffplay 全屏输出到 HDMI需已登录图形会话X11 或 Wayland 下 XWayland
# 注意:下方端口为 SRS 的 SRT 端口(常见 10080与 Web 控制台端口(见 config/runtime.env无关。
set -euo pipefail
# SRS SRT 播放地址(与 srs 里 app/stream 名一致时可只改此项)
: "${SRS_SRT_URL:=srt://127.0.0.1:10080?streamid=#!::r=live/livestream,m=request&latency=10}"
# X11常见为 :0开发板/工控机本地桌面)
if [[ -z "${DISPLAY:-}" ]]; then
export DISPLAY="${DISPLAY:-:0}"
fi
# 部分 ARM 板卡仅支持 OpenGL ES可尝试export FFPLAY_SDL_DRIVER=opengles2
if [[ -n "${FFPLAY_SDL_DRIVER:-}" ]]; then
export SDL_VIDEODRIVER="${FFPLAY_SDL_DRIVER}"
fi
# 纯 DRM/KMS 无 X 时不能用本脚本;请改用 ffmpeg 直送 drm 或 kmsgrab见 README 说明)
if ! command -v ffplay >/dev/null 2>&1; then
echo "ffplay 未找到,请安装 ffmpeg含 ffplay。" >&2
exit 1
fi
# 需要额外参数时可在本行自行追加,例如:-window_title hdmi
exec ffplay -nostats -hide_banner \
-fflags nobuffer -flags low_delay -framedrop \
-probesize 32 -analyzeduration 0 -sync ext -infbuf \
-vf "setpts=PTS-STARTPTS" \
"$SRS_SRT_URL"