Hello fellow video codec enthousiasts,

I'm curenntly working on a little system to play games in my living room using my office's computer. I'm trying to stream my screen through UDP with the lowest latency possible using ffmpeg. Right now my commands look like this :


ffmpeg -s 1920x1080 -f x11grab  -i :0.0+0,0  -preset ultrafast -tune zero_latency -f mpegts udp://{CLIENT_IP}:8000


ffplay -fflags nobuffer -flags low_delay -probesize 20000 -analyzeduration 1 -strict experimental -framedrop -f mpegts udp://{SERVER_IP}:8000

While my video quality on the recieving side is on point (actually I'd like to use a different muxer since mpegts is kinda ugly), I get a full second of delay right now.

The weird thing is, if I reduce the bitrate on the server side, the delay stays the same.

Would you know of a way to reduce it?


1 Answer 1


For streaming mpegts with minimum latency, there is one more "secret argument":

`-omit_video_pes_length 0`

The default is -omit_video_pes_length 1, and omitting the length adds a latency of one more frame.

ffmpeg -s 1920x1080 -f x11grab -i :0.0+0,0 -preset ultrafast -tune zero_latency -f mpegts -omit_video_pes_length 1 udp://{CLIENT_IP}:8000

For getting minimal latency with FFplay, use -flags low_delay, -probesize 32 and -vf setpts=0 as described here.

ffplay -fflags nobuffer -flags low_delay -probesize 32 -analyzeduration 1 -strict experimental -framedrop -f mpegts -vf setpts=0 udp://{SERVER_IP}:8000

Reducing the bitrate may affect the latency only when the communication bandwidth is near full capacity (below some bitrate, the effect is negligible).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .