Open sorryaboutyourcats opened 1 year ago
Basically, it's due to network jitter/packet loss.
If a TCP network packet is delayed or lost, it is retransmitted (this adds latency and delays every following packets). In that case, the scrcpy client has to wait to receive a new frame, causing a stutter, then it typically receives a burst of frames at once, so it renders them as fast as possible (skipping some if it decodes fast enough, to always render the very last one).
If you add a --display-buffer
(as you tested), this may absorb the jitter and avoid the problem.
This does not happen when recording with --record=
, because recording is not impacted by network jitter: the packets are captured and timestamped on the device, even if they are transmitted irregularly, they are muxed with their original timestamps.
Thank you for replying back so quickly! π»
I did more testing over USB 3 and ended up seeing a similar issue [it stutters at times instead of skips].
Video here. First part has OBS recording on left, SCRCPY recording on right. Second part starting at 0:33 has phone recording with no OBS active.
scrcpy -b 16M --crop 2064:2208:2064:0 --no-audio --print-fps --max-fps 90
I have yet to try SCRCPY on my phone, or a different USB port, but may have to test those as well. π Or I may have to research what settings & hardware others are using to capture with their Quest 3. π€
OK, it may not be only wireless lag, but also some encoder lag, decoder lag, computer lag⦠Some frame arrive too late, so it stutters, but this does not impact recording.
Ah yes, recording through scrcpy is fine, but I'd be using this for streaming to Twitch [sorry for not elaborating that part πΉ]. I could use the built-in casting on the Quest 3 which doesn't skip, but my god the FPS are so low that it's painful to watch. π«
I don't mind upgrading my system in order to reduce lag if that'll help - main system is a Ryzen 9 5900X with a 3090.
If you reduce the frame rate (from 90 to 60 for example) and the resolution, it might limit the stuttering (it would less likely cause a system lag).
Also, capturing the window via OBS might cause stuttering too (there are some common graphical resources that must be shared).
If you're on Linux, you should try exposing the video stream via v4l2 that you could capture directly within OBS (without window).
I actually recorded a 60 fps test last night! It's like your in my mind. πΉ Just uploaded it here. The video does jump between buttery smooth and choppy though. πΏ This was over Wi-Fi.
This was used:
scrcpy -b 16M --crop 2064:2208:2064:0 --no-audio --print-fps --max-fps 60 --max-size 1080 --display-buffer 100
The skips happen regardless of OBS being used as the second part of the two videos I sent prior have me recording it from my phone, with my system fully dedicated to scrcpy. all hail scrcpy π.
Is there stuttering with --display-buffer=500
, or even --display-buffer=1000
?
No skipping with 1000ms buffer, however the choppiness still goes in and out.
OBS taking over GPU/CPU resources does make sense for the bouts of chop, so I recorded the feed from another computer as well [via capture card, not anything network related like NDI], though the choppiness remained. πΏ
Footage here. Shorter video this time [and I do appreciate your help with this! π] First two parts recorded on main system, next two parts recorded from another system.
I was able to resolve that choppy-feed issue by removing the FPS limiter. Sure it still skips every now and then even with a 500ms buffer, but it's way smoother overall. #nomorechop
scrcpy -b 16M --crop 2064:2208:2064:0 --print-fps --no-audio --display-buffer 500
And for anyone else trying to stream native Quest 3 [not PCVR] games, use a Rode's Wireless GO II for audio. πΈπ [In OBS, make sure sync offset is at 500ms for audio feed.]
@sorryaboutyourcats out of interest, how are you capturing the OBS feed on the left side of your video? I've been looking for a similar solution myself.
Cheers.
@KptnKMan Here's a brief version of my set up so far:
echo mode 28,12 echo adb devices echo echo TCP IP port to 5555 adb -d tcpip 5555 adb connect 192.168.1.193:5555 echo echo Bye bye USB pause scrcpy -b 16M --crop 2064:2208:2064:0 --print-fps --no-audio --display-buffer 500 --max-size 1080
https://obsproject.com/forum/resources/obs-shaderfilter.1736/
I was unable to get audio working correctly with scrcpy on the Quest 3 [at least as of a few weeks ago] so I opted to use the Rode Wireless Go IIs. Keep in mind they are mono each, so you'd need both of them with a splitter to work.
Let me know if you have any other questions! I didn't mention how to read chat, and that's a whole other thing. πΉ If a proper guide would help, I can work on it over this weekend. Happy VRing. πΈ
@sorryaboutyourcats that's great thanks, I now have that fisheye filter working in OBS.
But I was wondering specifically, how did you get that full frame square, where it says "OBS Recording [Happens regardless of OBS]"?
Because you seem to have a full frame there even with the bottom left of the frame which is usually cutoff.
Are you combining something to fill in or is that recorded on the headset?
I have a similar scrcpy script written in PowerShell, that I wrote some time ago, which does pretty much the same thing and a few other bits. I've been struggling to get a full frame like that, with all corners.
How did you get that?
@KptnKMan It's just recorded on the headset, nothing combined. Hopefully this helps! β¬
So here is how it looks like with & without the Windows XP overlay:
Which is a rotation of -17.60Β° [which might need adjusting] with an overlay on top to make it look neat. πΉ
Transform settings:
The other setting was in my batch, which is --crop 2064:2208:2064:0. Other settings I saw online cropped more.
Let me know if I missed something. π
@sorryaboutyourcats @KptnKMan I dont know if this helps at all, but incase it helps
The best luck I've managed to capture the audio is honestly by streaming via the internal streaming feature to my browser just for the audio. there's often a slight delay that I would fix this in davinci, but that audio buffer might help (the reason I'm here lol)
I have also used side quest to adjust my settings a little bit so avoid game lag. by clicking on the wrench icon.
I'm on a quest 2 and get an almost perfect square with
scrcpy --no-audio --crop=1920:1920:1950:0
Using the obs shader filter, I think ive almost perfected it but primarily via trial and error so im sure someone could do better what i do is stack a second shader filter over it with the fish eye correction. you can get a perfect square almost with one but with a narrow fov. So the second one is to correct that tunnel focus to level it out like so
(my quest camera lens has this weird glitch on the upper left but its fine because the lens is taller that it is wider so i can crop the entire top off for a more squared out image. )
As you can see when I stack the filter with these settings what I end up with is a perfectly corrected image with all my vertical and horizontal straight edge 99.999 straight. The only thing cropped out are the bottom far right and left corners vs 20% of the screen otherwise.
(if your lenses aren't glitchy like mine then you only have the top far corners cut out. none of the far top, top, left, right, is cut out leading to the fullest view you you can get aside from just 3 small corners.)
Heres the full crop added to tidy it up.
Environment
Describe the bug Video feed over Wi-Fi "skips" at different times [i.e. can be smooth for ~20 seconds, then it skips].
Footage Video of the skip in action here. The first part compares the SCRCPY recording with the OBS recording of the live feed. The second part shows the live feed recorded from my phone [without OBS]. logcat here.
Video used: scrcpy -b 16M --crop 2064:2208:2064:0 --no-audio --print-fps --disable-screensaver --record 16.mp4
Info
Smooth when...
Last notes Considering it works over USB, the problem looks to be my network. However, I've tried so much already that I'm losing hope. πΉ
I could try to capture another device, like my Fold 4 to see if the issue is the Quest 3. I could also try SCRCPY on my laptop, which is Intel, to see if the problem lies with AMD [doubt it].
Greatly appreciate any help on this matter, and thank you for making such an awesome tool! π