scrcpy icon indicating copy to clipboard operation
scrcpy copied to clipboard

ERROR: Could not open audio device: WASAPI can't initialize audio client: CoInitialize has not been called on Windows 7

Open Falcosoft opened this issue 2 years ago • 6 comments

  • [x] I have read the FAQ.
  • [x] I have searched in existing issues.

Environment

  • OS: Windows 7 x86/x64
  • scrcpy version: 2.0
  • installation method: Windows release
  • device model: Model independent error.
  • Android version: 12

After starting scrcpy-console on Windows 7 x86 or Windows 7 x64 the following error is written to console and the client is closed: ERROR: Could not open audio device: WASAPI can't initialize audio client: CoInitialize has not been called. ERROR: Demuxer error WARN: Killing the server...

It seems to be an SDL2 error. The workaround to use other SDL2 audio driver like winmm or directsound does not work with srccpy since regardless of the buffer size you only get static/garbled audio. The solution could be to add CoInitialize() call to the client.

Falcosoft avatar Mar 16 '23 09:03 Falcosoft

The workaround to use other SDL2 audio driver like winmm or directsound does not work with srccpy since regardless of the buffer size you only get static/garbled audio.

Even with the new option --audio-output-buffer=10 on the dev branch (not to be confused with --audio-buffer=)?

See https://github.com/Genymobile/scrcpy/issues/3793#issuecomment-1465713098

rom1v avatar Mar 16 '23 09:03 rom1v

The workaround to use other SDL2 audio driver like winmm or directsound does not work with srccpy since regardless of the buffer size you only get static/garbled audio.

Even with the new option --audio-output-buffer=10 on the dev branch (not to be confused with --audio-buffer=)?

See #3793 (comment)

Can you provide an x86 Windows binary so I can test it? I cannot test the x64 Windows version on Windows 7 at the moment.

Falcosoft avatar Mar 16 '23 10:03 Falcosoft

Here is a x86 build for the current dev branch:

rom1v avatar Mar 16 '23 10:03 rom1v

Thanks, with this new version of scrcpy.exe the following workaround produces good quality audio (scrcpy-console.bat):

@echo off set SDL_AUDIODRIVER=directsound scrcpy.exe --audio-output-buffer=10

Falcosoft avatar Mar 16 '23 11:03 Falcosoft

Are there any solutions for this "could not open audio device: WASAPI can't initialized audio client " Error ?

Irupc avatar Apr 12 '23 05:04 Irupc

See https://github.com/Genymobile/scrcpy/issues/3856#issuecomment-1482911664

rom1v avatar Apr 12 '23 06:04 rom1v

ERROR: Could not open audio device: WASAPI can't initialize audio client: CoInitialize has not been called.

So it's presumably fixed in SDL 2.28 (see https://github.com/libsdl-org/SDL/issues/7478). SDL 2.28 RC1 has just been released, so let's try (branch sdl_2_27_1).

Please test this version and confirm that the WASAPI issue is fixed (or not):

rom1v avatar Jun 14 '23 11:06 rom1v

Hi, I have tested the new binary and SDL version on Windows 7 x64. There are no more error messages and the audio works perfectly (presumably with WASAPI since I used scrcpy-console.bat from the new zip without any modifications).

Falcosoft avatar Jun 14 '23 15:06 Falcosoft

Awesome, thank you for your test :+1:

rom1v avatar Jun 14 '23 15:06 rom1v

not working on my andriod 13 iqoo z6

vashviS avatar Jun 22 '23 14:06 vashviS

@vashviS What is the full output in the console when you run scrcpy?

rom1v avatar Jun 22 '23 14:06 rom1v

@Falcosoft I didn't ask, but does it still work for you in the final scrcpy v2.1?

rom1v avatar Jun 22 '23 14:06 rom1v

@vashviS What is the full output in the console when you run scrcpy?

scrcpy 2.0 https://github.com/Genymobile/scrcpy C:\Users\vashvi\Downloads\scrcpy-win64-v2.0-92-g7a41cb3e9... file pushed, 0 skipped. 48.7 MB/s (57927 bytes in 0.001s) [server] INFO: Device: vivo I2127 (Android 13) INFO: Renderer: direct3d INFO: Texture: 1080x2408 [server] INFO: newMaxSize = 1920 [server] INFO: Retrying with -m1920... [server] INFO: Retrying... [server] ERROR: Encoding error: java.lang.IllegalArgumentException: null INFO: Texture: 864x1920 INFO: Texture: 1920x864 ERROR: Could not open audio device: WASAPI can't find requested audio endpoint: Element not found. ERROR: Demuxer error WARN: Killing the server... Press any key to continue . . .

vashviS avatar Jun 22 '23 14:06 vashviS

os windows 10 64bit

vashviS avatar Jun 22 '23 14:06 vashviS

ERROR: Could not open audio device: WASAPI can't initialize audio client: CoInitialize has not been called.

So it's presumably fixed in SDL 2.28 (see libsdl-org/SDL#7478). SDL 2.28 RC1 has just been released, so let's try (branch sdl_2_27_1).

Please test this version and confirm that the WASAPI issue is fixed (or not):

did not worked just crashes after 10 sec

vashviS avatar Jun 22 '23 14:06 vashviS

did not worked just crashes after 10 sec

Oh, so initially it worked, but then it failed?

Could you please try with audio only (and on scrcpy v2.1 please):

scrcpy --no-video

rom1v avatar Jun 22 '23 14:06 rom1v

sure

vashviS avatar Jun 22 '23 14:06 vashviS

@vashviS Btw, given the stack trace, it is a different issue as this one. You shoud open a new issue.

rom1v avatar Jun 22 '23 15:06 rom1v

@Falcosoft I didn't ask, but does it still work for you in the final scrcpy v2.1?

Yes, it is also working in the final v2.1.

Falcosoft avatar Jun 24 '23 10:06 Falcosoft