Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
108.06k stars 10.42k forks source link

No audio for VR headset (Meta Quest 3) #4354

Open LiveOpenMike opened 10 months ago

LiveOpenMike commented 10 months ago

Environment

Describe the bug Working on an ADB call to feed the video and audio from my VR HMD to my PC for livestreaming.

This is my current script: scrcpy --crop 2064:2208:2064:0 --video-bit-rate=40M -d --disable-screensaver --max-fps 60

Feed comes in fine, but no audio (audio timestamp not found). I ran a Vdebug and got the following:

INFO: Device: [Oculus] oculus Quest 3 (Android 12) DEBUG: Server connected DEBUG: Starting controller thread DEBUG: Starting receiver thread [server] DEBUG: Using audio encoder: 'c2.android.opus.encoder' [server] DEBUG: Using video encoder: 'c2.qti.avc.encoder' INFO: Renderer: direct3d DEBUG: Trilinear filtering disabled (not an OpenGL renderer DEBUG: Using icon (portable): C:\Users\17702\Documents\scrcpy-win64-v2.1.1\icon.png DEBUG: Demuxer 'video': starting thread DEBUG: Demuxer 'audio': starting thread INFO: Texture: 4128x2208 [server] WARN: Could not get any audio timestamp DEBUG: [Audio] Buffer underflow, inserting silence: 240 samples DEBUG: [Audio] Buffer underflow, inserting silence: 240 samples DEBUG: [Audio] Buffer underflow, inserting silence: 240 samples DEBUG: [Audio] Buffer underflow, inserting silence: 240 samples DEBUG: [Audio] Buffer underflow, inserting silence: 10 samples

I tried an audio buffer overflow and got nothing. Switched the codec to AAC and got nothing. What solved it... was plugging headphones into the headset. That simple act sent the audio to my PC (but no sound through the headphones). Trying to understand why this happened and figure out a workaround as I would rather not wear two sets of headphones. Any insight would be appreciated.

Thanks in advance.

rom1v commented 10 months ago

[server] WARN: Could not get any audio timestamp

I had never triggered this warning.

But this is not only a timestamp problem apparently, since you get no sound at all. The audio encoder does not capture any sound, so the Android system does not behave as expected on your device for some reason.

Do you have any earphones connected? (if so, try without)

LiveOpenMike commented 10 months ago

When I plug in headphones, the audio does transfer to my PC. Unplugged it stays native on the device.

On Sat, Oct 14, 2023 at 5:46 PM Romain Vimont @.***> wrote:

[server] WARN: Could not get any audio timestamp

I had never triggered this warning.

But this is not only a timestamp problem apparently, since you get no sound at all. The audio encoder does not capture any sound, so the Android system does not behave as expected on your device for some reason.

Do you have any earphones connected? (if so, try without)

— Reply to this email directly, view it on GitHub https://github.com/Genymobile/scrcpy/issues/4354#issuecomment-1763189129, or unsubscribe https://github.com/notifications/unsubscribe-auth/BDIFGIT3XB7GZ4JWCGJYGOLX7MBZRAVCNFSM6AAAAAA57QGEV2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONRTGE4DSMJSHE . You are receiving this because you authored the thread.Message ID: @.***>

rom1v commented 10 months ago

Probably related to #4083 in some way.

zilewang7 commented 9 months ago

Did you find any solution, I had the same problem.

A01706155 commented 9 months ago

I have the same issue too.

It looks like this is on Meta's side. I've seen some tutorials with Android phones.

Unfortunately, I don't have an Android phone with Android 11 or 12 to test if this is happening only with the Quest 3.

Can someone else help us confirm this issue?

sorryaboutyourcats commented 9 months ago

I had to resort to the Rode's Wireless GO 2s for audio capture and use scrcpy just for the video feed. More info here. Capturing the microphone was possible after switching the source, but that doesn't help us. 😿

Also tested - a 3.5mm splitter out of the headset, with one going to headphones and one going to the Rode [and another test using an aptX device] - scrcpy was able to capture audio but the results were not good.

~3 weeks ago Meta released casting 2.0 via Meta Quest Developer Hub. The added cinematic mode was nice, but the FPS was still too low for me to consider using; hopefully they improve it so we can have a more seamless casting experience. 😸🤞

KerbinThePlanet commented 7 months ago

I have the same problem, connecting headphones sends sound to the computer, but it would be useful to have an option that would play the sound in the headphones at the same time.

fractalzombie commented 1 month ago

+, too have this issue