Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FPS fluctuates and drops massively when playing game #1697

Closed
KuroChloe opened this issue Aug 23, 2020 · 8 comments
Closed

FPS fluctuates and drops massively when playing game #1697

KuroChloe opened this issue Aug 23, 2020 · 8 comments

Comments

@KuroChloe
Copy link

Tried using couple of different settings:
Changing renderer, smaller display size, higher bit-rate.
None help and after a while game starts chugging to no end.

Maybe unrelated but in Samsung S9 settings you can selected "USB Controlled by" and it's set to "This device" rather than connected one, is this correct setting or makes no difference?

Could this FPS issue stem from USB port or cable? Maybe if the USB port is not USB3.0 or something?

Clipboard01

@rom1v
Copy link
Collaborator

rom1v commented Aug 23, 2020

Could this FPS issue stem from USB port or cable? Maybe if the USB port is not USB3.0 or something?

No, the fps is determined on the device-side: one frame is encoded every time the device screen changes (so it's inherently variable, if you play a video at 25fps, the mirroring framerate will be 25fps, if your screen does not change, mirroring fps will be 0 fps, etc.)

So if the framerate is too low, it comes from the device, which is not able (or does not need) to render/encode the screen at a higher framerate. Reducing the definition could help (scrcpy -m800), because there is less to render/encode, but it depends.

Also see #798.

@KuroChloe
Copy link
Author

KuroChloe commented Aug 23, 2020

Could this FPS issue stem from USB port or cable? Maybe if the USB port is not USB3.0 or something?

No, the fps is determined on the device-side: one frame is encoded every time the device screen changes (so it's inherently variable, if you play a video at 25fps, the mirroring framerate will be 25fps, if your screen does not change, mirroring fps will be 0 fps, etc.)

So if the framerate is too low, it comes from the device, which is not able (or does not need) to render/encode the screen at a higher framerate. Reducing the definition could help (scrcpy -m800), because there is less to render/encode, but it depends.

Also see #798.

Weird, the gameplay is buttery smooth on the phone screen yet never seems to achieve 60fps on scrcpy.
I also tried changing the phones resolution to the lowest one (1480x720), then running -m800 if it would make it better but alas, after a while the framerate on scrcpy dips.
Almost like it's running out of memory or something, I don't know. Is S9 really that weak it cannot mirror properly, it doesn't get even hot?

@rom1v
Copy link
Collaborator

rom1v commented Aug 23, 2020

Weird, the gameplay is buttery smooth on the phone screen yet never seems to achieve 60fps on scrcpy.

The mirroring framerate may not exceed the screen framerate, but in theory, it is possible that it's lower: the device may not be able to render a 3D game and encode the screen at full rate at the same time.

Anyway, it's a limitation on the device-side (the scrcpy server encodes each frame it receives from MediaCodec and send them to the client).

What if you record (scrcpy --record file.mkv)? You should get the same lag.
What if you record with adb shell screenrecord /sdcard/file.mp4?

@KuroChloe
Copy link
Author

Will try those for troubleshooting, but I'm not trying to record.
Is there anything that I could try to make the performance better, how is it possible that the S9 is overwhelmed no matter which resolution I use?

@rom1v
Copy link
Collaborator

rom1v commented Aug 23, 2020

Does the problem only occur during game? For example, if you mirror while browsing or running simple apps, does it work better?

@KuroChloe
Copy link
Author

Does the problem only occur during game? For example, if you mirror while browsing or running simple apps, does it work better?

Yes, other apps seem to work fine for longer periods.

@milanisop
Copy link

how to change the default fps to 30 or 60
can someone please help me

@rom1v
Copy link
Collaborator

rom1v commented Aug 28, 2020

You can limit the fps with scrcpy --max-fps 30 for example.

If no limit is set, then the encoder produces (if it can) a new frame every time the screen surface changes.

@rom1v rom1v closed this as completed Oct 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants