barry-ran / QtScrcpy

Android real-time display control software
https://blog.csdn.net/rankun1/article/details/87970523
Apache License 2.0
20.94k stars 2.76k forks source link

希望支持scrcpy中的指定编码器功能 #692

Open BandageWorm opened 2 years ago

BandageWorm commented 2 years ago

某些特殊设备使用默认编码器无法正常使用,可能需要指定 --encoder OMX.google.h264.encoder,希望加上这个选项

Thiasap commented 2 years ago

一样的清空,希望增加选择编码器的选项。 srccpy的issue https://github.com/Genymobile/scrcpy/issues/3051#issuecomment-1056966211 我这边的logcat

10-18 23:53:25.118 14911 14911 E AndroidRuntime: FATAL EXCEPTION: main
10-18 23:53:25.118 14911 14911 E AndroidRuntime: PID: 14911
10-18 23:53:25.118 14911 14911 E AndroidRuntime: java.lang.IllegalStateException
10-18 23:53:25.118 14911 14911 E AndroidRuntime:        at android.media.MediaCodec.native_dequeueOutputBuffer(Native Method)
10-18 23:53:25.118 14911 14911 E AndroidRuntime:        at android.media.MediaCodec.dequeueOutputBuffer(MediaCodec.java:3535)
10-18 23:53:25.118 14911 14911 E AndroidRuntime:        at com.genymobile.scrcpy.ScreenEncoder.encode(ScreenEncoder.java:152)
10-18 23:53:25.118 14911 14911 E AndroidRuntime:        at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:102)
10-18 23:53:25.118 14911 14911 E AndroidRuntime:        at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:74)
10-18 23:53:25.118 14911 14911 E AndroidRuntime:        at com.genymobile.scrcpy.Server.scrcpy(Server.java:101)
10-18 23:53:25.118 14911 14911 E AndroidRuntime:        at com.genymobile.scrcpy.Server.main(Server.java:335)
10-18 23:53:25.118 14911 14911 E AndroidRuntime:        at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
10-18 23:53:25.118 14911 14911 E AndroidRuntime:        at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:355)
10-18 23:53:25.119   678 14949 E MtkOmxVencV4L2: [0x801c0010]     ioctl_set_fmt(): ioctl VIDIOC_S_FMT fail, ret: 16, Device or resource busy
10-18 23:53:25.119   678 14949 E MtkOmxVencV4L2: [0x801c0010]     ioctl_set_fmt(): ioctl VIDIOC_S_FMT fail, ret: 16, Device or resource busy
10-18 23:53:25.119 14911 14911 E scrcpy  : Exception on thread Thread[main,5,main]
10-18 23:53:25.119 14911 14911 E scrcpy  : java.lang.IllegalStateException
10-18 23:53:25.119 14911 14911 E scrcpy  :      at android.media.MediaCodec.native_dequeueOutputBuffer(Native Method)
10-18 23:53:25.119 14911 14911 E scrcpy  :      at android.media.MediaCodec.dequeueOutputBuffer(MediaCodec.java:3535)
10-18 23:53:25.119 14911 14911 E scrcpy  :      at com.genymobile.scrcpy.ScreenEncoder.encode(ScreenEncoder.java:152)
10-18 23:53:25.119 14911 14911 E scrcpy  :      at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:102)
10-18 23:53:25.119 14911 14911 E scrcpy  :      at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:74)
10-18 23:53:25.119 14911 14911 E scrcpy  :      at com.genymobile.scrcpy.Server.scrcpy(Server.java:101)
10-18 23:53:25.119 14911 14911 E scrcpy  :      at com.genymobile.scrcpy.Server.main(Server.java:335)
10-18 23:53:25.119 14911 14911 E scrcpy  :      at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
10-18 23:53:25.119 14911 14911 E scrcpy  :      at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:355)

scrcpy使用 --encoder OMX.google.h264.encoder可以正常使用 设备是redmi note 8 pro ,刷的PE12.1 plus,安卓12

Howard20181 commented 2 years ago

修改 QtScrcpy\config\config.ini 里面的 CodecName 即可

xing2387 commented 4 months ago

修改 QtScrcpy\config\config.ini 里面的 CodecName 即可

我改了不行。

用的香橙派3B。它的硬编不知道是不是有问题。 原版scrcpy列出的解码器有三个。 默认用rk的,不行,会绿屏。 命令行指定其他两个就没问题 scrcpy --video-encoder='c2.android.avc.encoder'。 List of video encoders: --video-codec=h264 --video-encoder='OMX.rk.video_encoder.avc' --video-codec=h264 --video-encoder='c2.android.avc.encoder' --video-codec=h264 --video-encoder='OMX.google.h264.encoder'

QtScrcpy\config\config.ini 里面的 CodecName呢,改了之后还是绿屏。 日志输出的是:

AdbProcessImpl::error:[server] WARN: Unknown server option: encoder_name
AdbProcessImpl::out:[server] INFO: Device: [rockchip] rockchip orangepi3b (Android 11)
server start finish in 0.769s
AdbProcessImpl::out:[server] DEBUG: Using video encoder: 'OMX.rk.video_encoder.avc'
[server] DEBUG: Display: using SurfaceControl API