mylisabox / flutter_mjpeg

Flutter widget to show mjpeg stream from URL
BSD 2-Clause "Simplified" License
30 stars 23 forks source link

Frames look jaggy #38

Open ThomasVuNguyen opened 7 months ago

ThomasVuNguyen commented 7 months ago

I dont think the frame rate matches my camera stream. Is there a way to designate frame rate?

cybrox commented 7 months ago

There's no way to designate frame rate in this library.

MJPEG works by opening an HTTP connection to the server, which will be kept open by the server while it sends JPEGs separated by a delimiter string.

The rate at which new images are sent depends entirely on the server. This library simply redraws the image every time a new one has been received. Some devices allow you to pass a query parameter like ?fps=10 in the MJPEG URL but that's specific to your streaming server.

The best you can do is compare the MJPEG stream in Flutter to an MJPEG stream in your browser and see if they are similar. If not, it's most likely the network connection between your mobile device and the server that slows things down.

Since MJPEG is not aware of similarities between images and does not support any form of delta-compressing, every frame is a full JPEG image, which results in very high bandwidth. So it's not uncommon to run into issues especially on wireless networks when using somewhat high resolution (Full-HD and above) or somewhat high framerate (20 and above)