Answer the question
In order to leave comments, you need to log in
How to lower the latency of h.264 video in FFMPEG without resorting to zerolatency?
The ffmpeg wiki says :
You may be able to decrease initial "startup" latency by specifing that I-frames come "more frequently" (or basically always, in the case of x264 's zerolatency setting), though this can increase frame size and decrease quality, see here for some more background. Basically for typical x264 streams, it inserts an I-frame every 250 frames. This means that new clients that connect to the stream may have to wait up to 250 frames before they can start receiving the stream (or start with old data). So increasing I-frame frequency (makes the stream larger, but might decrease latency).
Answer the question
In order to leave comments, you need to log in
In general, the delay in zerolatency means the difference between when the frame came to the input of the encoder and when it gave it away. The delay may be caused by the decoder buffering a number of frames. As far as I remember, the default is 40.
Without buffering, it will not be possible to encode B-frames. Also, by analyzing frames from the future, the encoder more accurately distributes the bitrate between frames. The number of buffered frames is controlled by the rc_lookahead parameter.
The number of B-frames used by default is 3, so it is worth reducing their number or turning it off if necessary in a very small delay.
I also advise you to take a closer look at other parameters that are set via --tune zerolatency:
- zerolatency:
--bframes 0 --force-cfr --no-mbtree
--sync-lookahead 0 --sliced-threads
--rc-lookahead 0
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question