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

severe lag and low FPS when using scrcpy, #5676

Open
levotus opened this issue Dec 16, 2024 · 6 comments
Open

severe lag and low FPS when using scrcpy, #5676

levotus opened this issue Dec 16, 2024 · 6 comments

Comments

@levotus
Copy link

levotus commented Dec 16, 2024

Environment
OS: Windows 10
Scrcpy version: 3.1
Installation method: Windows release
Device model: Samsung Galaxy S10+ (SM-G975F)
Android version: 12

Hardware and setup:
I am using a USB connection with a high-quality cable.
Tested on USB 3.0 and 2.0 ports.
My PC has a good GPU/CPU, and the drivers are up to date.
I already have others devices, everything work well ( tested on 12 devices) so the issue seems specific to this device, as other phones perform better on the same PC setup.

Describe the bug
I am experiencing severe lag and low FPS when using scrcpy, even with reduced resolution, lower frame rate, and no audio. Despite trying different configurations and encoders, the FPS frequently drops below 10, and the stream is often choppy or freezes entirely.

Commands tested:
****Here are some of the commands I used to troubleshoot:

Using the default encoder:

scrcpy --no-audio --max-fps 20 -m800 --print-fps

Result: Low FPS (~5–15 fps with frame skips).

Testing a software encoder:

scrcpy  --video-codec=h264 --video-encoder=c2.android.avc.encoder --no-audio --max-fps 20 -m800 --print-fps

Result: Similar lag, with FPS dropping below 10 frequently.

Testing a hardware encoder:

scrcpy --video-codec=h264 --video-encoder=OMX.Exynos.AVC.Encoder --no-audio --max-fps 20 -m800 --print-fps

Result: Severe lag with fluctuating FPS (~2–17 fps).

logcat_errors.txt

Additional options:

Tried --render-driver=opengl and --render-driver=vulkan, but no significant improvement.
Added --no-control to reduce input handling overhead.
Reduced bitrate (--bit-rate 2M) and resolution (-m640), but the issue persists.
I provide adb logcat logs for further debugging.

Could you provide insights or suggest other steps to debug this problem?

Thank you soo much for your help

@rom1v
Copy link
Collaborator

rom1v commented Dec 16, 2024

Low FPS (~5–15 fps with frame skips).

Could you post the full output with --print-fps? Is it just a few frame skipped, or most frame skipped?

Is the physical screen broken/unplugged?

If you record (scrcpy -m800 --record=file.mp4), is the resulting video file "laggy"?

There are a lot of errors flooding your logs:

SurfaceFlinger: Attempt to update InputPolicyFlags without permission ACCESS_SURFACE_FLINGER

Possibly related.

Did you try to upgrade your device system (if possible)?

@levotus
Copy link
Author

levotus commented Dec 16, 2024

Could you post the full output with --print-fps? Is it just a few frames skipped, or most frames skipped?

I have attached the output with the --print-fps command. The output shows that only a few frames are skipped, but there are periods where the FPS drops significantly, sometimes to 0 FPS for several seconds.

Is the physical screen broken/unplugged?

Yes, the physical screen of my device is partially broken. A part of the touch functionality and display is still working, but there are some areas that are damaged. Despite this, the screen is still partially functional.

If you record (scrcpy -m800 --record=file.mp4), is the resulting video file "laggy"?

I tested recording using the command scrcpy -m800 --record=file.mp4 and the resulting video file was not laggy at all. The recording played smoothly, with no noticeable issues.

There are a lot of errors flooding your logs: SurfaceFlinger: Attempt to update

InputPolicyFlags without permission ACCESS_SURFACE_FLINGER. Possibly related.
I have seen these errors in the logs. I’m not sure if they are causing the lag, but I wanted to point them out as they appear frequently.

Did you try to upgrade your device system (if possible)?

Yes, my device is up to date. The system is running the latest available update and there are no further updates available at this time.

@rom1v
Copy link
Collaborator

rom1v commented Dec 16, 2024

Yes, the physical screen of my device is partially broken.

Ok, does --turn-screen-off improves the result?

I tested recording using the command scrcpy -m800 --record=file.mp4 and the resulting video file was not laggy at all. The recording played smoothly, with no noticeable issues.

So all the frame are captured correctly, but not provided immediately (due to blocking vsync issues probably since the screen is damaged).

@levotus
Copy link
Author

levotus commented Dec 17, 2024

Ok, does --turn-screen-off improves the result?

Im using Alt+o to turn off my screen , but unfortunately, it doesn't resolve the issue.

@rom1v
Copy link
Collaborator

rom1v commented Dec 17, 2024

OK. The cause is definitely the damaged screen.

On some devices, it has been reported that turning the screen off totally resolved the problem with damaged screen, but on other it had no impact. No luck.

Out of curiosity, does enabling an OpenGL filter change anything? For example, add --angle=10.

@levotus
Copy link
Author

levotus commented Dec 17, 2024

I tested the command with --angle=10 using the following parameters:

scrcpy --max-size 800 --video-bit-rate 1M --no-control --print-fps --angle=10
Here are the results I observed:

INFO: 51 fps (+3 frames skipped)  
INFO: 15 fps  
INFO: 46 fps (+2 frames skipped)  
INFO: 10 fps  
INFO: 45 fps (+1 frames skipped)  
INFO: 21 fps (+2 frames skipped)  
INFO: 2 fps  
INFO: Texture: 800x376  
INFO: 34 fps (+2 frames skipped)  
INFO: 25 fps  
INFO: 5 fps  
INFO: 17 fps  
INFO: 16 fps (+1 frames skipped)  
INFO: 24 fps (+6 frames skipped)  
INFO: 22 fps (+8 frames skipped)  
INFO: 12 fps  
INFO: 1 fps  
INFO: 32 fps (+8 frames skipped)  
INFO: 34 fps (+7 frames skipped)  

I tried also to desactivate control with :

scrcpy --no-control --print-fps

I got this results :

INFO: FPS counter started
INFO: 11 fps
INFO: 10 fps
INFO: 11 fps
INFO: 9 fps
INFO: 11 fps
INFO: 10 fps
INFO: 27 fps
INFO: 24 fps
INFO: 38 fps (+3 frames skipped)
INFO: 32 fps
INFO: 15 fps
INFO: Texture: 1080x2280
INFO: 9 fps (+2 frames skipped)
INFO: 17 fps
INFO: 8 fps
INFO: 17 fps
INFO: 27 fps
INFO: 36 fps
INFO: 44 fps (+1 frames skipped)
INFO: 21 fps (+2 frames skipped)
INFO: 65 fps
INFO: 35 fps
INFO: 25 fps
INFO: 43 fps
INFO: 32 fps
INFO: 24 fps
INFO: 40 fps (+1 frames skipped)
INFO: 66 fps (+4 frames skipped)
INFO: 33 fps
INFO: 38 fps (+4 frames skipped)
INFO: 21 fps (+1 frames skipped)

Thank you for your assistance !!

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

2 participants