Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
105.59k stars 10.24k forks source link

Latency only when including audio. #4671

Open Ufinexa opened 4 months ago

Ufinexa commented 4 months ago

Environment

Describing the bug

I seem to be having latency issues when screen mirroring my device with audio being forwarded. I tried an older version of scrcpy without that functionality and it ran flawlessly with no frame drops. I am running this using Wireless ADB as I always have, I have updated graphics drivers just today incase it might have been a situation with this but it wasn't. I also did have this functioning on a Windows 11 installation just fine previously, I downgraded back to 10 and I have not been able to get it to work properly since.

Below is my FPS when playing back a video on the phone, for this I just used TikTok.

INFO: ADB device found:
INFO:     --> (tcpip)     192.168.0.48:5555            device  Pixel_6_Pro
file pushed, 0 skipped. 107.5 MB/s (66411 bytes in 0.001s)
[server] INFO: Device: [Google] google Pixel 6 Pro (Android 14)
INFO: Renderer: direct3d
INFO: Texture: 1440x3120
INFO: FPS counter started
INFO: 34 fps
INFO: 34 fps
INFO: 28 fps
INFO: 36 fps
INFO: 36 fps
INFO: 31 fps
INFO: 35 fps
INFO: 26 fps
INFO: 36 fps
INFO: 34 fps
INFO: 36 fps
INFO: 34 fps
INFO: 30 fps
INFO: 32 fps
INFO: 33 fps
INFO: 34 fps
INFO: 31 fps
INFO: 34 fps
INFO: 31 fps
INFO: 37 fps

These frame skips happen very quickly and constantly with no real clear lag free space between.

I tried also recording a video to see how that would go, I played back the video and there was no audio to it? Just video and it was a perfect framerate with no jumps or skips, I have no idea why the audio didn't get included as I used "scrcpy --record=file.mp4" correctly making sure the command includes both as mentioned in documentation.

rom1v commented 4 months ago

I tried an older version of scrcpy without that functionality and it ran flawlessly with no frame drops.

These frame skips happen very quickly and constantly with no real clear lag free space between.

I see no frame skip in your logs. I guess it's just your network (wifi packets are lost and retransmitted, causing some lag). Try over USB.

I have no idea why the audio didn't get included as I used "scrcpy --record=file.mp4" correctly making sure the command includes both as mentioned in documentation.

By default, the audio codec is opus, maybe your media player does not support it. Try with VLC or even Firefox.