scrcpy
scrcpy copied to clipboard
A library for scrcpy is wanted - not inside the client code?
-
Ideally, I'd like scrcpy to be exposed as a library, and develop an alternative UI, which would expose the list of devices. But that requires a lot of work, that I cannot do on my free time.
Originally posted by @rom1v in https://github.com/Genymobile/scrcpy/issues/3418#issuecomment-1207216903:
-
https://github.com/Genymobile/scrcpy/pull/2595
-
#1355
To be edited (GNU General Public License v3.0) for this?
-
.github/workflows/continuous.yml:62
export GUISCRCPY_VERSION="$(git describe --tags --always --match 'v*.*').dev" export GUISCRCPY_GLIB_VERSION="glibc$(ldd --version | grep 'ldd ' | grep -o ').[0-9].[0-9][0-9]' | grep -o '[0-9].[0-9][0-9]')" export GUISCRCPY_MACHINE="$(uname -m)" export GUISCRCPY_TYPE="r"
-
scripts/build-appimage.sh, then
_build/guiscrcpy- ... --appimage-help
- extract? -
https://github.com/srevinsaju/guiscrcpy/blob/bb2bf8e2cf998fc4403b995fd993b175663dfec3/guiscrcpy/lib
-
https://github.com/srevinsaju/scrcpy-appimage , https://github.com/srevinsaju/scrcpy-appimage/blob/f6de0c48bdbc1035e05f286f1c6d19f8010f496b/.github/workflows/continuous.yml
Video output: https://github.com/Genymobile/scrcpy/pull/2971
https://github.com/Genymobile/scrcpy/pull/1419#issuecomment-1013964650:
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):
- on Linux, via V4L2
- 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
andvlc
, 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).
Going to make a scrcpy "appLib
" with Java - https://gitlab.com/logical-E/scrcpy-E/-/tree/scrcpy-master.
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
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.
#3728