yangh / sevensquare

Android screencast wroted in QT
214 stars 56 forks source link

the screencast is very slow ? any solutions ? #6

Open ghost opened 8 years ago

ghost commented 8 years ago

the screencast is very slow ? any solutions ?

BetterToAutomateTheWorld commented 8 years ago

Same issue on my phone

The lag is between 4 and 6 seconds

yangh commented 8 years ago

Hi ghost, Darcidride

Could you please tell me what device and resolution of the device you're using?

While the screen is bigger and bigger, and the image captured from device is become bigger and take more time to transfer to PC.

I have no way to fix it, maybe some optimization is possible, such scale down the image before transfer back to host.

BetterToAutomateTheWorld commented 8 years ago

Hi,

In my case :

OnePlus One Resolution : 1920 x 1080

Maybe add an option to choose between quality and performence in an axis can be a good idea.

ak2766 commented 8 years ago

For me, the delay is more than 10 seconds - simply unusable.

Galaxy S6 edge+ 1440 x 2560

migsc commented 8 years ago

Would the framerate improve after following the decompression instructions?

yangh commented 7 years ago

Hi mchat003

Yes, Sure, 25%+~50%+ speed up after using minizip and patched screencap.

noraj commented 7 years ago

I have 1 frame every 3 seconds (0.3 FPS).

$ adb --version                                                                                                                                                                                                   
Android Debug Bridge version 1.0.36
Revision 7.1.1_r13

Phone: Elephone P7000 (Android 5.0)

Resolution:

New view size QSize(320, 562) QSize(-1, -1) 
1493670893469 New scene size: 320 530 
1493670893530 Screencap on device options -q -s false false 
1493670894767 CAP FB in 1237 ms 
1493670894803 New Remote screen FB: 1080 1920 1 
New view size QSize(320, 600) QSize(320, 562) 
1493670894826 New scene size: 319 568 

This is not better with minigzip.

yangh commented 7 years ago

Hi noraj1337

1080x1920x4=8M bytes, It's a huge data block for transfer via USB 2.0.

The better way to minimize the data block is convert the output format from RGBA to RGB565 in 'screencap' command.

Good luck.

yangh commented 7 years ago

Some alternative software doing this by install a APK/Service on android device, for reduce the imaging size also for device control.

BobGraton commented 7 years ago

Hi Yangh, Firstly, thank you very much for this nice piece of work! On a EEEpc the framerate is 1 frame each 3 sec for 2560x1440 and 1.5 sec for 1280x720. On a powerful PC it turns to be 1 frame each second for 1280x720. It's enough to display the content of the Android screen, but not to control the device remotely. You mentioned APK/Service tools or RGB565: can you give us a hint how to improve the speed eventually?

Phantom1212 commented 6 years ago

My problem on Xubuntu 17.10 with Samsung Galaxy J3 2016 remote. can u help me please? screenshot_2018-03-08_13-40-06

vicrobot commented 6 years ago

the same case with me What is the reason for such laggings?

mikemrg17 commented 5 years ago

I have the same problem with my Huawei P20, any solution?

yangh commented 5 years ago

Hi there

The image distortion issue has been fixed in the latest commit 1333e50, which most happened on Android version >= 7.0.

For slow issue, I have some solution in mind, but that depends on some user actions, a strictly depends on userdebug/eng build.

Solutions:

  1. Socket based transfer instead of 'adb shell'

Setup a port forwarding via ADB, then transfer data via the socket over the ADB connection, this may help a bit, current we transfer image data via 'adb shell' command for each frame. socket-based transfer may save some time to start a shell on the remote Android device.

  1. Color space converts before the transfer

For example, RGB565 instead of RGB888, it surely saves 1/3 time for the transfer. but we need to push a customized binary to the device before to do so. And you can guess how many architectures (X86, ARM,...), 32/64 bit, Android version we need to support? it's horrible. I tried to submit a patch (in the contribute directory in source code), but it's not upstreamed.

  1. Compress before transfer, with gzip/minizip

I implemented this option, but it doesn't help on the slow issue, compress/decompress also take time/cpu resource, so it's not a good solution.

  1. UVC, USB video class for image transfer

Requires kernel driver change, and user-space daemon with more depends on the hardware.

Does anyone have more options?

Thanks