Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
108.59k stars 10.45k forks source link

scrcpy video and audio delayed by 1-2 seconds on Monitor #5145

Open Skiptoid opened 1 month ago

Skiptoid commented 1 month ago

Specs: AMD R5 5600g AsRock B550M Pro 4 16gb RAM

Commands used for bat file: scrcpy --video-codec=h264 --display-buffer=10 --audio-buffer=300 --max-fps=60 --mouse=disabled --keyboard=disabled --max-size=2048 --video-bit-rate=8M --audio-codec=opus --audio-bit-rate=256K --audio-output-buffer=10 --no-control

Im having some problems regarding the delays. I was using ver 2.4 last time and used it for a month or so. Until i noticed some stutters on video and audio. Tried troubleshooting it by searching online and was looking at a vid that says i need to update it. Tried doing that and now it has severe stutters on videos and glitchy audio. How to fix this?

rom1v commented 1 month ago

Which one is ahead, audio or video?

In your command, you set a display buffer of 10ms, but an audio buffer of 300ms, so they are expected to be out of sync (but not 1-2 seconds).

Skiptoid commented 1 month ago

Audio is Ahead and totally synced to my Phone. But the video has stutters and delayed display on monitor even if i change it to h264 and google player (forgot the command for it). Even if i use the normal scrcpy.exe, it got the same prob.

rom1v commented 1 month ago

And with a lower resolution? (like scrcpy -m1024)?

Skiptoid commented 1 month ago

Yep retweaked it several times from 1024 to 2048. Tweaked a lot of Video Commands and still got the same issue. Im using Redmi Note 10 Pro 4G phone.

rom1v commented 1 month ago

If you record (add --record=file.mp4), and play the file with VLC, is the recording ok (without stuttering)?

Skiptoid commented 1 month ago

Haven't tried that but let me redownload the files again from the scratch and post a vid here for comparisons.

Skiptoid commented 1 month ago

I was trying to upload the Vids here but it was too big and time consuming to edit. Here's the link instead on my Gdrive. I'll make this public so that others can check the errors. Had some problems with Audio Recording using OBS but audio on my Monitor is good and synced to my Phone.

Normal scrcpy - As you can see on the Video, it has stutters but audio is Synced. Sadly, my OBS didn't picked-up the sound so that i can prove it.

Tweaked .bat file codes - (scrcpy --video-codec=h264 --display-buffer=20 --audio-buffer=200 --max-fps=120 --mouse=disabled --keyboard=disabled -m1024 --video-bit-rate=2M --record=file.mp4) This is perfectly Synced like the scrcpy v2.4.

Do i really need to record the Phone Screen for this to work?

Edit: Even if i use only the code (scrcpy --video-codec=h264 --display-buffer=10 --audio-buffer=200 --max-fps=120 --mouse=disabled --keyboard=disabled --max-size=2048 --video-bit-rate=2M) it has a tiny bit of audio glitch.