Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add mac support #19

Merged
merged 4 commits into from
Aug 28, 2020
Merged

add mac support #19

merged 4 commits into from
Aug 28, 2020

Conversation

alse
Copy link
Contributor

@alse alse commented Aug 12, 2020

@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

Copy link
Owner

@Envek Envek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

const displayId = 'display1';
function setupPreview(window, bounds) {
osn.NodeObs.OBS_content_createSourcePreviewDisplay(
window.getNativeWindowHandle(),
scene.name, // or use camera source Id here
displayId,
);

obsRecorder.js Show resolved Hide resolved
obsRecorder.js Outdated
Comment on lines 198 to 201
function getAudioDevices(type, subtype) {
const dummyDevice = osn.InputFactory.create(type, subtype, { device_id: 'does_not_exist' });
const dummyDevice = osn.InputFactory.create(
byOS({ [OS.Windows]: 'wasapi_input_capture', [OS.Mac]: 'coreaudio_input_capture' }),
uuid(),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getAudioDevices is being used to get both input and output sources, so it is better to detect of OS-specific types in places that call this function. And here just use type and subtype. Btw why uuid() is used here instead of provided subtype?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I reverted that change

@alse
Copy link
Contributor Author

alse commented Aug 12, 2020

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
Copy link
Contributor Author

alse commented Aug 13, 2020

@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
Copy link
Owner

Envek commented Aug 13, 2020

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
Copy link
Contributor Author

alse commented Aug 13, 2020

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!

Copy link
Owner

@Envek Envek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested it on Windows: it works. LGTM at this stage. Hope that you'll find solution for preview.

@psd-coder
Copy link

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

@Envek
Copy link
Owner

Envek commented Aug 14, 2020

That one looks like #18 (comment)

@alse
Copy link
Contributor Author

alse commented Aug 15, 2020

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

@psd-coder
Copy link

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

@alse
Copy link
Contributor Author

alse commented Aug 16, 2020

Great! What was wrong with the uuid require?

@psd-coder
Copy link

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

@chfeizy
Copy link

chfeizy commented Aug 22, 2020

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

@alse
Copy link
Contributor Author

alse commented Aug 22, 2020

@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
Copy link

chfeizy commented Aug 24, 2020

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

@chfeizy
Copy link

chfeizy commented Aug 24, 2020

image
@alse

@alse
Copy link
Contributor Author

alse commented Aug 24, 2020

@chfeizy the preview doesn't work on mac yet

@Envek Envek merged commit 7de96c6 into Envek:master Aug 28, 2020
@Envek
Copy link
Owner

Envek commented Aug 28, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants