Skip to content
This repository has been archived by the owner on Dec 15, 2020. It is now read-only.

Skewed Output #160

Open
tejasthy opened this issue Jun 3, 2020 · 90 comments
Open

Skewed Output #160

tejasthy opened this issue Jun 3, 2020 · 90 comments
Labels
bug Something isn't working

Comments

@tejasthy
Copy link

tejasthy commented Jun 3, 2020

Describe the issue
When I run the OBS Virtual Camera for Mac, I get some weird output.

To Reproduce
Steps to reproduce the behavior:

  1. I downloaded the package with the latest version
  2. I went to OBS and selected "Start Virtual Camera"
  3. I went to Google Meet and switched my camera input to the virtual camera

Behavior
The virtual camera is showing a weird image in Google Meet.

Screenshots

Desktop (please complete the following information):

  • OS version: 10.15.5

Screen Shot 2020-06-03 at 11 29 20 AM

Screen Shot 2020-06-03 at 11 30 18 AM

  • Application (if applicable): Chrome
  • Virtualcam version: 1.2.0
  • OBS version: 25.0.8

Additional context
Add any other context about the problem here.

@gxalpha
Copy link
Collaborator

gxalpha commented Jun 3, 2020

Uhhmm... That should have been fixed 😄
Are you sure you are running 1.2.0?
If so, it should show "1.2.0" at the bottom of the test card. Please report back if it does.
Bildschirmfoto 2020-06-03 um 21 33 11

@tejasthy
Copy link
Author

tejasthy commented Jun 3, 2020

I don't see the test card either since it is also showing a skewed image. How do I totally uninstall it totally? I tried uninstalling using what was online but I am wondering if I am missing something. Here's a screenshot of what my test card looks like:
Screen Shot 2020-06-03 at 1 06 48 PM

@tejasthy
Copy link
Author

tejasthy commented Jun 3, 2020

I don't see the test card either since it is also showing a skewed image. How do I totally uninstall it totally? I tried uninstalling using what was online but I am wondering if I am missing something. Here's a screenshot of what my test card looks like:
Screen Shot 2020-06-03 at 1 06 48 PM

Is there another way to check the version?

@gxalpha
Copy link
Collaborator

gxalpha commented Jun 3, 2020

Insert this command into Terminal.app:
cat /Library/CoreMediaIO/Plug-Ins/DAL/obs-mac-virtualcam.plugin/Contents/Info.plist | grep -a1 CFBundleVersion and post the results. It should say the version number in there

@tejasthy
Copy link
Author

tejasthy commented Jun 3, 2020

image
Here’s what I got

@gxalpha
Copy link
Collaborator

gxalpha commented Jun 3, 2020

Have you rebooted your mac?

@tejasthy
Copy link
Author

tejasthy commented Jun 3, 2020

Yes I tried that.

@gxalpha
Copy link
Collaborator

gxalpha commented Jun 3, 2020

Could you attach an OBS log of when the problem occurred? That would help understand the problem

@tejasthy
Copy link
Author

tejasthy commented Jun 4, 2020

Yeah sure. Here it is:
2020-06-03 13-06-27.txt

@johnboiles
Copy link
Owner

johnboiles commented Jun 4, 2020

Very interesting. I thought we had this solved. I see this in the logs

13:06:27.539: 	base resolution:   1440x900
13:06:27.539: 	output resolution: 860x538

If you change both resolutions to 1280x720 does that fix things?

image

To be clear, any resolution should work. So this is definitely a bug.

@johnboiles johnboiles reopened this Jun 4, 2020
@gxalpha gxalpha added the bug Something isn't working label Jun 4, 2020
@gxalpha gxalpha changed the title [Support] Skewed Output [Bug] Skewed Output Jun 4, 2020
@tejasthy
Copy link
Author

tejasthy commented Jun 4, 2020

Very interesting. I thought we had this solved. I see this in the logs

13:06:27.539: 	base resolution:   1440x900
13:06:27.539: 	output resolution: 860x538

If you change both resolutions to 1280x720 does that fix things?

image

To be clear, any resolution should work. So this is definitely a bug.

I tried changing the resolution as well. Here's what I got:
Screen Shot 2020-06-04 at 2 40 17 PM
2020-06-04 14-38-13.txt

