Added zerocopy, improved stream robustness and reduced latency

This commit is contained in:
RedNicStone
2026-08-26 11:41:54 +01:00
parent 97ff779911
commit 436808a0d0
22 changed files with 1605 additions and 250 deletions

32
server-test4k.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/usr/bin/env python3
import subprocess, sys
fps = sys.argv[1] if len(sys.argv) > 1 else "60"
size = sys.argv[2] if len(sys.argv) > 2 else "3840x2160"
port = sys.argv[3] if len(sys.argv) > 3 else "5000"
bitrate = sys.argv[4] if len(sys.argv) > 4 else "40M"
cmd = [
"ffmpeg", "-hide_banner", "-v", "error",
"-f", "lavfi", "-i",
f"testsrc2=size={size}:rate={fps}:duration=1000",
"-an",
"-c:v", "libx265",
"-preset", "ultrafast",
"-tune", "zerolatency",
"-pix_fmt", "yuv420p",
"-b:v", bitrate,
"-x265-params", "bframes=0:keyint=30:scenecut=0",
"-f", "rtp",
"-payload_type", "96",
"-sdp_file", "/tmp/gdvapi_test4k.sdp",
f"rtp://127.0.0.1:{port}",
]
print("running:", " ".join(cmd))
try:
subprocess.run(cmd, check=True)
except KeyboardInterrupt:
pass
except subprocess.CalledProcessError as e:
print("ffmpeg exited", e.returncode)
sys.exit(1)