mylisabox / flutter_mjpeg

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

framerate #5

Closed taf2 closed 4 years ago

taf2 commented 4 years ago

It seems like the frame rate is very slow on iOS - like maybe 1 frame per 10 seconds or 1 frame per 20 seconds. Any ideas on how to improve that?

 children: <Widget>[
            Expanded(
              child: Center(
                child: Mjpeg(
                  isLive: true,
                  stream: 'http://192.168.2.57/stream.mjpg'
                ),
              ),
            ),
          ],
jaumard commented 4 years ago

No, the only thing that can change the frame rate is the network speed. The package doesn't do much itself except recreate the images. Maybe you can improve the frame rate by lowering the resolution of the stream.

taf2 commented 4 years ago

Thanks! Yeah it's interesting connecting over the web browser on the same network it's nearly realtime but over the flutter app it's very slow... I've lowered the frame rate and resolution will continue to experiment :)

jaumard commented 4 years ago

also you need to try your flutter app on production mode and not debug mode as it really slow for debug

taf2 commented 4 years ago

Ah - I bet it's debug mode!

dubbelpunt commented 4 years ago

Hi, I have a similar frame rate problem when I put the stream behind a reverse proxy from nginx. Example: http://ip_ipcam/videostream.cgi ==> works perfect.

http://ip_server/ipcam1 nginx conf on ip_server: location /ipcam1 { proxy_pass http://ip_ipcam/videostream.cgi } This works very slow, frame rate like taf2 commented. Via a browser, it works as expected, without interruptions.

Are you familiar with this issue? Any ideas?

jaumard commented 4 years ago

No I never used it behind a reverse proxy, but from the package point of view it shouldn't change anything as data is totally the same...

dubbelpunt commented 4 years ago

OK, maybe a dart bug? I will create a topic there. Thanks!

dubbelpunt commented 4 years ago

After further investigation, I noticed that it is an Nginx reverse proxy issue. With an Apache reverse proxy it worked perfect.

jaumard commented 4 years ago

Good to know ! Thanks for the follow up :)