Thanks for your help by the way.

@johnboiles
Copy link
Owner

Hmm. I also see

14:38:13.948: NV12 texture support not available

Could you try using a different format (I think this is in the advanced settings page iirc.

@tejasthy
Copy link
Author

tejasthy commented Jun 4, 2020

It worked! Thanks a lot for your help!
Screen Shot 2020-06-04 at 3 44 26 PM

@johnboiles
Copy link
Owner

Very interesting I wonder if this is an obs bug or if I'm doing something wrong with converting pixel formats. @dodgepong have you seen anything like this in other issues on OBS? Seems like @tejasftc had the format set to NV12 even though his computer reported that it wasn't supported. This then seemed to break the pixel format conversion to yuv422 that my plugin does

@dodgepong
Copy link

I've never heard of any issue like this before, no.

@jp9000
Copy link

jp9000 commented Jun 5, 2020

The NV12 texture not supported message is for whether full NV12 textures are supported, which is a Windows-specific thing at the moment. It doesn't affect OBS' usage of NV12. OBS will just use shaders to implement NV12 if NV12 textures aren't available, and if there was a bug with that, then you would see it in all outputs because it's the default format.

For format conversion, we usually use FFmpeg. So that shouldn't be in our territory either.

When the base and output resolutions don't match, it uses the GPU to scale, but there isn't any known issue with that either, otherwise it would affect all outputs and not just virtualcam.

Without having a full grasp on all your code I can't really say anything substantive, but I don't think OBS would be giving bad NV12 data, because NV12 is a very high frequency code path (it's the default). It would also produce on Windows in that case. Personally, I'd just check the memory of the data at all parts of the pipeline after you download it from the GPU to figure out where it's coming from. I'd recommend using a test image that would make comparing scanlines of the image more simple when checking for errors.

It looks like a bad linesize/pitch value somewhere.

@tejasthy
Copy link
Author

tejasthy commented Jun 5, 2020

Do the other formats cause the output use more CPU Power? It really slowed down my computer so I couldn’t really use it.

@gxalpha
Copy link
Collaborator

gxalpha commented Jun 6, 2020

OBS takes a lot of power in general, I'm afraid a dual core i5 processor (according to your log file) may not be enough to do lot of things simultaneously.
I'd like to put your log into the OBS analyzer and look if it is a problem, but I don't know how to :D

@jp9000
Copy link

jp9000 commented Jun 6, 2020

NV12 probably uses the least amount of CPU processing. It uses the least data.

@tejasthy
Copy link
Author

tejasthy commented Jun 7, 2020 via email

@johnboiles
Copy link
Owner

@jp9000 thank you for chiming in! This is the whole of my pixel format conversion code in the plugin:

    obs_get_video_info(&videoInfo);
    struct video_scale_info conversion = {};
    conversion.format = VIDEO_FORMAT_UYVY;
    conversion.width = videoInfo.output_width;
    conversion.height = videoInfo.output_height;
    obs_output_set_video_conversion(output, &conversion);
    if (!obs_output_begin_data_capture(output, 0)) {
        return false;
    }

That should make it so that the output's raw_video method always gets a framebuffer with the pixel format VIDEO_FORMAT_UYVY right? Is it correct to say that this shouldn't depend on the current 'Color Format' setting? I'm trying to understand what about the OBS 'Color Format' setting could mess up the framebuffer I receive since I have this conversion in place.

@jp9000
Copy link

jp9000 commented Jun 7, 2020

Are you able to reproduce this @johnboiles?

@johnboiles
Copy link
Owner

Unfortunately no, so im flying blind

@jp9000
Copy link

jp9000 commented Jun 7, 2020

Hm, I wonder what's going on. At some point I'll test this myself and try to debug. My guess is that the client application itself is using the wrong format or seeing it as the wrong format. I'm just kind of overburdened with my own stuff at the moment (and let's not forget the 115 pull requests on main) so I don't really feel comfortable spending time on this right at the moment.

By the way, is there a reason why you're converting to UYVY rather than just using NV12?

@gxalpha
Copy link
Collaborator

gxalpha commented Jun 7, 2020

@jp9000 to my knowledge UYVY is used because it worked and others didn't, but that was back when this was just a proof of concept and it just stayed.

@johnboiles
Copy link
Owner

@jp9000 yes not urgent at all; this doesn't seem to be a widespread problem. Your time is probably best spent working on main! Feel free to drop off the conversation here and we won't be offended :)

What @gxalpha says is correct, UYVY was the first thing I was able to make work and I just ran with it. I spent a little bit of time investigating further in #102 and I don't think Apple's Core Media APIs support NV12 as a camera format. I also tried to get I444 to work (using kCMVideoCodecType_AppleProRes4444) but that didn't seem to work either. Perhaps RGB could be made to work. Obviously if I can match a pixel format that OBS supports natively with a format that works directly as a Core Media IO DAL plugin format then we can avoid the pixel format conversion which should significantly lower CPU usage I think. This is the list of formats I think I have to pick from on the CoreMedia side. It might also be possible to use something from this list of pixel formats though I'm not exactly sure how.

@mikehatch
Copy link

I'm on v1.2.1 and had this issue - reboot didn't help, and changing the Video->Base Resolution & Output Resolution to be the same didn't help. After reviewing comments and settings in this thread, the thing that fixed it was changing the setting: Advanced -> Video : Color Format from NV12 to something else (RGB) fixed it. Then I changed it back to NV12 and it was fine.

@johnboiles
Copy link
Owner

@mikehatch thanks for the data point! Did you see the issue both in the test card and the video from OBS, or just one of those?

@mikehatch
Copy link

@mikehatch thanks for the data point! Did you see the issue both in the test card and the video from OBS, or just one of those?

Yes, both the output and the test card were showing the skewed output as shown in this thread.

@PatTheMav
Copy link

So futzing around with the colour space might be another factor in triggering it? Will give it a whirl this weekend..

@johnboiles
Copy link
Owner

Yeah potentially anything that could change or recreate the pixel buffers on OBS or in the DAL plugin seems like a likely candidate.

@PatTheMav
Copy link

What I still try to wrap my head around is how even the test card will appear skewed, as reported by some people. The test card is created/rendered entirely within the DAL plugin with no input from OBS (where a different colour space would be set-up) and iirc only resolution and frame rate are stored in UserDefaults. Of course if the DAL plugin instance stays "alive" with bad settings, it won't recover, but I'm under the assumption that e.g. Chrome's plugin host runs its own instance of the DAL plugin and when Chrome is closed that one should be torn down as well. 🤔

@johnboiles
Copy link
Owner

Yeah it's very mysterious. It's a good point about the test card -- that's probably the place to start. It will be a more self contained problem to understand why the test card is skewed. And once we understand that maybe we can reason about why changing settings in OBS sometimes fixes it.

@johnboiles
Copy link
Owner

I'd start with looking at the creation of the CVPixelBuffer. But without having a developer that can reproduce, all we can do is read and check the code. Hopefully your eyes will see something mine haven't.

@worst-Ness
Copy link

worst-Ness commented Nov 10, 2020

I'm having the same issue with OBS 1.2.1 on rockoutloud.live
https://imgur.com/a/I8JiFrV
Screen Shot 2020-11-10 at 2 03 06 PM

@TobiasBales
Copy link

I am having the same issues for some time now - anything I could provide to help you better understand the issue?

@pixelass
Copy link

There's not much to understand right now. Nobody really seems to know why this happens. Your best bet would be to follow the suggestions and if you notice a step that solved it for you, then mention it here so contributors can check for reproducibility.

@loretod
Copy link

loretod commented Nov 18, 2020

Not sure why but updating to Chrome 87.0.4280.66 (Official Build) (x86_64) fixed it for me in Google Meet. it's been working great in Zoom so must have been a Chrome issue. Not sure if anything in the update log helps with the detective work? https://chromereleases.googleblog.com/

@capital-G
Copy link

@worst-Ness
following settings worked for me with Jitsi and Chrome facing the same issue before

grafik

grafik

@socalpoet29
Copy link

socalpoet29 commented Nov 21, 2020

