Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
104.37k stars 10.15k forks source link

Screen tear on VR casting Oculus Quest #634

Closed Zimtok5 closed 4 years ago

Zimtok5 commented 4 years ago

There is a notable screen tear when using scrcpy with ADB. It would be very useful to find tips about why the top half and bottom half go out of sync.

rom1v commented 4 years ago

If you record and play the video with some player (VLC), is there stlil tearing? And frame by frame (shortcut e in VLC)?

scrcpy --record file.mkv
Zimtok5 commented 4 years ago

Yes. Tearing is frame by frame in faster motion scenes right along the midsection.

On Oculus Go (slightly lower res) there is no tear. I’ve tried altering a few things but it seems to be scrcpy related.

I’ve got it running at 18M and it’s smooth and detailed but even dropping to 2M doesn’t clear the issue.

Watch here around 1:10:15 I suggest when I move my head to see the notable tear:

https://youtu.be/PPhof-snkYE

Thanks for the help! It’s a fantastic utility and this is the last problem to overcome.

Go 1280:1240:1335:100

Quest 1440:1400:1425:100

Regards,

ZIM (Brad)

On 9 Jul 2019, at 11:12, Romain Vimont notifications@github.com wrote:

If you record and play the video with some player (VLC), is there stlil tearing? And frame by frame (shortcut e in VLC`)?

scrcpy --record file.mkv — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

rom1v commented 4 years ago

Watch here around 1:10:15 I suggest when I move my head to see the notable tear:

How did you record this video where we can see tearing? Is it via scrcpy --record?

Zimtok5 commented 4 years ago

No. But the tear is present in the view which I capture (Window Capture via OBS Studio).

I use scrcpy in a live broadcast (have done for about 8-9 month), so the local record feature isn’t useful for me.

But I can try it if it helps debugging. Frankly I’ve never used it before for the above reason.

Regards,

ZIM (Brad)

On 9 Jul 2019, at 13:31, Romain Vimont notifications@github.com wrote:

Watch here around 1:10:15 I suggest when I move my head to see the notable tear:

How did you record this video where we can see tearing? Is it via scrcpy --record?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

Magicoo commented 4 years ago

Hello, I can confirm the screen tear. It happens in games, not on the home screen. I tested it with Beat Saber and First Steps on Oculus Quest. Systems tested: Windows 10 32b with Intel HD graphics and Windows 10 64b with AMD graphics, vsync on or off does not make a difference. Everything else works great. Thank you for your great work!

lpful commented 4 years ago

@Zimtok5 @Magicoo Have a look at https://www.youtube.com/watch?v=Hgn9lUC0WBM You may try https://www.cnblogs.com/we-hjb/p/9823088.html

gabetoth-dgh commented 4 years ago

I see page tear too without --record I didn't try to record though. I have a hunch, that the tear is might be related to fps. So, from the Quest we get 72 fps, and your monitor can only do 60hz, so it tears. I have a monitor at work which is capable of 75hz, I'll try out to see is there any difference.

rom1v commented 4 years ago

But I can try it if it helps debugging.

We need to determine whether tearing occurs:

Testing recording will not totally answer the question, but may help to eliminate hypotheses.

Once you get a recorded file:

Zimtok5 commented 4 years ago

This puzzles me, however.

The Go and Quest are both meant to operate at 72 Hz and when in 60 Hz mode the tear still shows but ONLY on Quest and for either refresh rate.

I’ll have to trial the tests suggested tonight to help us get to the bottom of this. It’s my hypothesis it’s resolution related; not refresh rate (despite the latter originally being my suspicion and making sense on paper).

I presume there’s no undocumented frame rate limiting parameter available in scrcpy, right?

See this recording with both Go and Quest for side by side comparison how they match off.

https://youtu.be/ph6zVRXykEc

Regards,

ZIM (Brad)

On 10 Jul 2019, at 08:41, Gabe Toth notifications@github.com wrote:

I see page tear too without --record I didn't try to record though. I have a hunch, that the tear is might be related to fps. So, from the Quest we get 72 fps, and your monitor can only do 60hz, so it tears. I have a monitor at work which is capable of 75hz, I'll try out to see is there any difference.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

Regards,

ZIM (Brad)

On 10 Jul 2019, at 08:49, Romain Vimont notifications@github.com wrote:

But I can try it if it helps debugging.

We need to determine whether tearing occurs:

during capture on the device side (unlikely), when scrcpy updates the texture, between the scrcpy display and the OBS capture, on any video display. Testing recording will not totally answer the question, but may help to eliminate hypotheses.

Once you get a recorded file:

play it with VLC, play it frame by frame, use it as OBS input instead of the scrcpy window. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

Magicoo commented 4 years ago

Hello, Here are my tests: scrcpy -c 1280:720:100:800 no tearing scrcpy -c 1280:720:100:600 tearing in the upper part of the window scrcpy -c 1280:720:100:400 tearing almost in the middle of the window scrcpy -c 1280:720:100:200 tearing in the lower part of the window scrcpy -c 1280:720:100:0 no tearing scrcpy -c 1280:720:100:400 -r file.mkv the tearing is visible almost in the middle of the window This is how it looks like for scrcpy -c 1280:720:100:400 https://ibb.co/6FvKV95

rom1v commented 4 years ago

Oh, so there is tearing even in VLC.

Is it only when playing the file, or a frame of the video itself is torn? (can you get a torn frame in pause, advancing frame by frame using e?)

Magicoo commented 4 years ago

The tear is there in frame by frame and normal playback. I took the snapshot from a paused video: https://ibb.co/6FvKV95 I guess it is not a display/frame sync problem. The tearing changes position depending of the specified offset.

rom1v commented 4 years ago

I took the snapshot from a paused video

Oh, so the tearing occurs directly on the device while capturing the surface: MediaCodec provides an encoded stream containing frames with tearing.

I would say this is a bug in the ROM on the device.

rom1v commented 4 years ago

What if you change the FRAME_RATE value (to 75fps or more)?

https://github.com/Genymobile/scrcpy/blob/49612561233b3cde41339ee08c71892e42649706/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java#L19

Magicoo commented 4 years ago

Same result for 75fps :( I'll try more FPS later. Looks like the frame is split in 2 equal parts (when running scrcpy without extra parameters, the tearing is in the middle)

Magicoo commented 4 years ago

I've tried 72,75,120 and 144fps and got the same tearing. Any ideea what else to try? Thank You!

rom1v commented 4 years ago

I've tried 72,75,120 and 144fps and got the same tearing.

I'm not surprised, this settings has basically no effect.

Any idea what else to try?

I think the problem should be reported to Oculus.

Magicoo commented 4 years ago

Yes, I'll try. Also I've noticed that on very rare occasions there is no screen tearing. Just starting scrcpy many times to test different crops I get lucky once in awhile :), but I can not figure out why or how.

mdmayfield commented 4 years ago

I'm seeing this too; this is a freeze-frame in the .mkv produced by scrcpy --no-display --record file.mkv: image

ryan77627 commented 4 years ago

Just curious, if this were a bug in the rom, wouldn't the tearing be visible in the oculus itself? I'm not sure how the app works exactly, doesn't it just grab whatever the device currently has rendered? What does the program grab from the android device exactly?

rom1v commented 4 years ago

Just curious, if this were a bug in the rom, wouldn't the tearing be visible in the oculus itself?

I guess the display may be "sync-ed" while the capture is not.

Is there screen tearing with:

adb shell screenrecord /sdcard/file.mp4
adb pull /sdcard/file.mp4

?

ryan77627 commented 4 years ago

Yeah, in fact there is. I sent a report to the devs so maybe I'll get an answer that I can post here later.

Zimtok5 commented 4 years ago

Hey devs, would this recent Tweet from Carmack have any bearing on the screen tearing issue?

https://twitter.com/ID_AA_Carmack/status/1184970761410351105?s=20

Javinat0r commented 4 years ago

Yeah, in fact there is. I sent a report to the devs so maybe I'll get an answer that I can post here later.

Was there ever any response to this reporting? This thread is the most documentation of this issue I've been able to find on the internet so far.

Zimtok5 commented 4 years ago

Not yet. I'm hoping Oculus will respond to the issue as its still present in every recording I make.

On Sat, 28 Dec 2019, 21:33 Javinat0r, notifications@github.com wrote:

Yeah, in fact there is. I sent a report to the devs so maybe I'll get an answer that I can post here later.

Was there ever any response to this reporting? This thread is the most documentation of this issue I've been able to find on the internet so far.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Genymobile/scrcpy/issues/634?email_source=notifications&email_token=AAV3NYB6IEPSKY3YOHC23N3Q27A3NA5CNFSM4H6UG3W2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHYSR5I#issuecomment-569452789, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAV3NYETTJJLFCBGGSPCN6TQ27A3NANCNFSM4H6UG3WQ .

ryan77627 commented 4 years ago

Eh, sorta? I filed it and someone said that the issue was assigned to the proper team to scope and fix. I checked back like 2 weeks ago and they hadn't said anything else. I filed it on August 26, and the issue still persists with the latest firmware on the headset. So I never posted here again, since I hadn't heard of any real headway on the issue. It's weird since some docs I looked at back then were suggesting scrcpy for presentations and developers and such.

ryan77627 commented 4 years ago

Here's the ticket link for anyone interested. I'm not sure if people can look at it though, because it definitely requires a login. If anyone has an oculus developer account, mind heading over there and seeing if you can get into it?

Link: https://developer.oculus.com/bugs/bug/762361750886871/

Zimtok5 commented 4 years ago

Here's the response thread, Ryan (for the benefit of others). No update since you last posted.

https://i.imgur.com/c4FPzLv.jpg

On Sun, 29 Dec 2019 at 00:27, ryan77627 notifications@github.com wrote:

Here's the ticket link for anyone interested. I'm not sure if people can look at it though, because it definitely requires a login. If anyone has an oculus developer account, mind heading over there and seeing if you can get into it?

Link: https://developer.oculus.com/bugs/bug/762361750886871/

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Genymobile/scrcpy/issues/634?email_source=notifications&email_token=AAV3NYDA6DDJVYIRA34CA4TQ27VFZA5CNFSM4H6UG3W2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHYU6QY#issuecomment-569462595, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAV3NYAUVFDUYLEN2II4PP3Q27VFZANCNFSM4H6UG3WQ .

redlaw2305 commented 4 years ago

on linux make sure u have Option "TearFree" "true" in xorg.conf if this is on auto it wont work with scrcpy. also u can test it by turning it on temporarily with the command: xrandr --output output --set TearFree on

rom1v commented 4 years ago

No, the tearing occurs on the device side, even before it is displayed on the computer.

redlaw2305 commented 4 years ago

so let me get this clear: scrcpy is used on the pc to cast the picture of the android device to the pc? if this is true to which device is the oculus connected to? is there a direct link to the pc or the android device?

mdmayfield commented 4 years ago

on linux make sure u have Option "TearFree" "true" in xorg.conf if this is on auto it wont work with scrcpy. also u can test it by turning it on temporarily with the command: xrandr --output output --set TearFree on

so let me get this clear: scrcpy is used on the pc to cast the picture of the android device to the pc? if this is true to which device is the oculus connected to? is there a direct link to the pc or the android device?

Thanks for the suggestion, but it's coming from a place of not having the whole picture of what the components are and what they do.

The Oculus Quest is an Android device. Scrcpy runs on it and sends images to the PC.

The video is pre-torn before it even reaches the PC. It is impossible for any X11 settings on the PC to make any difference in this issue.

redlaw2305 commented 4 years ago

u might want to check out this thread. it seems the tearing might be related to the oculus. https://www.reddit.com/r/OculusQuest/comments/bsbo6v/visual_artifactstearing/

redlaw2305 commented 4 years ago

also this thread contains info from oculus support: https://www.reddit.com/r/OculusQuest/comments/brha5q/jitter_in_headset/

rom1v commented 4 years ago

(Closing as it is not an scrcpy issue)

rom1v commented 3 years ago

Seems solved on Oculus Quest 2: https://www.reddit.com/r/OculusQuest/comments/jbnyiw/sidequests_scrcpy_streaming_schematics/g8wcxbw/

Zimtok5 commented 3 years ago

Yes, I can confirm. Works great now.

On Thu, 15 Oct 2020, 20:52 Romain Vimont, notifications@github.com wrote:

Seems solved on Oculus Quest 2: https://www.reddit.com/r/OculusQuest/comments/jbnyiw/sidequests_scrcpy_streaming_schematics/g8wcxbw/

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Genymobile/scrcpy/issues/634#issuecomment-709554939, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAV3NYFGK5PRXCRXQJJN5BTSK5HGVANCNFSM4H6UG3WQ .