先开好接收端
socat -u TCP-LISTEN:12345,fork,reuseaddr SYSTEM:"ffplay -autoexit -f wav -"
可以设置低延迟
socat -u TCP-LISTEN:12345,fork,reuseaddr SYSTEM:"stdbuf -o0 ffplay -nodisp -autoexit -fflags nobuffer -flags low_delay -infbuf -af anull -probesize 32 -analyzeduration 0 -f wav -"
@echo off
setlocal enabledelayedexpansionset SERVER_IP=10.85.11.2
set PORT=12345:: 初始化变量
set i=0:parse_args
if "%~1"=="" goto build_done:: 判断是否是目录
if exist "%~1\" (pushd "%~1" >nul 2>nulfor /r %%f in (*) do (set /a i+=1set "arg[!i!]=%%~ff")popd
) else if exist "%~1" (set /a i+=1set "arg[!i!]=%~1"
)shift
goto parse_args:build_done
if %i%==0 (echo No valid files found.pauseexit /b
)
set count=%i%:: 无限随机播放
:loop
set /a randIndex=%random% %% count + 1
call set "filepath=%%arg[!randIndex!]%%"title !filepath!
ffmpeg.exe -re -i "!filepath!" -f wav tcp://%SERVER_IP%:%PORT%
goto loop