obsproject / obs-studio

OBS Studio - Free and open source software for live streaming and screen recording
https://obsproject.com
GNU General Public License v2.0
60.26k stars 7.98k forks source link

OBS causing screen-tearing in preview and recordings #4354

Closed FerretBomb closed 3 weeks ago

FerretBomb commented 3 years ago

Platform

Operating system and version: Windows 10 (1909, but verified through 20H2) OBS Studio version: 26.1.1 OBS Log file: N/A

Expected Behavior

Sources should be captured and composited cleanly, without screen tearing

Current Behavior

In the Preview window as well as recording and on-streams, individual Window, Game, and Video Capture Device sources in OBS will exhibit screen-tearing, even with vsync enabled where applicable. Capture-card video from consoles (PS4, PS5, Switch all confirmed) and video cameras also display tearing, only in OBS (tested with AmaRecTV 2.20c, no tearing occurs)

Steps to Reproduce

(Intermittent, but mostly-reliable)

  1. Load Spyro Reignited. Ensure vsync is on (or forced-on at the driver level). Enter game.
  2. Add a Game Capture in OBS, pointed at the specific game executable.
  3. Move quickly. Tearing is erratically visible.

  4. Add a Video Capture Device source pointed at a capture card.
  5. Attach a camera to the capture card, verify function.
  6. Move quickly (waving briskly vertically is enough to trigger it for me). Tearing is visible in the capture source, even on top of a non-tearing window capture.

Additional information

This issue has seen a significant influx of reports on the OBS Studio Windows support forum over the last few months, especially with capture cards being used with Switch systems. Expected that it was simple user error through vsync off, or a capture card issue. It is not.

WizardCM commented 3 years ago

Please include an OBS log, and information about whether you force enable/disable Vsync on the OBS window itself within your GPU's settings app.

FerretBomb commented 3 years ago

The logfile contains no information about this tearing, but all right. Included. 20210220-013150_FerretBomb_1080N60NVQ8M-Skul_Spyro_StreamRaiders.mkv.txt

I have not forced-on vsync for OBS itself, no. Again, this issue does present in the Preview window, but it ALSO occurs in the associated recordings and livestreams. It also does not occur only full-frame, but per source as well; I have noted my DSLR->cap card exhibiting tearing while the Game Capture in the background does not, and vice-versa with the game capture showing tearing while overlay elements do not, and even in one case had the Game Capture exhibit tearing high on the screen, while my VCD was showing a separate, discrete tear-line in my camera source placed toward the bottom of the scene.

mufunyo commented 3 years ago

Honestly this sounds like a driver or hardware issue. Assuming no faults, the DWM (Desktop Window Manager, the service that composites the Windows desktop) can not tear, as it always waits for vsync. Similarly OBS is not written to submit partial frames, especially not out to video files. If you are getting partial updates baked into your stream or recordings I would suggest trying different drivers and/or a different graphics card.

FerretBomb commented 3 years ago

Again, this does NOT happen when testing with other capture programs (at least with the video capture devices I have available, I cannot check Game Capture with others for obvious reasons), only with OBS, and only recently (post v26). This issue is exclusive to OBS, and a significant number of users are experiencing similar on the Windows Support forums, most commonly with a variety of capture devices and Switch consoles most often. Again, I initially wrote this off as a hardware or driver issue, or user error. From the testing I have done, it is not, and the only commonality left that I can see at this point is OBS itself.

I am happy to serve as a testbed in any way needed, as far as I am able (I do not have a second GPU available, but have done a DDU clean-uninstall and latest-driver install already as part of my testing).

WizardCM commented 3 years ago

Please provide a list of threads you think would be relevant to help track down the cause. A quick search shows me most tearing reports are when playing Minecraft specifically, and we all know Minecraft players love playing their game at 200 FPS.

FerretBomb commented 3 years ago

Gladly. There are quite a few more than this, but as most of them use vague language to describe tearing, it's pretty hard to track them down with a search. Especially over the last few months. In the ones I'd responded to, I was similarly dismissive of the issue as being a hardware or driver problem, until I started watching my own VODs back and noticed it happening, then watched my Preview while live and saw it there as well, then started noticing that the tearing was occurring on a per-source level, not necessarily a full-frame level.

https://obsproject.com/forum/threads/issue-with-a-weird-line-when-using-video-capture-card-video-inside.138442/ https://obsproject.com/forum/threads/screen-tearing-with-nintendo-switch-on-capture-card.137755/ https://obsproject.com/forum/threads/bug-report-vsync-issues.132940/ https://obsproject.com/forum/threads/feature-request-vsync-for-video-capture-device.80083/ https://obsproject.com/forum/threads/whats-the-name-of-this-hdmi-capture-issue-how-do-i-fix-it.134941/ https://obsproject.com/forum/threads/screen-tearing-during-stream.134655/

All of these are capture-card specific tearing issues, with a variety of different cards both internal and external, by varying manufacturers, using a variety of input sources that should realistically never tear. I similarly was disregarding Minecraft threads (lol record at 1000+ fps!) but did notice tearing cropping up in Game Captures for games that were 100% vsync-on, which is not visible on the main display but is present in both the Preview on a secondary display, on the stream VOD, and in the local multitrack recording.

Additional testing, running the video out into my capture card via HDMI matrix and capturing it in AmaRecTV 2.20c shows no tearing (or onscreen in-game), while OBS simultaneously shows tearing in the Preview and local recording on my third monitor. Switching which monitor they are displayed on makes no difference (as expected, but eliminating another remote possibility).

mufunyo commented 3 years ago

Again, this does NOT happen when testing with other capture programs

AmarecTV does not use 3D hardware compositing so it will not uncover driver or hardware issues like OBS would. It's an apples to oranges comparison.

FerretBomb commented 3 years ago

It establishes that the capture device is able to provide non-tearing output, and likely is not at-fault. I'd agree that there may be some other hardware or driver issue at the root, but given the recent uptick in the last few months of 'my capture device is tearing' and 'screen tearing in OBS' threads in Support, it would be shortsighted to simply disregard it out of hand, as it does not appear to be an isolated case. Again, I'd assumed user-error or hardware failure myself in most of the threads I'd responded to, until I found it actually happening on my own system.

mufunyo commented 3 years ago

It would help if you understood that there is nothing that OBS can do on an API level to either cause or prevent tearing. It also has nothing to do with vsync, even if the artefact visually looks the same (tearing). Regarding the uptick in support cases, for any given hardware and driver combination, there are going to be thousands of people with the same config and therefore the same issue. It is however possible that OBS is triggering a bug elsewhere, and it might be possible to work around it if we can identify which piece of code triggers it and what other conditions have to be met to run into the issue.

Steps you can take to further investigate the issue include:

fliny00 commented 2 years ago

Hi there. Firstly mucho thanks to everyone making OBS a reality. You guys ROCK. Thank you thank you thank you.

As for the screen tear issue... Keeping all things equal, I went back to 24.0.3, and finally after weeks of pure frustration, what with drivers loading/unloading, and endless settings changing... 24.0.3 works ! No screen tear.

26.1.1 still tears. But 24.0.3 does the trick.

I'm on Windows 10 build 19043.1348, Nvidia 1060, i7-8750H, using "winaero tweaker" to eliminate windows based tearing issues. (BTW, weird as it is, installing the old aero theme in windows work, that is, for the windows side of the problem).

Cheerios, all !

And my primary concern is with 'windows capture'.

ghost commented 2 years ago

I am also experiencing this issue. Rolling back to OBS 23.0.3 fixed it for me as well.

winver

Bassbonedmo commented 2 years ago

I had the same issue using a capture card to stream from a DSLR camera. Ireverted to 24.03 but didn't fix the issue. Then on my camera, I changed the recording mode from MP4 to AVCHD and it appears to have fixed the screen tearing problem. Hope this helps.

fliny00 commented 2 years ago

Thanks CapitaineBidouille and Bassbonedmo.

I can now mention that after many new installs of win10 across 4-6 different machines and getting OBS to work on each of them, that it's the rollback to 24.03, that worked for me. I recall at least one time the tearing reoccur on a new windows install, and once I use version 24.03, no issues at all. Ever since then, I just stayed with 24.03 upon the new install. And I have no issues whatsoever.

On none of my windows 10 installation since December, 2021, have I changed the aero theme settings, So I can confirm that changing the aero theme, as I did back in late Nov. 2021, has no impact on the problem, for me.

Capitaine, Good to know that 23.03 work for you! It is good to have an option. Thank you.

Bassboned, AVCHD recording is native to many camera models, so it is good to know that staying with the camera manufacturer's default types can have an impact. THANK YOU !

PhoebusXS commented 2 years ago

It's 4:31AM, and I've been trying out a couple versions, ranging from 23 to 28.

In the end, 27.0.1 (and earlier versions) works for me without tearing. While 27.2.4 and later versions would have the tearing issue.

So this should give a rough range of when the issue started happening.

I'll probably narrow it down when I have more time next time and do a diff in the codebase. :)

RytoEX commented 2 years ago

If this is still happening in OBS Studio 28.1.2 (or newer), please provide a video file where this issue has occurred.

freemanngaming commented 2 years ago

Hello guys.

I face screen tearing with projector preview since OBS was updated to 28th version

The only solution for me was to downgrade to 27.0.1 version.

I use dual PC Setup

Streaming CPU 3600 AMD GPU 1660 Super Nvidia OS Windows 11pro

Gaming CPU 5800xAMD GPU 3090 Nvidia OS Windows 11pro

capture cards Hd60 s+ or Avermedia live Gamer 4K both same issue.

I wish if there is any other solution that could help so I can update the software

Appreciate your help Cheers

PhoebusXS commented 1 year ago

If this is still happening in OBS Studio 28.1.2 (or newer), please provide a video file where this issue has occurred.

Hi, this is still happening for me in 28.1.2.

Both my streaming PC and gaming PC are running OBS 28.1.2. I'm using Elgato HD60X. Gaming PC is Windows machine, streaming PC is an Intel Mac.

Here's a couple scenarios:

  1. on gaming PC, inside OBS preview - no screen tearing, ever
  2. on gaming PC, OBS windowed/fullscreen projection onto gaming PC (main monitor) itself - no screen tearing
  3. on gaming PC, only do full screen project into my capture device - screen tearing occurs
  4. on gaming PC, do a windowed projection on main monitor itself, also do full screen projection into capture device - no screen tearing
  5. on gaming PC, do a full screen project both into main monitor as well as capture deivce - screen tearing occurs only for capture device

Notice the tearing is only ever visible on my streaming PC (aka via the capture device)

Here's a demo of exactly what kind of tearing I'm seeing on my streaming PC.

https://user-images.githubusercontent.com/18490078/201502037-8312cc6f-4e6c-4ba1-84bf-cf53f4ef6bc2.mp4

fliny00 commented 1 year ago

I first posted here to share my dealings with this issue almost exactly a year ago on Nov 22. And after a year, I really can swear by 24.0.3, now! It just reaffirm itself yet again today...

Here's my story...

Up until 6 days ago, I have since been ON THE SAME MACHINE as last I repost here in May, with the same Win10 Pro/OBS 24.0.3. It worked, and works, knock on wood.

Hardware: Intel i7-8750H, RTX 1060, 32Gb, 2x 1Tb (PCIe NVMe), Wifi AC-9560.

That is... until 5-6days ago. I finally moved on to Win11. I re-org'ed my data files, delete all partitions and cleanly installed Win11 Ent. Since I have a whole new setup, I want to see if I can move beyond 24.0.3.

A little background. My ONLY use for OBS is to do Windows capture, to RECORD. I do not stream/broadcast. Never did. I use an external monitor to display the source, and my laptop's screen to view and control the OBS capture.

After the first day's initial success... the tearing started to happen again...

The tearing is on the DISPLAY (!). This would of course means the OBS output would also be 'torn'. Now I've done this process in hundreds of recording sessions, never seem my browser session tears... I naturally assume it's something to do with my Win11 and buffering issues.

Since I'm sitting on fiber (unchanged from a year ago), I get throughput to spare. Remember even when working on 4K, I had NO 'tearing' on browser display from before, while on Win10/OBS 24.0.3. I figure its down to my browser settings and buffering. After days of fumbling around, I finally decide on a biggest-hammer 'approach', and went to a RAM Drive solution, to FORCE the whole setup to run from RAM memory. I figured that must disprove any buffering concerns.

In the session immediately before I write here... I was recording a stream displaying on my external monitor, while OBS runs on the laptop screen. And sure enough, the streaming source displaying on the external monitor tears, and this time VERY persistently. I shut down my browser. Started up a 15Gb RAM Drive (my streams are well under 4Gb, but hey...), transfer and rerouted the cache to the RAM Drive. Restarted the browser... and...

the tearing continues... NO CHANGE. I even waited things out, and let the buffer fill... Nope... tears tears tears...

And because I've lived and monkeyed with this for a whole year... I knew I have to do the unreasonable. I let the browser sit with its buffered filled as it is...

Reinstalled v24.0.3. And...

Not a single tear. Not even in spots where the source stream is jittery.

Praise be to v24.0.3. Hallow be thy versioning... LOL

I will edit this comment if I have any counter examples, for when the tearing reappear... And if I leave none, it'll be because I would have not experience it just yet.

Also... when I now go back to look at all the recording since I moved to Win11 6 days ago... It turns out they ALL have 'tears'... each recording progessively worse until today's becoming so unavoidable that I had to do a frog jump out, and back to v24.0.3.

Fenrirthviti commented 3 weeks ago

Closing as stale. If this is still an issue please open a new issue with updated reproduction steps on the latest version of OBS.