I also have this issue. Switching to Colour Format RGB does resolve the tearing but the frame rate drop makes it unusable. With NV12 color format the frame rate is fine (though of course there's the tearing..)

I am reproing in Firefox/Chrome. I'm just googling webcam tests and picking from the top sites. Don't have Zoom or other meeting applications installed so haven't tested there.

Plugin Version 1.2.1, used Package installer
OBS 26.0.2 (mac)

Firefox - 83.0 (64-bit)
Chrome - 87.0.4280.67 (Official Build) (x86_64)

Specs (Yes I know):
MacBook Air 11" Mid-2013
macOS 11.0.1 Beta
1.3 GHz Dual-Core Intel Core i5
8 GB memory
Intel HD Graphics 5000 1636 MB

Please let me know if I can provide any additional information. I don't really need this for anything, it's just for fun, but happy to help if I can!

@joseluistubert
Copy link

I'm having the same problem. Tried every suggestion in the thread but nothing works. I still get the skewed image.

@joseluistubert
Copy link

The data card is also skewed.

@joseluistubert
Copy link

I installed this release obs-mac-virtualcam-4bd5852-v1.2.1.pkg
and that fixed the problem!!!! Thanks a lot John!!!!

@medwingADMIN
Copy link

medwingADMIN commented Nov 27, 2020

This bug is not fixed for me unfortunately. Exactly the same issue
OS Version 11.0.1
Plugin 1.3.1 (I tried with 1.2.1 as well)
OBS - 26.02
The skewed video is there even when I have the virtual camera turned off and I have of course restarted etc
EDIT: MacBook Pro (16-inch, 2019)

Screenshot 2020-11-27 at 12 20 46 pm

@johnboiles
Copy link
Owner

@medwingADMIN what are your resolution + color space + color format settings (see @capital-G's post above)

@johnboiles
Copy link
Owner

I wonder if this could be the same underlying cause as #228 and #233 (attempted fix in #241). It seems that something goes wrong with sending and/or saving the FPS value from the OBS plugin to the DAL plugin. Totally possible the same thing could be happening for the width / height, which could potentially cause this issue.

@PatTheMav
Copy link

The "current" values for the plugin should be stored in the plist of the host application. So if this happens in Chrome, it should be set in ~/Library/Preferences/com.google.Chrome.helper.plugin.plist or similar.

@johnboiles
Copy link
Owner

If this is a similar issue as #228 and #233, I added some logs in d11f17eba that might help diagnose this. Go download the pkg-installer and try it out while looking at the Console.app logs? https://github.com/johnboiles/obs-mac-virtualcam/runs/1465076120

You're looking for the logs that start with:

Saving frame info
Setting default resolution
Loaded resolution from NSUserDefaults
Setting default framerate
Loaded framerate from NSUserDefaults

@johnboiles
Copy link
Owner

@PatTheMav that's super helpful! Anyone who is experiencing this issue could you post your plist files (like the one @PatTheMav mentions). These should contain the saved defaults from the plugins.

@johnboiles johnboiles mentioned this issue Nov 29, 2020
@anthonypillot
Copy link

Posting my case too:

Describe the bug
Installed the plugin, the plugin worked fine on Google Chrome, Google Meet : I was able to seen my OBS diffusion on Google Meet.

But after a restart of Chrome, the stream is full blurred, skewed.

To Reproduce
Trying to reproduce the bug, reinstalling the plugin, restart my computer, full reinstall OBS, the plugin, but nothing works again.

Expected behavior
Just see my diffusion in Google Meet.

Screenshots

Capture d’écran 2020-11-23 à 17 21 17

Desktop (please complete the following information):

  • OS version: [macOS Big Sur 11.0.1]
  • Application: [Chrome, Google Meet]
  • Virtualcam version: [1.2.1]
  • OBS version: [26.0.2]

@olifrieda
Copy link

Having the same issue with:
Color Format: NV12
Color Space: 709
Color Range: Partial
x Disable macOS V-Sync
x Reset macOS V-Sync on Exit

Base Resolution: 1792 x 1120
Output Resolution: 1192 x 746
Downscale Filter: Bicubic
Common FPS Value: 25 PAL

OS: 10.15.7
OBS: 26.0.2
Virtual Cam: 1.3.1
Google Chrome: 87.0.4280.88

Solved it by: (Don't forget to restart Google Chrome after changing the settings in OBS!)
Base Resolution: 1792 x 1120
Output Resolution: 1792 x 1120
(other resolutions are working too, but must be the same for both settings)

Scaled output resolution seems not to be working.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests