android-mjpeg-view icon indicating copy to clipboard operation
android-mjpeg-view copied to clipboard

Bad Framerate

Open eliteSchwein opened this issue 3 years ago • 20 comments

Describe the bug I have only 3 FPS or so

To Reproduce Open a HD 30fps Stream

Expected behavior Run at 30fps

Environment

  • Device: MiMix
  • OS: 11
  • MjpegView version 1.0.9

Additional context

Written in Kotlin but the behavior should be the same in Java

val camViewer: MjpegView = root.findViewById(R.id.webcam_stream) camViewer.mode = MjpegView.MODE_FIT_WIDTH camViewer.setUrl(printerData.getString("webcamurl")) camViewer.isRecycleBitmap = true camViewer.startStream()

eliteSchwein avatar Apr 29 '21 21:04 eliteSchwein

Can you try using this streaming URL https://server.hafka.co/mjpeg and confirm that the issue is still stand?

perthcpe23 avatar May 01 '21 08:05 perthcpe23

lower res helps a bit, but i have a HD stream or FHD Stream

eliteSchwein avatar May 01 '21 12:05 eliteSchwein

Sorry to ask but is it your internet connection speed? I try mentioned URL above and it works fine, I got 30 fps (judging by eyes).

perthcpe23 avatar May 01 '21 14:05 perthcpe23

i have 160mbit, the mjpeg is smooth in browser but not app, i tried it with 640*480 aswell...

eliteSchwein avatar May 01 '21 14:05 eliteSchwein

Is your streaming server publicly accessible? I tried mentioned URL and it works fine on my Sony 5 II. There are too many factors to start discuss one-by-one here. I guess it may have something to do with streaming content your server generates which is supported by browser but, not this library (yet).

perthcpe23 avatar May 01 '21 16:05 perthcpe23

i use a local url, with webview it works fine

eliteSchwein avatar May 01 '21 17:05 eliteSchwein

So, a connection speed is less likely an issue here. Can you run this command for a few seconds and send me dump.bin file? I suspect the issue is with stream content.

curl --output dump.bin "<YOUR-MJPEG-URL>"

perthcpe23 avatar May 01 '21 17:05 perthcpe23

https://files.eliteschw31n.de/Temp/dump.bin

eliteSchwein avatar May 01 '21 17:05 eliteSchwein

with https://server.hafka.co/mjpeg/ it runs smooth, but again thats low res

eliteSchwein avatar May 01 '21 20:05 eliteSchwein

I see. Let me try FHD version of https://server.hafka.co/mjpeg/. I have never worked with FHD mjpeg.

perthcpe23 avatar May 01 '21 20:05 perthcpe23

i use also 25mbit

eliteSchwein avatar May 01 '21 20:05 eliteSchwein

I changed https://server.hafka.co/mjpeg/ to FHD and fps indeed drops. Now that I can reproduce the issue, I will continue investigating the issue.

perthcpe23 avatar May 01 '21 22:05 perthcpe23

Yeah i can short your search, its drawBitmap... I tried it with opengl because of that but i domt understand how i can use opengl, maybe it helps you?

eliteSchwein avatar May 01 '21 22:05 eliteSchwein

Thanks, wow that is a whole new level of rendering.

perthcpe23 avatar May 01 '21 23:05 perthcpe23

Reduce video quality did help https://server.hafka.co/mjpeg?type=fhd_low_quality compare to original quality https://server.hafka.co/mjpeg?type=fhd_hi_quality.

perthcpe23 avatar May 02 '21 08:05 perthcpe23

On what Bitrate? And also i dont play just a mjpeg file, i have a live stream

eliteSchwein avatar May 02 '21 11:05 eliteSchwein

Yes Bitrate. If you have control over streaming server. I think that is a plausible workaround.

perthcpe23 avatar May 02 '21 11:05 perthcpe23

Yeah i have the access over the bitrate, but other people that use my app maybe dont know how to change that on their live stream

eliteSchwein avatar May 02 '21 11:05 eliteSchwein

I think the issue is with how I separate each image from stream using only boundary, instead of using content length and boundary together. The more bytes in each image (higher quality) the more number of time to check for boundary and the longer each checking took. I'm going to try using content length see if it help.

perthcpe23 avatar May 03 '21 08:05 perthcpe23

Hello. Any news on this?

tykling avatar May 03 '22 14:05 tykling