Comments (12)
love your work
from scrcpy.
The encoder failed. I'm surprised that it does not retry with a lower resolution. Does it only happen with camera capture?
Can you try with -m1024
?
from scrcpy.
Yea
from scrcpy.
sorry I am an Idoit
it works
scrcpy -m 1024 --video-source=camera --no-audio --camera-facing=front \
--v4l2-sink=/dev/video0
scrcpy 2.4 <https://github.com/Genymobile/scrcpy>
INFO: Video orientation is locked for v4l2 sink. See --lock-video-orientation.
INFO: Camera video source: control disabled
INFO: ADB device found:
INFO: --> (usb) Q8JR4DUCLJIRKVPZ device 2201117PI
/usr/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 115.2 MB/s (69007 bytes in 0.001s)
[server] INFO: Device: [Xiaomi] POCO 2201117PI (Android 13)
INFO: Renderer: opengl
INFO: OpenGL version: 4.6 (Compatibility Profile) Mesa 24.0.7-arch1.3
INFO: Trilinear filtering enabled
[server] INFO: Using camera '1'
INFO: v4l2 sink started to device: /dev/video0
INFO: Texture: 960x720
WARN: Killing the server...
from scrcpy.
scrcpy -m 1024 --video-source=camera --no-audio --camera-facing=front --v4l2-sink=/dev/video0
Does it work if you don't pass --no-audio
? Does it work if you don't pass -m 1024
?
It should have retried with a lower resolution automatically.
To investigate, could you please test with this server binary where I added some logs:
scrcpy-server
SHA-256: 7e2f156508386b809abbd47362fef835724e78b8fc8d0911b8f67f9537c651a
And reproduce the error:
export SCRCPY_SERVER_PATH=/path/to/this/scrcpy-server # adapt the path
scrcpy --video-source=camera --camera-facing=front
Then post the console output.
Thank you
diff
diff --git a/server/src/main/java/com/genymobile/scrcpy/SurfaceEncoder.java b/server/src/main/java/com/genymobile/scrcpy/SurfaceEncoder.java
index 28435c098..9d11e86c3 100644
--- a/server/src/main/java/com/genymobile/scrcpy/SurfaceEncoder.java
+++ b/server/src/main/java/com/genymobile/scrcpy/SurfaceEncoder.java
@@ -61,6 +61,7 @@ public class SurfaceEncoder implements AsyncProcessor {
do {
Size size = capture.getSize();
+ Ln.i("==== " + size);
format.setInteger(MediaFormat.KEY_WIDTH, size.getWidth());
format.setInteger(MediaFormat.KEY_HEIGHT, size.getHeight());
@@ -97,6 +98,9 @@ public class SurfaceEncoder implements AsyncProcessor {
}
private boolean prepareRetry(Size currentSize) {
+ Ln.i("==== firstFrameSend=" + firstFrameSent);
+ Ln.i("==== consecutiveErrors=" + consecutiveErrors);
+ Ln.i("==== downsizeOnError=" + downsizeOnError);
if (firstFrameSent) {
++consecutiveErrors;
if (consecutiveErrors >= MAX_CONSECUTIVE_ERRORS) {
@@ -117,12 +121,14 @@ public class SurfaceEncoder implements AsyncProcessor {
// Downsizing on error is only enabled if an encoding failure occurs before the first frame (downsizing later could be surprising)
int newMaxSize = chooseMaxSizeFallback(currentSize);
+ Ln.i("maxSizeFallback index=" + newMaxSize);
if (newMaxSize == 0) {
// Must definitively fail
return false;
}
boolean accepted = capture.setMaxSize(newMaxSize);
+ Ln.i("fallback accepted=" + accepted);
if (!accepted) {
return false;
}
from scrcpy.
scrcpy -m 1024 --video-source=camera --no-video-playback --camera-facing=front \
--v4l2-sink=/dev/video0
scrcpy 2.4 <https://github.com/Genymobile/scrcpy>
INFO: Video orientation is locked for v4l2 sink. See --lock-video-orientation.
INFO: Camera video source: control disabled
INFO: Camera video source: microphone audio source selected
INFO: ADB device found:
INFO: --> (usb) Q8JR4DUCLJIRKVPZ device 2201117PI
/usr/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 72.4 MB/s (69007 bytes in 0.001s)
[server] INFO: Device: [Xiaomi] POCO 2201117PI (Android 13)
[server] INFO: Using camera '1'
INFO: v4l2 sink started to device: /dev/video0
scrcpy --video-source=camera --camera-facing=front \
--v4l2-sink=/dev/video0
scrcpy 2.4 <https://github.com/Genymobile/scrcpy>
INFO: Video orientation is locked for v4l2 sink. See --lock-video-orientation.
INFO: Camera video source: control disabled
INFO: Camera video source: microphone audio source selected
INFO: ADB device found:
INFO: --> (usb) Q8JR4DUCLJIRKVPZ device 2201117PI
/usr/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 63.4 MB/s (69007 bytes in 0.001s)
[server] INFO: Device: [Xiaomi] POCO 2201117PI (Android 13)
INFO: Renderer: opengl
INFO: OpenGL version: 4.6 (Compatibility Profile) Mesa 24.0.7-arch1.3
INFO: Trilinear filtering enabled
[server] INFO: Using camera '1'
INFO: v4l2 sink started to device: /dev/video0
INFO: Texture: 2320x1744
[server] ERROR: Encoding error: java.lang.IllegalArgumentException: null
WARN: Device disconnected
[server] ERROR: Exception on thread Thread[video,5,main]
java.lang.IllegalArgumentException
at android.media.MediaCodec.native_configure(Native Method)
at android.media.MediaCodec.configure(MediaCodec.java:2214)
at android.media.MediaCodec.configure(MediaCodec.java:2130)
at com.genymobile.scrcpy.SurfaceEncoder.streamScreen(SurfaceEncoder.java:69)
at com.genymobile.scrcpy.SurfaceEncoder.lambda$start$0$com-genymobile-scrcpy-SurfaceEncoder(SurfaceEncoder.java:253)
at com.genymobile.scrcpy.SurfaceEncoder$$ExternalSyntheticLambda0.run(Unknown Source:4)
at java.lang.Thread.run(Thread.java:1012)
i dont know how to test server
from scrcpy.
i dont know how to test server
Download the scrcpy-server
binary I linked in #4921 (comment).
Then set an environment variable to force scrcpy to use this specific one (adapt the path):
export SCRCPY_SERVER_PATH=/path/to/this/scrcpy-server
Just after, in the same terminal, execute:
scrcpy --video-source=camera --camera-facing=front
from scrcpy.
from scrcpy.
$ scrcpy --video-source=camera --camera-facing=front
scrcpy 2.4 <https://github.com/Genymobile/scrcpy>
INFO: Camera video source: control disabled
INFO: Camera video source: microphone audio source selected
INFO: ADB device found:
INFO: --> (usb) Q8JR4DUCLJIRKVPZ device 2201117PI
/home/Archer/Desktop/scrcpy-server: 1 file pushed, 0 skipped. 135.3 MB/s (109486 bytes in 0.001s)
[server] INFO: Device: [Xiaomi] POCO 2201117PI (Android 13)
INFO: Renderer: opengl
INFO: OpenGL version: 4.6 (Compatibility Profile) Mesa 24.0.7-arch1.3
INFO: Trilinear filtering enabled
[server] INFO: Using camera '1'
[server] INFO: ==== Size{width=2320, height=1744}
INFO: Texture: 2320x1744
[server] ERROR: Encoding error: java.lang.IllegalArgumentException: null
[server] INFO: ==== firstFrameSend=false
[server] INFO: ==== consecutiveErrors=0
[server] INFO: ==== downsizeOnError=true
[server] INFO: maxSizeFallback index=1920
[server] INFO: fallback accepted=true
[server] INFO: Retrying with -m1920...
[server] INFO: Retrying...
[server] INFO: ==== Size{width=1920, height=1440}
INFO: Texture: 1920x1440
from scrcpy.
Hmm, that's great, but now it retries 🤔
[server] INFO: Retrying with -m1920...
The initial issue was that it did not retry, so I added logs to understand why 😕
Could you reproduce your initial issue (somehow) with this new server binary?
from scrcpy.
scrcpy --video-source=camera --no-audio --camera-facing=front \
--v4l2-sink=/dev/video0
scrcpy 2.4 <https://github.com/Genymobile/scrcpy>
INFO: Video orientation is locked for v4l2 sink. See --lock-video-orientation.
INFO: Camera video source: control disabled
INFO: ADB device found:
INFO: --> (usb) Q8JR4DUCLJIRKVPZ device 2201117PI
/home/Archer/Desktop/scrcpy-server: 1 file pushed, 0 skipped. 162.4 MB/s (109486 bytes in 0.001s)
[server] INFO: Device: [Xiaomi] POCO 2201117PI (Android 13)
INFO: Renderer: opengl
INFO: OpenGL version: 4.6 (Compatibility Profile) Mesa 24.0.7-arch1.3
INFO: Trilinear filtering enabled
[server] INFO: Using camera '1'
[server] INFO: ==== Size{width=2320, height=1744}
INFO: v4l2 sink started to device: /dev/video0
INFO: Texture: 2320x1744
[server] ERROR: Encoding error: java.lang.IllegalArgumentException: null
[server] INFO: ==== firstFrameSend=false
[server] INFO: ==== consecutiveErrors=0
[server] INFO: ==== downsizeOnError=false
WARN: Device disconnected
[server] ERROR: Exception on thread Thread[video,5,main]
java.lang.IllegalArgumentException
at android.media.MediaCodec.native_configure(Native Method)
at android.media.MediaCodec.configure(MediaCodec.java:2214)
at android.media.MediaCodec.configure(MediaCodec.java:2130)
at com.genymobile.scrcpy.SurfaceEncoder.streamScreen(SurfaceEncoder.java:70)
at com.genymobile.scrcpy.SurfaceEncoder.lambda$start$0$com-genymobile-scrcpy-SurfaceEncoder(SurfaceEncoder.java:259)
at com.genymobile.scrcpy.SurfaceEncoder$$ExternalSyntheticLambda0.run(Unknown Source:4)
at java.lang.Thread.run(Thread.java:1012)
from scrcpy.
Oh, ok, thank you very much! I understand now.
When V4L2 sink is set, the "downsize on error" feature is disabled:
Lines 2571 to 2574 in 206809a
from scrcpy.
Related Issues (20)
- show taps is not showing while i touched with scrcpy
- Please help add a frame rate function for non screen projection printing,A command similar to this: scrcpy --print-fps --no-display
- scrcpy not accepting input from keyboard / mouse. HOT 3
- what is the best configuration for minecraft bedrock? HOT 1
- Bug: after OS update, Honor Magic4 pro can't be mirrored with screen turned off using ScrCpy (closes right away), but can be via Android Studio HOT 1
- Different frame rate when i cast my device with the screen off HOT 1
- Unexpected behaviour of `--crop` argument HOT 1
- [Alt Gr] doesn't work with -K parameter HOT 15
- The resolution goes from 1366x768 to 1360x768 HOT 6
- Scrcpy LOCK MOUSE
- Can't scrcpy mirror the screen when the screen displays the password? HOT 4
- Mouse/Keyboard/Audio not working HOT 3
- Audio stopping from smartphone while using scrcpy HOT 2
- Cannot build scrcpy HOT 4
- Not working when installed from winget HOT 3
- Windows 11: Sometimes scrpy doesn't open HOT 4
- The latest version of scrcpy, scrcpy v2.4, cannot play with mobile phone headphones, but with PC HOT 3
- A way to help arrange multiple scrcpy windows
- CreateProcessW() error 5 On Windows10 HOT 1
- HIRE ADWARE RECOVERY SPECIALIST TO SPY WHATSAPP /SMARTPHONE/IPHONE
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scrcpy.