# Getting lag in http service

**URL:** <https://forum.remote.it/t/getting-lag-in-http-service/1017>\
**Category:** Uncategorized\
**Created:** [February 17, 2024, 6:01am UTC](https://forum.remote.it/t/getting-lag-in-http-service/1017 "2024-02-17T06:01:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![umr542](https://avatars.discourse-cdn.com/v4/letter/u/22d042/32.png) [@umr542](https://forum.remote.it/u/umr542)\
**Post date:** [February 17, 2024, 6:01am UTC](https://forum.remote.it/t/getting-lag-in-http-service/1017/1 "2024-02-17T06:01:17Z")

</div>

i am using raspberry pi 4 to make a local video steaming server and accessing it remotely using remoteit but there is a lag in video about 4 to 5 second how can i resolve this lag. On local network there is no lag.

---

<div class="post-metadata">

**Author:** ![bstrech](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.remote.it/bstrech/32/266_2.png) [@bstrech](https://forum.remote.it/u/bstrech)\
**Post date:** [February 20, 2024, 10:05pm UTC](https://forum.remote.it/t/getting-lag-in-http-service/1017/2 "2024-02-20T22:05:47Z")

</div>

There are times where the lag is caused by the latency over the internet itself or server configuration. This can be due to the number of hops from the device itself to the client. Can you explain more about the type of webserver, type of compression used for video streaming, location of the web server and location of the client?

---

<div class="post-metadata">

**Author:** ![umr542](https://avatars.discourse-cdn.com/v4/letter/u/22d042/32.png) [@umr542](https://forum.remote.it/u/umr542)\
**Post date:** [February 21, 2024, 11:49am UTC](https://forum.remote.it/t/getting-lag-in-http-service/1017/3 "2024-02-21T11:49:56Z")

</div>

Simple Mjpeg steam is used for video steaming. Both client and server are connected to my home network.  
this example is used to make Picamera a as local server.

> <https://github.com/raspberrypi/picamera2/blob/main/examples/mjpeg_server.py>

---

<div class="post-metadata">

**Author:** ![mycal](https://avatars.discourse-cdn.com/v4/letter/m/ebca7d/32.png) [@mycal](https://forum.remote.it/u/mycal)\
**Post date:** [February 27, 2024, 6:57pm UTC](https://forum.remote.it/t/getting-lag-in-http-service/1017/4 "2024-02-27T18:57:34Z")

</div>

How are you connecting to your pi/camera? If your connecting via the web portal, then the data has to go to the cloud and back and is going to limit your performance. If your connecting via the desktop then you should get a direct connection on your network which should be fast.

It should be noted that the MJPEG stream is not optimal for remote access, so your going to get some latency on the viewing end. It been my experience with remote viewing of cameras with minimum latency page flipping jpgs with javascript provides optimal latency that adapts for almost any bandwidth.

But viewing remotely most cameras can have 1-10 seconds latency when viewing remotely. Even my professional cameras have this.
