scrcpy icon indicating copy to clipboard operation
scrcpy copied to clipboard

Incorrect color representation of Samsung J7 2017

Open pzmarzly opened this issue 6 years ago • 5 comments

Happens both over WiFi and USB.

Running commands from #177:

adb shell screenrecord /sdcard/test.mp4
adb pull /sdcard/test.mp4

results in correct video.

Broken commands:

scrcpy -b10K -m360
scrcpy -b2M -m600
scrcpy
adb shell screenrecord --output-format=h264 - | ffplay -

The video is ultra-smooth, but it looks as if everything below some level of luminosity is interpreted as gray:

Here is screenshot of Samsung Settings: screenshot_20190112-191611

Here is screenshot of scrcpy: screenshot from 2019-01-12 18-57-21

Android 7.0 (stock, but installed custom kernel) Samsung Experience 8.1 Kernel 3.18.14-Refined_Kernel-v2.8-Stable-J730F-G (custom kernel) Model SM-J730F

pzmarzly avatar Jan 12 '19 18:01 pzmarzly

Thank you for your report.

Could you test with a forced full/limited color range, please?

diff --git a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java
index 0419dc5..83dc606 100644
--- a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java
+++ b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java
@@ -145,6 +145,7 @@ public class ScreenEncoder implements Device.RotationListener {
         format.setInteger(MediaFormat.KEY_FRAME_RATE, frameRate);
         format.setInteger(MediaFormat.KEY_COLOR_FORMAT, MediaCodecInfo.CodecCapabilities.COLOR_FormatSurface);
         format.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, iFrameInterval);
+        format.setInteger(MediaFormat.KEY_COLOR_RANGE, MediaFormat.COLOR_RANGE_FULL);
         // display the very first frame, and recover from bad quality when no new frames
         format.setLong(MediaFormat.KEY_REPEAT_PREVIOUS_FRAME_AFTER, MICROSECONDS_IN_ONE_SECOND * REPEAT_FRAME_DELAY / frameRate); // µs
         return format;

or

diff --git a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java
index 0419dc5..f9949cb 100644
--- a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java
+++ b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java
@@ -145,6 +145,7 @@ public class ScreenEncoder implements Device.RotationListener {
         format.setInteger(MediaFormat.KEY_FRAME_RATE, frameRate);
         format.setInteger(MediaFormat.KEY_COLOR_FORMAT, MediaCodecInfo.CodecCapabilities.COLOR_FormatSurface);
         format.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, iFrameInterval);
+        format.setInteger(MediaFormat.KEY_COLOR_RANGE, MediaFormat.COLOR_RANGE_LIMITED);
         // display the very first frame, and recover from bad quality when no new frames
         format.setLong(MediaFormat.KEY_REPEAT_PREVIOUS_FRAME_AFTER, MICROSECONDS_IN_ONE_SECOND * REPEAT_FRAME_DELAY / frameRate); // µs
         return format;

rom1v avatar Jan 13 '19 00:01 rom1v

Sorry for not replying for a week. Could you send me a binary with this patch? I've spent last hour dealing with Java, Android SDK (which doesn't work OOB with Java 10, as it turns out) and I still cannot get ninja to see I did accept all the licenses I could find...

pzmarzly avatar Jan 20 '19 18:01 pzmarzly

@pzmarzly: v1.6 + patch: scrcpy-server.jar SHA256: 81b7215f4ed3cb031b656745b28518be1a755a0df3774f9626f02250f042e920

rom1v avatar Jan 20 '19 21:01 rom1v

Sadly, nothing changed. I also tried changing resolution, setting Display mode to Basic, turning blue light filter on and off, changing screen brightness etc. If it helps, this app works, but it uses Android screen sharing API.

I'm not sure if seeing this in log is normal:

~/scrcpy on 446c682 $ ./run x -b2M
x/server/scrcpy-server.jar: 1 file pushed. 1.2 MB/s (19350 bytes in 0.015s)
error: more than one device/emulator
ERROR: "adb reverse" returned with value 1
WARN: 'adb reverse' failed, fallback to 'adb forward'
INFO: Initial texture: 1080x1920
~/scrcpy on 446c682 $ adb devices
List of devices attached
192.168.254.102:5555	device

~/scrcpy on 446c682 $

pzmarzly avatar Jan 20 '19 21:01 pzmarzly

@rom1v Can we test that via cli? All my devices (samsung) and emulator show different color than real, thought it was a samsung thing, but I scrcpy to my android emulator (copy/paste works better). and the color is less saturated

filipef101 avatar Jun 02 '25 16:06 filipef101