Envek / obs-studio-node-example

Learn how to use OBS Studio from your Electron app for screen video recording
GNU General Public License v2.0
105 stars 19 forks source link

add mac support #19

Closed alse closed 4 years ago

alse commented 4 years ago

@Envek thanks for putting this together!

I made some updates to add mac support.

Recording the screen and webcam works, but the live preview doesn't show up. Any idea why? log_output.txt

alse commented 4 years ago

Wow! Cool!

Maybe preview window doesn't work because of displayId is different on MacOS (can't remember where I've got this display1 from)? Or, perhaps, window.getNativeHandle() returns something different?

Hmm I think the display1 can be an arbitrary string. getNativeHandle is undefined on mac. I'll post an update if I find anything

alse commented 4 years ago

@Envek I'm also seeing a problem with slow frame rates when streaming to the virtual camera. Recording to disk is smooth. Do you know what could be causing it?

This warning comes up: [swscaler @ 0x11d979000] Warning: data is not aligned! This can lead to a speed loss

// osn.NodeObs.OBS_service_installVirtualCamPlugin()

osn.NodeObs.OBS_service_createVirtualWebcam('Streamlabs OBS Virtual Webcam - Example');
osn.NodeObs.OBS_service_startVirtualWebcam()

osn.NodeObs.OBS_service_stopVirtualWebcam();
osn.NodeObs.OBS_service_removeVirtualWebcam();
Envek commented 4 years ago

No, I have no idea. I think that it can be internal issue in obs-studio-node (probably very low-level one). So, please open an issue in their issue tracker at https://github.com/stream-labs/obs-studio-node/issues

alse commented 4 years ago

It works well when running the latest streamlabs-obs with the same obs-studio-node, so it must be related to this setup. I'll keep digging, thanks!

psd-coder commented 4 years ago

Hey! I can't run it on my mac image

Envek commented 4 years ago

That one looks like https://github.com/Envek/obs-studio-node-example/issues/18#issuecomment-673344813

alse commented 4 years ago

@psd-coder sure you're on the right branch? Looks like it's using the windows input types, is process.platform "darwin"?

psd-coder commented 4 years ago

@alse You are right! My bad, I forgot to checkout branch... it works! but needed to be fixed uuid require

alse commented 4 years ago

Great! What was wrong with the uuid require?

psd-coder commented 4 years ago

I got Error: Cannot find module 'uuid/v4' until changed it to const { v4: uuid } = require('uuid'); from const uuid = require('uuid/v4')

chfeizy commented 4 years ago

@alse Can the mac version of obs-studio-node run?

alse commented 4 years ago

@psd-coder thanks, I updated the uuid require

@chfeizy yes, it runs on mac for me. Make sure you start it from a native terminal, not vscode

chfeizy commented 4 years ago

@alse I'm run with mac terminal, the display is not show, the record is success

chfeizy commented 4 years ago

image @alse

alse commented 4 years ago

@chfeizy the preview doesn't work on mac yet

Envek commented 4 years ago

Thank you very much! Let's use it as is and fix known issues later (maybe by someone else)