soyersoyer / fmp4streamer

Fmp4streamer streams your V4L2 camera directly to any browser and media player as MP4 (H264).
Apache License 2.0
78 stars 7 forks source link

Latency #2

Closed Vinsub closed 2 years ago

Vinsub commented 2 years ago

Hi, how can i reduce the latency? There Is a buffer config? Thanks

soyersoyer commented 2 years ago

No, there is no buffer config. It doesn't use too much buffers, when a new frame comes from the v4l2, it writes the header and sends the frame immediately. Which client do you use? According to my experiences, firefox has 2 keyframe latency, vlc has 1-2 keyframe latency, chrome/chromium has 2-3 sec latency, safari has 2-3 sec latency. You can set the h264_i_frame_period config parameter to a lower value. The next raspberry kernel has a patch for requesting a keyframe, so the first frame going to be a keyframe in the stream. (https://github.com/raspberrypi/linux/commit/6cfe1a8b600aede17d8af723790eb58592d62f8a) If you have an idea how to reduce latency more, please send to me, or make a PR :)

soyersoyer commented 2 years ago

I added a Latency chapter to README. Feel free to open, if you have any other questions.