Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
105.62k stars 10.25k forks source link

Lossless streaming #3176

Open r0levrai opened 2 years ago

r0levrai commented 2 years ago

Hi,

First of all, thanks for building amazing free software :)

Would it be possible to stream raw or strictly lossless video with scrcpy, assuming I have USB with sufficient bandwidth and a legitimate use case (happy to talk about that if you want)?

rom1v commented 2 years ago

Would it be possible to stream raw or strictly lossless video with scrcpy

You could try encoding using MIMETYPE_VIDEO_RAW instead of AVC: https://github.com/Genymobile/scrcpy/blob/2edc73e4b80d35acc594adef2d35d99e743befed/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java#L225

(of course, you need to adapt everything else)

But I doubt that would work correctly, the bandwidth would be too high everywhere (GPU, RAM, USB…).

r0levrai commented 2 years ago

That's much simpler that what I was thinking of (grabbing directly from the surface with an ImageReader). I'll play with it a bit when I find the time. Thanks a ton!

shvchk commented 11 months ago

@r0levrai any luck with that?

On computer one can use ffmpeg ... -c:v libx264rgb -crf 0 -color_range 2 ... for lossless capture, maybe the same or similar could be done on Android? This should require much less bandwidth.

r0levrai commented 11 months ago

Sadly no, I played with a python module reimplementing the client and some UI and extended it a bit to try for my use case, which was some computer vision and ocr shenanigans. But I didn't have time to try recompiling the server itself.