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

A library in scrcpy for clients is wanted #3498

Closed
unique-EJ opened this issue Sep 13, 2022 · 6 comments
Closed

A library in scrcpy for clients is wanted #3498

unique-EJ opened this issue Sep 13, 2022 · 6 comments

Comments

@unique-EJ
Copy link
Contributor

unique-EJ commented Sep 13, 2022

With Python?

@unique-EJ unique-EJ changed the title _ A scrcpy library Sep 13, 2022
@unique-EJ unique-EJ changed the title A scrcpy library A scrcpy library is wanted Sep 13, 2022
@unique-EJ
Copy link
Contributor Author

unique-EJ commented Sep 14, 2022

To be edited (GNU General Public License v3.0) for this?

@unique-EJ
Copy link
Contributor Author

unique-EJ commented Sep 16, 2022

Video output: #2971

#1419 (comment):

Hi,

A quick follow up.

Despite I initially suggested this feature, I'm finally not convinced a --serve argument is a good idea now.

Firstly, it adds complexity:

  • it impacts scrcpy starting
  • it is limited to video, and could possibly constrain what can be done about audio in the future (if there is a real solution, which is not the case for now)

But above all, the same feature (receive the video stream for another app) can now be achieved differently (it was not the case when this PR was created):

  1. on Linux, via V4L2
  2. using scrcpy-server directly

For using scrcpy-server, recent changes (in particular 04e5537 and cabcbc2) facilitate reusing the server for receiving the raw video.

Here is a sample script which starts the server:

adb forward tcp:1234 localabstract:scrcpy
adb push scrcpy-server /data/local/tmp/scrcpy-server.jar
adb shell CLASSPATH=/data/local/tmp/scrcpy-server.jar \
    app_process / com.genymobile.scrcpy.Server 1.21 \
    send_frame_meta=false tunnel_forward=true control=false max_size=1920

From another terminal:

# skip the 69 first bytes (1 zero-byte, 64-bytes device name string, and 4 bytes for the device size)
nc localhost 1234 | tail -c+70 | vlc --demux h264 -

(we could even add a server option to avoid the 69 first bytes, and run directly vlc tcp://localhost:1234)

This will not be real time at all because VLC will add buffering, but this is to illustrate that it is possible to get the raw H.264 stream. Instead of running nc and vlc, you probably use your own client.

Moreover, that way, the client can decide if it wants to receive the "frame meta" in front of each Annex B H.264 packet or not, to avoid an additional 1-frame latency (see #646).

@unique-EJ unique-EJ changed the title A scrcpy library is wanted A library for scrcpy is wanted - not inside its code? Sep 16, 2022
@unique-EJ unique-EJ changed the title A library for scrcpy is wanted - not inside its code? A library for scrcpy is wanted - not inside the client code? Sep 16, 2022
@unique-EJ
Copy link
Contributor Author

Going to make a scrcpy "appLib" with Java - https://gitlab.com/logical-E/scrcpy-E/-/tree/scrcpy-master.

@unique-EJ
Copy link
Contributor Author

unique-EJ commented Jan 6, 2023

Going to make a scrcpy "appLib" with Java - https://gitlab.com/logical-E/scrcpy-E/-/tree/scrcpy-master.

Without Java - not that language, Python. screenCP

@unique-EJ unique-EJ changed the title A library for scrcpy is wanted - not inside the client code? A library for scrcpy clients is wanted Jan 7, 2023
@Tryanks
Copy link

Tryanks commented Feb 9, 2023

There are a lot of third-party implementations of scrcpy clients here, such as qt, python, node, etc. I don't think it's too hard to reimplement a client based on the author's subtle and clean design, such as the Go binding[WIP] I'm trying to make.
Therefore, I'm dubious about the idea of making the project a library.

@unique-EJ
Copy link
Contributor Author

#3728

@unique-EJ unique-EJ closed this as not planned Won't fix, can't repro, duplicate, stale Feb 10, 2023
@unique-EJ unique-EJ changed the title A library for scrcpy clients is wanted A library in scrcpy for clients is wanted Feb 10, 2023
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