Coder Social home page Coder Social logo

obs-studio-node-example's Introduction

Very simple example of obs-studio-node usage

Out of the box it works only on Windows. For running it on MacOS see below: Run on MacOS.

Setup

yarn install

Run

yarn start

or use F5 in Visual Studio Code.

Package

yarn dist

You find the generated installer in the dist folder.

Current state

It launches, initializes OBS Studio and lets you press "Start recording" button. On recording it captures your desktop video, your webcam picture (if available), audio, and microphone to the video file in Videos folder in your user profile directory. Look at main process' console output.

Example application screenshot

See this topic on how to solve black screen on laptops with two video cards.

Virtual Camera

After clicking the Install Plugin and the Start Virtual Camera button, a new webcam will be available for you to use in any other program (like Zoom or Microsoft Teams).

It will output exactly the same content which is displayed in the preview, in this case, it's the screen recording and maybe your webcam.

However, the webcam shows up as Streamlabs OBS Virtual Camera and we can't change the name for now (see #44).

Code of interest

Most of the interesting things are located in obsRecorder.js. Some snippets are taken verbatim from obs-studio-node tests and streamlabs-obs source code, but some are results of experiments.

Documentation

You can find some basic documentation here.

Run on MacOS

Change link to obs-studio-node in your package.json to include version of package built for MacOS:

 "obs-studio-node": "https://s3-us-west-2.amazonaws.com/obsstudionodes3.streamlabs.com/osn-0.9.5-release-osx.tar.gz",
 "node-window-rendering": "https://slobs-node-window-rendering.s3-us-west-2.amazonaws.com/node-window-rendering-1.0.12-osx.tar.gz"

To get the latest url, clone streamlabs-obs, run yarn install and copy it from the output.

Execute yarn:

yarn install

Start the app from a native terminal, not an integrated terminal like VSCode's.

node-window-rendering is used to support preview for MacOS.

There are some known issues with MacOS:

  • obs64 process doesn't shutdown on app quit (#22)
  • errors in log files (#18)

If you can help with those, please fix them and open a pull request!

Use with your own build of obs-studio-node

  1. Build it somewhere (look at the docs first)

    git clone https://github.com/stream-labs/obs-studio-node.git
    cd obs-studio-node
    yarn install
    git submodule update --init --recursive
    mkdir build
    cd build
    cmake .. -G"Visual Studio 15 2017" -A x64 -DCMAKE_INSTALL_PREFIX="SOME_WRITABLE_PATH"
    cmake --build . --config Release
    cpack -G TGZ
  2. Place path to it to package.json:

    {
        "devDependencies": {
            "obs-studio-node": "file://C:/where/you/cloned/obs-studio-node/build/obs-studio-node-0.3.21-win64.tar.gz"
        }
    }
    
  3. Install it to node_modules/

    yarn install
  4. Launch as usual:

    yarn start
    

Misc

OBS logs can be found in osn-data\node-obs\logs.

Tips and tricks

Change webcam resolution

let settings = obsCameraInput.settings;
settings['res_type'] = 1
settings['resolution'] = "1920x1080",
obsCameraInput.update(settings);
obsCameraInput.save();

See #31 for details.

License

As OBS Studio itself is published under the terms of GNU GPL version 2, obs-studio-node and all application that are using it (including this example application) also have to be open-sourced and published under the terms of GNU GPL version 2 or compatible license. Read more on tldrlegal.com.

obs-studio-node-example's People

Contributors

alse avatar davidsongzw avatar dependabot[bot] avatar envek avatar hrueger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

obs-studio-node-example's Issues

Virtual camera is not working on MacOS

I have added

"obs-studio-node": "https://s3-us-west-2.amazonaws.com/obsstudionodes3.streamlabs.com/osn-0.9.5-release-osx.tar.gz",
 "node-window-rendering": "https://slobs-node-window-rendering.s3-us-west-2.amazonaws.com/node-window-rendering-1.0.12-osx.tar.gz"

in my package.json file.

App is working fine and preview is also working fine. virtual camera plugin is also installed that is visible in google meet. In the app when I click Start virtual camera then it does not start virtual camera. obs64 cpu usages becomeo more than 100% and my laptop battery drains quickly.

On starting virtual camera in log I see

/Users/alok/Library/LaunchAgents/org.streamlabs.vcam-assistant.plist: service already loaded
[swscaler @ 0x7fa5f8afc000] Warning: data is not aligned! This can lead to a speed loss

How to change Display

Need to switch camera and desktop scene preview

let displayId = 'display_1';
let s_bounds;
export function setupPreview(window, bounds) {
displayId='display_'+scene.name;
s_bounds=bounds;
console.log(displayId);
osn.NodeObs.OBS_content_createSourcePreviewDisplay(
window.getNativeWindowHandle(),
scene.name, // or use camera source Id here
displayId,
);
osn.NodeObs.OBS_content_setShouldDrawUI(displayId, false);
osn.NodeObs.OBS_content_setPaddingSize(displayId, 0);
// Match padding color with main window background color
osn.NodeObs.OBS_content_setPaddingColor(displayId, 255, 255, 255);

return resizePreview(bounds);
}

and this can't change

How to build custom 32 bit obs-studio-node for this project

I am able to build 64bit obs-studio-node with custom OSN_LIBOBS_URL

But I am not able to build 32bit obs-studio-node with custom 32bit OSN_LIBOBS_URL
I followed following steps

First I built 32bit libobs using steps

  1. git clone --recursive https://github.com/stream-labs/obs-studio
  2. cd obs-studio
  3. mkdir build32
  4. cmake -G "Visual Studio 16 2019" -A Win32 -S . -B build32 -DDepsPath=C:\Users\alokm\Downloads\dependencies2019\win32 -DCMAKE_CONFIGURATION_TYPES=Release -DENABLE_UI=false -DENABLE_SCRIPTING=false
  5. cmake --build build32 --config Release
  6. cd .\build32\
  7. cpack -G TGZ
    I have got obs-studio/build32/obs-studio-x86-26.4.9-modified.tar.gz generated

I used this generated libobs for building obs-studio-node

  1. git clone https://github.com/stream-labs/obs-studio-node
  2. cd obs-studio-node
  3. mkdir build32
  4. cmake -G"Visual Studio 16 2019" -A Win32 -DOSN_LIBOBS_URL="C:/Users/alokm/tmp/streamlabs/obs-studio/build32/obs-studio-x86-26.4.9-modified.tar.gz" -B build32
  5. cmake --build build32 --config Release this step is giving linker error
util-crashmanager.obj : error LNK2019: unresolved external symbol "public: __thiscall base::FilePath::FilePath(void)" (??0FilePath@base@@QAE@XZ) re
ferenced in function "void __cdecl `dynamic initializer for 'db''(void)" (??__Edb@@YAXXZ) [C:\Users\alokm\tmp\streamlabs\obs-studio-node\build32\ob
s-studio-server\obs-studio-server.vcxproj]
util-crashmanager.obj : error LNK2019: unresolved external symbol "public: __thiscall base::FilePath::FilePath(class std::basic_string<wchar_t,stru
ct std::char_traits<wchar_t>,class std::allocator<wchar_t> > const &)" (??0FilePath@base@@QAE@ABV?$basic_string@_WU?$char_traits@_W@std@@V?$allocat
or@_W@2@@std@@@Z) referenced in function "private: static bool __cdecl util::CrashManager::SetupCrashpad(void)" (?SetupCrashpad@CrashManager@util@@
CA_NXZ) [C:\Users\alokm\tmp\streamlabs\obs-studio-node\build32\obs-studio-server\obs-studio-server.vcxproj]
util-crashmanager.obj : error LNK2019: unresolved external symbol "public: __thiscall base::FilePath::~FilePath(void)" (??1FilePath@base@@QAE@XZ) r
eferenced in function "void __cdecl `dynamic atexit destructor for 'db''(void)" (??__Fdb@@YAXXZ) [C:\Users\alokm\tmp\streamlabs\obs-studio-node\bui
ld32\obs-studio-server\obs-studio-server.vcxproj]
util-crashmanager.obj : error LNK2019: unresolved external symbol "public: class base::FilePath & __thiscall base::FilePath::operator=(class base::
FilePath const &)" (??4FilePath@base@@QAEAAV01@ABV01@@Z) referenced in function "private: static bool __cdecl util::CrashManager::SetupCrashpad(voi
d)" (?SetupCrashpad@CrashManager@util@@CA_NXZ) [C:\Users\alokm\tmp\streamlabs\obs-studio-node\build32\obs-studio-server\obs-studio-server.vcxproj]
util-crashmanager.obj : error LNK2019: unresolved external symbol "public: static class std::unique_ptr<class crashpad::CrashReportDatabase,struct
std::default_delete<class crashpad::CrashReportDatabase> > __cdecl crashpad::CrashReportDatabase::Initialize(class base::FilePath const &)" (?Initi
alize@CrashReportDatabase@crashpad@@SA?AV?$unique_ptr@VCrashReportDatabase@crashpad@@U?$default_delete@VCrashReportDatabase@crashpad@@@std@@@std@@A
BVFilePath@base@@@Z) referenced in function "private: static bool __cdecl util::CrashManager::SetupCrashpad(void)" (?SetupCrashpad@CrashManager@uti
l@@CA_NXZ) [C:\Users\alokm\tmp\streamlabs\obs-studio-node\build32\obs-studio-server\obs-studio-server.vcxproj]
util-crashmanager.obj : error LNK2019: unresolved external symbol "public: __thiscall crashpad::CrashpadClient::CrashpadClient(void)" (??0CrashpadC
lient@crashpad@@QAE@XZ) referenced in function "void __cdecl `dynamic initializer for 'client''(void)" (??__Eclient@@YAXXZ) [C:\Users\alokm\tmp\str
eamlabs\obs-studio-node\build32\obs-studio-server\obs-studio-server.vcxproj]
util-crashmanager.obj : error LNK2019: unresolved external symbol "public: __thiscall crashpad::CrashpadClient::~CrashpadClient(void)" (??1Crashpad
Client@crashpad@@QAE@XZ) referenced in function "void __cdecl `dynamic atexit destructor for 'client''(void)" (??__Fclient@@YAXXZ) [C:\Users\alokm\
tmp\streamlabs\obs-studio-node\build32\obs-studio-server\obs-studio-server.vcxproj]
util-crashmanager.obj : error LNK2019: unresolved external symbol "public: bool __thiscall crashpad::CrashpadClient::StartHandler(class base::FileP
ath const &,class base::FilePath const &,class base::FilePath const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocat
or<char> > const &,class std::map<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<c
har,struct std::char_traits<char>,class std::allocator<char> >,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class st
d::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char>
> const ,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > > const &,class std::vector<class std::basic_s
tring<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<cha
r>,class std::allocator<char> > > > const &,bool,bool)" (?StartHandler@CrashpadClient@crashpad@@QAE_NABVFilePath@base@@00ABV?$basic_string@DU?$char
_traits@D@std@@V?$allocator@D@2@@std@@ABV?$map@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@U?$less@V?$basic_string@DU?$char_t
raits@D@std@@V?$allocator@D@2@@std@@@2@V?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@@std@@@2@@6@ABV?$
vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@
@6@_N4@Z) referenced in function "private: static bool __cdecl util::CrashManager::SetupCrashpad(void)" (?SetupCrashpad@CrashManager@util@@CA_NXZ)
[C:\Users\alokm\tmp\streamlabs\obs-studio-node\build32\obs-studio-server\obs-studio-server.vcxproj]
util-crashmanager.obj : error LNK2019: unresolved external symbol "public: bool __thiscall crashpad::CrashpadClient::WaitForHandlerStart(unsigned i
nt)" (?WaitForHandlerStart@CrashpadClient@crashpad@@QAE_NI@Z) referenced in function "private: static bool __cdecl util::CrashManager::SetupCrashpa
d(void)" (?SetupCrashpad@CrashManager@util@@CA_NXZ) [C:\Users\alokm\tmp\streamlabs\obs-studio-node\build32\obs-studio-server\obs-studio-server.vcxp
roj]
util-crashmanager.obj : error LNK2019: unresolved external symbol "public: bool __thiscall crashpad::Settings::SetUploadsEnabled(bool)" (?SetUpload
sEnabled@Settings@crashpad@@QAE_N_N@Z) referenced in function "private: static bool __cdecl util::CrashManager::SetupCrashpad(void)" (?SetupCrashpa
d@CrashManager@util@@CA_NXZ) [C:\Users\alokm\tmp\streamlabs\obs-studio-node\build32\obs-studio-server\obs-studio-server.vcxproj]
C:\Users\alokm\tmp\streamlabs\obs-studio-node\build32\obs-studio-server\Release\obs32.exe : fatal error LNK1120: 10 unresolved externals [C:\Users\
alokm\tmp\streamlabs\obs-studio-node\build32\obs-studio-server\obs-studio-server.vcxproj]

What I am missing in case of 32bit building?

Creating 'window_capture' & 'game_capture' inputs

Hey! The example works great, however it doesn't provide any examples other than Display, Audio Device, and Video Device capture.

The examples provide clear and intuitive usage on those inputs, but others are not as easy to use, due to lack of documentation.

For example, I have tried to create a game capture source like so:
const gameSource = osn.InputFactory.create('game_capture', 'game-source');

However, I wasn't able to understand how to define a window/source for the game capture. The gameSource.settings also do not show a way to add a source:

{
allow_transparency: false,
anti_cheat_hook: true,
auto_capture_rules_path: '',
auto_placeholder_image: '',
auto_placeholder_message: 'Looking for a game to caputure',
capture_cursor: true,
capture_mode: 'auto',
capture_overlays: false,
force_scaling: false,
hook_rate: 1,
limit_framerate: true,
priority: 2,
scale_res: '0x0',
sli_compatibility: false
}

If someone could provide an simple example on creating a 'game_capture' and 'window_capture', would greatly appreciate it!

obs-browser-page.so image not found

[000:00:00:37.132.340.573][Info] Appdata is /Users/also/www/obs-studio-node-example/osn-data
[000:00:00:37.133.100.117][Error] config_save_safe: failed to write to /Users/also/www/obs-studio-node-example/osn-data/global.ini.tmp
[000:00:00:37.135.224.069][Info] About to reset the video context
[000:00:00:37.138.540.987][Info] ---------------------------------
[000:00:00:37.138.562.564][Info] Initializing OpenGL...
[000:00:00:37.166.023.874][Info] Loading up OpenGL on adapter ATI Technologies Inc. AMD Radeon Pro 560X OpenGL Engine
[000:00:00:37.166.078.206][Info] OpenGL loaded successfully, version 4.1 ATI-3.10.15, shading language 4.10
[000:00:00:37.262.233.164][Info] ---------------------------------
[000:00:00:37.262.262.875][Info] video settings reset:
[000:00:00:37.262.262.875][Info] base resolution: 1680x1050
[000:00:00:37.262.262.875][Info] output resolution: 1280x720
[000:00:00:37.262.262.875][Info] downscale filter: Bicubic
[000:00:00:37.262.262.875][Info] fps: 30/1
[000:00:00:37.262.262.875][Info] format: NV12
[000:00:00:37.262.262.875][Info] YUV mode: 601/Partial
[000:00:00:37.262.417.643][Info] NV12 texture support not available
[000:00:00:37.262.486.748][Info] g_moduleDirectory: /Users/also/www/obs-studio-node-example/node_modules/obs-studio-node
[000:00:00:37.262.915.403][Debug] ---------------------------------
[000:00:00:37.264.349.441][Debug] Required module function 'obs_module_load' in module '/Users/also/www/obs-studio-node-example/node_modules/obs-studio-node/obs-plugins/libEGL.dylib' not found, loading of module failed
[000:00:00:37.264.397.459][Debug] ---------------------------------
[000:00:00:37.265.424.620][Debug] Loading module: coreaudio-encoder.so
[000:00:00:37.266.802.278][Debug] ---------------------------------
[000:00:00:37.268.279.297][Debug] Loading module: obs-transitions.so
[000:00:00:37.269.158.750][Debug] ---------------------------------
[000:00:00:37.269.858.463][Debug] Loading module: image-source.so
[000:00:00:37.270.647.314][Debug] ---------------------------------
[000:00:00:37.270.847.457][Error] os_dlopen(/Users/also/www/obs-studio-node-example/node_modules/obs-studio-node/obs-plugins/obs-browser-page->/Users/also/www/obs-studio-node-example/node_modules/obs-studio-node/obs-plugins/obs-browser-page.so): dlopen(/Users/also/www/obs-studio-node-example/node_modules/obs-studio-node/obs-plugins/obs-browser-page.so, 257): image not found
[000:00:00:37.270.847.457][Error]
[000:00:00:37.270.882.504][Warning] Module '/Users/also/www/obs-studio-node-example/node_modules/obs-studio-node/obs-plugins/obs-browser-page' not loaded
[000:00:00:37.270.913.563][Debug] ---------------------------------
[000:00:00:37.276.784.444][Debug] Required module function 'obs_module_load' in module '/Users/also/www/obs-studio-node-example/node_modules/obs-studio-node/obs-plugins/libswiftshader_libEGL.dylib' not found, loading of module failed
[000:00:00:37.276.850.801][Debug] ---------------------------------
[000:00:00:37.283.269.606][Debug] Loading module: obs-ffmpeg.so
[000:00:00:37.284.534.736][Debug] ---------------------------------
[000:00:00:37.285.955.726][Debug] Loading module: mac-decklink.so
[000:00:00:37.286.784.789][Info] No blackmagic support
[000:00:00:37.286.804.199][Debug] Failed to start search for DeckLink devices
[000:00:00:37.286.829.530][Debug] ---------------------------------
[000:00:00:37.287.904.957][Debug] Loading module: mac-vth264.so
[000:00:00:37.372.248.948][Info] [VideoToolbox encoder]: Adding VideoToolbox H264 encoders
[000:00:00:37.372.307.658][Debug] ---------------------------------
[000:00:00:37.374.529.959][Debug] Loading module: rtmp-services.so
[000:00:00:37.375.812.494][Debug] ---------------------------------
[000:00:00:37.437.299.893][Debug] Loading module: obs-browser.so
[000:00:00:37.437.927.512][Info] [obs-browser]: Version 2.7.11
[000:00:00:37.438.014.490][Debug] ---------------------------------
[000:00:00:37.440.124.588][Debug] Loading module: obs-x264.so
[000:00:00:37.440.748.764][Debug] ---------------------------------
[000:00:00:37.441.916.148][Error] os_dlopen(/Users/also/www/obs-studio-node-example/node_modules/obs-studio-node/obs-plugins/obs-libfdk.so->/Users/also/www/obs-studio-node-example/node_modules/obs-studio-node/obs-plugins/obs-libfdk.so): dlopen(/Users/also/www/obs-studio-node-example/node_modules/obs-studio-node/obs-plugins/obs-libfdk.so, 257): Library not loaded: /usr/local/opt/fdk-aac/lib/libfdk-aac.2.dylib
[000:00:00:37.441.916.148][Error] Referenced from: /Users/also/www/obs-studio-node-example/node_modules/obs-studio-node/obs-plugins/obs-libfdk.so
[000:00:00:37.441.916.148][Error] Reason: image not found
[000:00:00:37.441.916.148][Error]
[000:00:00:37.441.966.333][Warning] Module '/Users/also/www/obs-studio-node-example/node_modules/obs-studio-node/obs-plugins/obs-libfdk.so' not loaded
[000:00:00:37.441.999.466][Debug] ---------------------------------
[000:00:00:37.443.096.352][Debug] Loading module: vlc-video.so
[000:00:00:37.447.162.433][Info] VLC found, VLC video source enabled
[000:00:00:37.447.218.126][Debug] ---------------------------------
[000:00:00:37.450.847.277][Debug] Required module function 'obs_module_load' in module '/Users/also/www/obs-studio-node-example/node_modules/obs-studio-node/obs-plugins/libGLESv2.dylib' not found, loading of module failed
[000:00:00:37.451.057.754][Debug] ---------------------------------
[000:00:00:37.452.765.043][Debug] Loading module: mac-avcapture.so
[000:00:00:37.541.725.535][Debug] ---------------------------------
[000:00:00:37.544.712.405][Debug] Required module function 'obs_module_load' in module '/Users/also/www/obs-studio-node-example/node_modules/obs-studio-node/obs-plugins/libswiftshader_libGLESv2.dylib' not found, loading of module failed
[000:00:00:37.544.771.974][Debug] ---------------------------------
[000:00:00:37.545.780.239][Debug] Loading module: mac-capture.so
[000:00:00:37.546.340.349][Debug] ---------------------------------
[000:00:00:37.549.562.826][Debug] Loading module: obs-outputs.so
[000:00:00:37.550.117.192][Debug] ---------------------------------
[000:00:00:37.551.684.631][Debug] Loading module: obs-filters.so
[000:00:00:37.552.330.215][Debug] ---------------------------------
[000:00:00:37.553.720.137][Debug] Loading module: mac-syphon.so
[000:00:00:37.554.271.193][Debug] ---------------------------------
[000:00:00:37.556.668.595][Debug] Loading module: text-freetype2.so
[000:00:00:37.557.266.306][Debug] ---------------------------------
[000:00:00:37.558.277.126][Debug] Loading module: obs-ndi.so
[000:00:00:37.558.846.556][Info] [obs-ndi] hello ! (version 4.7.1)
[000:00:00:37.558.882.295][Info] [obs-ndi] Trying to load lib at: /usr/lib/libndi.4.dylib
[000:00:00:37.558.900.882][Info] [obs-ndi] Trying to load lib at: /usr/local/lib/libndi.4.dylib
[000:00:00:37.558.925.002][Error] [obs-ndi] Can't find the NDI library
[000:00:00:37.558.939.446][Error] [obs-ndi] Error when loading the library.
[000:00:00:37.558.948.456][Warning] Failed to initialize module 'obs-ndi.so'
[000:00:00:37.561.838.615][Debug] service 'default_service' (rtmp_common) created
[000:00:00:37.573.304.065][Debug] output 'simple_stream' (rtmp_output) created
[000:00:00:37.573.498.400][Debug] output 'simple_file_output' (ffmpeg_muxer) created
[000:00:00:37.573.820.358][Debug] output 'ReplayBuffer' (replay_buffer) created
[000:00:00:37.573.861.030][Debug] encoder 'streaming_h264' (obs_x264) created
[000:00:00:37.630.988.440][Debug] [CoreAudio encoder]: Default bitrate matching log for bitrate 128:
[000:00:00:37.630.988.440][Debug] Trying kAudioFormatMPEG4AAC_HE_V2 (0x61616370)
[000:00:00:37.630.988.440][Debug] Found new best match 20000
[000:00:00:37.630.988.440][Debug] Found new best match 24000
[000:00:00:37.630.988.440][Debug] Found new best match 28000
[000:00:00:37.630.988.440][Debug] Found new best match 32000
[000:00:00:37.630.988.440][Debug] Found new best match 40000
[000:00:00:37.630.988.440][Debug] Found new best match 48000
[000:00:00:37.630.988.440][Debug] Trying kAudioFormatMPEG4AAC_HE (0x61616368)
[000:00:00:37.630.988.440][Debug] Found new best match 56000
[000:00:00:37.630.988.440][Debug] Found new best match 64000
[000:00:00:37.630.988.440][Debug] Found new best match 80000
[000:00:00:37.630.988.440][Debug] Trying kAudioFormatMPEG4AAC (0x61616320)
[000:00:00:37.630.988.440][Debug] Found new best match 96000
[000:00:00:37.630.988.440][Debug] Found new best match 112000
[000:00:00:37.630.988.440][Debug] Found new best match 128000
[000:00:00:37.631.289.675][Debug] [CoreAudio encoder]: Sample rate enumeration log:
[000:00:00:37.631.289.675][Debug] Trying kAudioFormatMPEG4AAC_HE_V2 (0x61616370)
[000:00:00:37.631.289.675][Debug] Adding sample rate 32000
[000:00:00:37.631.289.675][Debug] Adding sample rate 44100
[000:00:00:37.631.289.675][Debug] Adding sample rate 48000
[000:00:00:37.631.289.675][Debug] Trying kAudioFormatMPEG4AAC_HE (0x61616368)
[000:00:00:37.631.289.675][Debug] Adding sample rate 16000
[000:00:00:37.631.289.675][Debug] Adding sample rate 22050
[000:00:00:37.631.289.675][Debug] Adding sample rate 24000
[000:00:00:37.631.289.675][Debug] Sample rate 32000 already added
[000:00:00:37.631.289.675][Debug] Sample rate 44100 already added
[000:00:00:37.631.289.675][Debug] Sample rate 48000 already added
[000:00:00:37.631.289.675][Debug] Adding sample rate 88200
[000:00:00:37.631.289.675][Debug] Adding sample rate 96000
[000:00:00:37.631.289.675][Debug] Trying kAudioFormatMPEG4AAC (0x61616320)
[000:00:00:37.631.289.675][Debug] Adding sample rate 8000
[000:00:00:37.631.289.675][Debug] Adding sample rate 11025
[000:00:00:37.631.289.675][Debug] Adding sample rate 12000
[000:00:00:37.631.289.675][Debug] Sample rate 16000 already added
[000:00:00:37.631.289.675][Debug] Sample rate 22050 already added
[000:00:00:37.631.289.675][Debug] Sample rate 24000 already added
[000:00:00:37.631.289.675][Debug] Sample rate 32000 already added
[000:00:00:37.631.289.675][Debug] Sample rate 44100 already added
[000:00:00:37.631.289.675][Debug] Sample rate 48000 already added
[000:00:00:37.631.423.782][Error] [CoreAudio encoder]: Couldn't find available bitrates
[000:00:00:37.631.445.495][Error] [CoreAudio encoder]: Couldn't find available bitrates
[000:00:00:37.631.466.214][Error] [CoreAudio encoder]: Couldn't find available bitrates
[000:00:00:37.631.505.239][Debug] AAC encoder bitrate mapping:
[000:00:00:37.631.505.239][Debug] 64 kbit/s: 'FFmpeg Default AAC Encoder' (ffmpeg_aac)
[000:00:00:37.631.505.239][Debug] 96 kbit/s: 'FFmpeg Default AAC Encoder' (ffmpeg_aac)
[000:00:00:37.631.505.239][Debug] 128 kbit/s: 'FFmpeg Default AAC Encoder' (ffmpeg_aac)
[000:00:00:37.631.505.239][Debug] 160 kbit/s: 'FFmpeg Default AAC Encoder' (ffmpeg_aac)
[000:00:00:37.631.505.239][Debug] 192 kbit/s: 'FFmpeg Default AAC Encoder' (ffmpeg_aac)
[000:00:00:37.631.505.239][Debug] 224 kbit/s: 'FFmpeg Default AAC Encoder' (ffmpeg_aac)
[000:00:00:37.631.505.239][Debug] 256 kbit/s: 'FFmpeg Default AAC Encoder' (ffmpeg_aac)
[000:00:00:37.631.505.239][Debug] 288 kbit/s: 'FFmpeg Default AAC Encoder' (ffmpeg_aac)
[000:00:00:37.631.505.239][Debug] 320 kbit/s: 'FFmpeg Default AAC Encoder' (ffmpeg_aac)
[000:00:00:37.631.570.024][Debug] encoder 'streaming_h264' destroyed
[000:00:00:37.631.935.125][Debug] encoder 'streaming_h264' (obs_x264) created
[000:00:00:37.633.808.251][Debug] obs_encoder_update: Null 'encoder' parameter
[000:00:00:37.633.833.494][Debug] encoder 'simple_h264_recording' (obs_x264) created
[000:00:00:37.633.846.743][Info] ---------------------------------
[000:00:00:37.633.854.790][Info] audio settings reset:
[000:00:00:37.633.854.790][Info] samples per sec: 44100
[000:00:00:37.633.854.790][Info] speakers: 2
[000:00:00:37.634.551.077][Info] About to reset the video context
[000:00:00:37.668.255.834][Info] ---------------------------------
[000:00:00:37.668.312.153][Info] video settings reset:
[000:00:00:37.668.312.153][Info] base resolution: 1680x1050
[000:00:00:37.668.312.153][Info] output resolution: 1280x720
[000:00:00:37.668.312.153][Info] downscale filter: Bicubic
[000:00:00:37.668.312.153][Info] fps: 30/1
[000:00:00:37.668.312.153][Info] format: NV12
[000:00:00:37.668.312.153][Info] YUV mode: 601/Partial
[000:00:00:37.668.443.420][Info] NV12 texture support not available
[000:00:00:37.668.543.985][Debug] encoder 'adv_aac0' (ffmpeg_aac) created
[000:00:00:37.668.565.213][Debug] encoder 'adv_aac1' (ffmpeg_aac) created
[000:00:00:37.668.577.888][Debug] encoder 'adv_aac2' (ffmpeg_aac) created
[000:00:00:37.668.587.985][Debug] encoder 'adv_aac3' (ffmpeg_aac) created
[000:00:00:37.668.597.983][Debug] encoder 'adv_aac4' (ffmpeg_aac) created
[000:00:00:37.668.607.882][Debug] encoder 'adv_aac5' (ffmpeg_aac) created
[000:00:00:37.668.618.555][Info] Audio monitoring device:
[000:00:00:37.668.618.555][Info] name: Default
[000:00:00:37.668.618.555][Info] id: default
[000:00:00:37.668.645.047][Info] Init success
[000:00:00:37.679.643.705][Debug] encoder 'streaming_h264' (obs_x264) created
[000:00:00:37.679.723.592][Debug] encoder 'streaming_h264' destroyed
[000:00:00:37.681.379.689][Error] Encoder ID 'none' not found
[000:00:00:37.681.545.264][Debug] encoder 'recording_h264' (none) created
[000:00:00:37.681.579.019][Debug] encoder 'simple_h264_recording' destroyed
[000:00:00:37.681.630.932][Warning] Failed to save encoder /Users/also/www/obs-studio-node-example/osn-data/recordEncoder.json
[000:00:00:37.686.547.014][Debug] encoder 'streaming_h264' (obs_x264) created
[000:00:00:37.686.609.349][Debug] encoder 'streaming_h264' destroyed
[000:00:00:37.686.734.249][Error] Encoder ID 'none' not found
[000:00:00:37.686.766.956][Debug] encoder 'recording_h264' (none) created
[000:00:00:37.686.785.229][Debug] encoder 'recording_h264' destroyed
[000:00:00:37.686.814.485][Warning] Failed to save encoder /Users/also/www/obs-studio-node-example/osn-data/recordEncoder.json
[000:00:00:37.691.566.722][Debug] encoder 'streaming_h264' (obs_x264) created
[000:00:00:37.691.589.444][Debug] encoder 'streaming_h264' destroyed
[000:00:00:37.691.748.203][Debug] encoder 'recording_h264' (vt_h264_hw) created
[000:00:00:37.691.762.482][Debug] encoder 'recording_h264' destroyed
[000:00:00:37.695.762.984][Debug] encoder 'streaming_h264' (obs_x264) created
[000:00:00:37.695.782.497][Debug] encoder 'streaming_h264' destroyed
[000:00:00:37.695.982.041][Debug] encoder 'recording_h264' (vt_h264_hw) created
[000:00:00:37.695.997.497][Debug] encoder 'recording_h264' destroyed
[000:00:00:37.700.066.478][Debug] encoder 'streaming_h264' (obs_x264) created
[000:00:00:37.700.088.414][Debug] encoder 'streaming_h264' destroyed
[000:00:00:37.700.245.664][Debug] encoder 'recording_h264' (vt_h264_hw) created
[000:00:00:37.700.260.532][Debug] encoder 'recording_h264' destroyed
[000:00:00:37.714.936.775][Info] About to reset the video context
[000:00:00:37.739.817.558][Info] ---------------------------------
[000:00:00:37.739.872.453][Info] video settings reset:
[000:00:00:37.739.872.453][Info] base resolution: 1680x1050
[000:00:00:37.739.872.453][Info] output resolution: 1280x720
[000:00:00:37.739.872.453][Info] downscale filter: Bicubic
[000:00:00:37.739.872.453][Info] fps: 60/1
[000:00:00:37.739.872.453][Info] format: NV12
[000:00:00:37.739.872.453][Info] YUV mode: 601/Partial
[000:00:00:37.739.972.205][Info] NV12 texture support not available
[000:00:00:37.741.256.593][Error] Source ID 'monitor_capture' not found
[000:00:00:37.741.527.470][Error] Failed to create source 'desktop-video'!
[000:00:00:37.741.551.216][Debug] source 'desktop-video' (monitor_capture) created
[000:00:00:37.760.615.994][Info] About to reset the video context
[000:00:00:37.775.926.906][Info] ---------------------------------
[000:00:00:37.775.990.578][Info] video settings reset:
[000:00:00:37.775.990.578][Info] base resolution: 1920x1200
[000:00:00:37.775.990.578][Info] output resolution: 1280x720
[000:00:00:37.775.990.578][Info] downscale filter: Bicubic
[000:00:00:37.775.990.578][Info] fps: 60/1
[000:00:00:37.775.990.578][Info] format: NV12
[000:00:00:37.775.990.578][Info] YUV mode: 601/Partial
[000:00:00:37.776.107.501][Info] NV12 texture support not available
[000:00:00:37.782.038.715][Info] About to reset the video context
[000:00:00:37.793.847.953][Info] ---------------------------------
[000:00:00:37.793.881.914][Info] video settings reset:
[000:00:00:37.793.881.914][Info] base resolution: 1920x1200
[000:00:00:37.793.881.914][Info] output resolution: 1920x1200
[000:00:00:37.793.881.914][Info] downscale filter: Bicubic
[000:00:00:37.793.881.914][Info] fps: 60/1
[000:00:00:37.793.881.914][Info] format: NV12
[000:00:00:37.793.881.914][Info] YUV mode: 601/Partial
[000:00:00:37.794.031.021][Info] NV12 texture support not available
[000:00:00:37.795.092.201][Debug] source 'test-scene' (scene) created
[000:00:00:37.798.573.728][Error] Source ID 'dshow_input' not found
[000:00:00:37.798.758.848][Error] Failed to create source 'video'!
[000:00:00:37.798.776.265][Debug] source 'video' (dshow_input) created

Error in starting app with custom obs-studio-node built with latest code

As dependency this app using

"obs-studio-node": "https://obsstudionodes3.streamlabs.com/osn-0.10.10-release-win64.tar.gz"

I wanted to try custom built obs-studio-node. I created that using steps given in README.md
when I try to run app using custom obs-studio-node I am getting error

$ yarn start
yarn run v1.22.10
$ electron .

App threw an error during load
Error: The specified module could not be found.
\\?\C:\Users\User\projects\obs-studio-node-example\node_modules\obs-studio-node\obs_studio_client.node
    at process.func [as dlopen] (electron/js2c/asar.js:140:31)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1196:18)
    at Object.func [as .node] (electron/js2c/asar.js:140:31)
    at Module.load (internal/modules/cjs/loader.js:981:32)
    at Module._load (internal/modules/cjs/loader.js:881:14)
    at Function.Module._load (electron/js2c/asar.js:769:28)
    at Module.require (internal/modules/cjs/loader.js:1023:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (C:\Users\User\projects\obs-studio-node-example\node_modules\obs-studio-node\module.js:3:13)
    at Module._compile (internal/modules/cjs/loader.js:1145:30)

I have confirmed that C:\Users\User\projects\obs-studio-node-example\node_modules\obs-studio-node\obs_studio_client.node exists.

My system details are:
OS: Windows 10 enterprise
Node: 14.16.0

Camera results in infinite loop when physical camera is off

I have a webcam, which is actually a DSLR with some kind of capture card. When the DSLR is off, the capture card is shown in Windows as a Webcam, but in OBS its with and height are 0.

The example app detects it as a camera input, but then gets stuck in an infinite loop waiting for the camera width to be other than 0, which does never happen.

Maybe we need another way to check for the initialization of the camera?

Cannot not find any camera on macOS

Hi,
My environment:
Intel i9 MacBookPro with macOS 11 Big Sur
My build parameters:
obs-studio-node-0.3.21-Darwin.tar.gz (which is built myself by XCode 13.2.1)
https://slobs-node-window-rendering.s3-us-west-2.amazonaws.com/node-window-rendering-1.0.15-osx.tar.gz (Download)

I can't get neither embedded camera nor usb cam. Log in Terminal is here:
yarn run v1.22.17 $ electron . Initializing OBS... Version recv: DEVMODE_VERSION Version compiled DEVMODE_VERSION [000:00:00:00.978.805.081][Error] Plugin Path provided is invalid: /Users/kensington/repo/obs-studio-node-example/node_modules/obs-studio-node/obs-plugins/64bit Plugin Path provided is invalid: /Users/kensington/repo/obs-studio-node-example/node_modules/obs-studio-node/obs-plugins/64bit Failed to initialize module /Users/kensington/repo/obs-studio-node-example/node_modules/obs-studio-node/obs-plugins/libEGL.dylib [000:00:00:00.979.821.676][Error] os_dlopen(/Users/kensington/repo/obs-studio-node-example/node_modules/obs-studio-node/obs-plugins/vk_swiftshader_icd.json->/Users/kensington/repo/obs-studio-node-example/node_modules/obs-studio-node/obs-plugins/vk_swiftshader_icd.json.so): dlopen(/Users/kensington/repo/obs-studio-node-example/node_modules/obs-studio-node/obs-plugins/vk_swiftshader_icd.json.so, 257): image not found [000:00:00:00.979.821.676][Error] [000:00:00:00.979.878.246][Warning] Module '/Users/kensington/repo/obs-studio-node-example/node_modules/obs-studio-node/obs-plugins/vk_swiftshader_icd.json' not loaded Unable to load '/Users/kensington/repo/obs-studio-node-example/node_modules/obs-studio-node/obs-plugins/vk_swiftshader_icd.json', could not find file. Failed to initialize module /Users/kensington/repo/obs-studio-node-example/node_modules/obs-studio-node/obs-plugins/libswiftshader_libEGL.dylib [000:00:00:03.041.512.985][Warning] A DeckLink iterator could not be created. The DeckLink drivers may not be installed Unable to load '/Users/kensington/repo/obs-studio-node-example/node_modules/obs-studio-node/obs-plugins/libvk_swiftshader.dylib', missing exports. dlopen /Users/kensington/repo/obs-studio-node-example/node_modules/obs-studio-node/../Frameworks/Chromium Embedded Framework.framework/Chromium Embedded Framework: dlopen(/Users/kensington/repo/obs-studio-node-example/node_modules/obs-studio-node/../Frameworks/Chromium Embedded Framework.framework/Chromium Embedded Framework, 261): image not found Failed to load the CEF framework. [000:00:00:04.205.562.279][Warning] Failed to initialize module 'obs-browser.so' Failed to initialize module /Users/kensington/repo/obs-studio-node-example/node_modules/obs-studio-node/obs-plugins/obs-browser.so [000:00:00:04.715.430.569][Error] os_dlopen(/Users/kensington/repo/obs-studio-node-example/node_modules/obs-studio-node/obs-plugins/obs-libfdk.so->/Users/kensington/repo/obs-studio-node-example/node_modules/obs-studio-node/obs-plugins/obs-libfdk.so): dlopen(/Users/kensington/repo/obs-studio-node-example/node_modules/obs-studio-node/obs-plugins/obs-libfdk.so, 257): Library not loaded: @executable_path/libfdk-aac.2.dylib [000:00:00:04.715.430.569][Error] Referenced from: /Users/kensington/repo/obs-studio-node-example/node_modules/obs-studio-node/obs-plugins/obs-libfdk.so [000:00:00:04.715.430.569][Error] Reason: image not found [000:00:00:04.715.430.569][Error] [000:00:00:04.715.536.938][Warning] Module '/Users/kensington/repo/obs-studio-node-example/node_modules/obs-studio-node/obs-plugins/obs-libfdk.so' not loaded Unable to load '/Users/kensington/repo/obs-studio-node-example/node_modules/obs-studio-node/obs-plugins/obs-libfdk.so', could not find file. [000:00:00:04.970.524.705][Error] os_dlopen(/Applications/VLC.app/Contents/MacOS/lib/libvlccore.dylib->/Applications/VLC.app/Contents/MacOS/lib/libvlccore.dylib): dlopen(/Applications/VLC.app/Contents/MacOS/lib/libvlccore.dylib, 257): image not found [000:00:00:04.970.524.705][Error] Failed to initialize module /Users/kensington/repo/obs-studio-node-example/node_modules/obs-studio-node/obs-plugins/libGLESv2.dylib Failed to initialize module /Users/kensington/repo/obs-studio-node-example/node_modules/obs-studio-node/obs-plugins/libswiftshader_libGLESv2.dylib [000:00:00:08.135.501.081][Error] [obs-ndi] Can't find the NDI library [000:00:00:08.135.582.954][Error] [obs-ndi] Error when loading the library. [000:00:00:08.135.614.518][Warning] Failed to initialize module 'obs-ndi.so' Failed to initialize module /Users/kensington/repo/obs-studio-node-example/node_modules/obs-studio-node/obs-plugins/obs-ndi.so [000:00:00:08.135.932.354][Error] Plugin Path provided is invalid: /Users/kensington/repo/obs-studio-node-exa/slobs-plugins/obs-plugins/64bit Plugin Path provided is invalid: /Users/kensington/repo/obs-studio-node-exa/slobs-plugins/obs-plugins/64bit [000:00:00:08.231.387.126][Error] [CoreAudio encoder]: Couldn't find available bitrates [000:00:00:08.231.417.139][Error] [CoreAudio encoder]: Couldn't find available bitrates OBS initialized Configuring OBS OBS Configured Trying to set up web camera... [000:00:00:08.373.662.392][Warning] video: Could not initialize device with unique ID 'does_not_exist' cameraItems[0].name: Waiting for 100ms until camera get initialized. Waiting for 200ms until camera get initialized. Waiting for 300ms until camera get initialized. Waiting for 400ms until camera get initialized. Found camera "" doesn't seem to work as its reported width is still zero. [000:00:00:09.651.209.552][Error] glClear failed, glGetError returned GL_INVALID_FRAMEBUFFER_OPERATION(0x506) [000:00:00:09.651.243.417][Error] device_clear (GL) failed [000:00:00:09.651.262.862][Error] glViewport failed, glGetError returned GL_INVALID_VALUE(0x501) [000:00:00:09.651.273.588][Error] device_set_viewport (GL) failed [000:00:00:09.651.284.077][Error] glClear failed, glGetError returned GL_INVALID_FRAMEBUFFER_OPERATION(0x506) [000:00:00:09.651.293.932][Error] device_clear (GL) failed [000:00:00:09.651.806.364][Error] glDrawArrays failed, glGetError returned GL_INVALID_FRAMEBUFFER_OPERATION(0x506) [000:00:00:09.651.828.527][Error] device_draw (GL) failed [000:00:00:09.651.910.032][Error] glDrawArrays failed, glGetError returned GL_INVALID_FRAMEBUFFER_OPERATION(0x506) [000:00:00:09.651.927.398][Error] device_draw (GL) failed [000:00:00:09.666.288.642][Error] glClear failed, glGetError returned GL_INVALID_FRAMEBUFFER_OPERATION(0x506) [000:00:00:09.666.317.854][Error] device_clear (GL) failed [000:00:00:09.666.330.804][Error] glClear failed, glGetError returned GL_INVALID_FRAMEBUFFER_OPERATION(0x506) [000:00:00:09.666.340.679][Error] device_clear (GL) failed [000:00:00:09.666.355.599][Error] glDrawArrays failed, glGetError returned GL_INVALID_FRAMEBUFFER_OPERATION(0x506) [000:00:00:09.666.366.128][Error] device_draw (GL) failed [000:00:00:09.666.444.746][Error] glDrawArrays failed, glGetError returned GL_INVALID_FRAMEBUFFER_OPERATION(0x506) [000:00:00:09.666.459.244][Error] device_draw (GL) failed [000:00:00:09.666.484.492][Error] glReadPixels failed, glGetError returned GL_INVALID_FRAMEBUFFER_OPERATION(0x506) [1808:0112/094336.498806:ERROR:CONSOLE(1)] "Uncaught TypeError: Cannot read property 'instance' of undefined", source: devtools://devtools/bundled/devtools_app.html?remoteBase=https://chrome-devtools-frontend.appspot.com/serve_file/@e40327ead64ef3f7d9f196b4eeb5c0c61cb5799/&can_dock=true&toolbarColor=rgba(223,223,223,1)&textColor=rgba(0,0,0,1)&experiments=true (1)

And I also attached log file 2022-01-12 09-43-26.txt in /osn-data
Is any idea or what I missed? Thanks a lot!!

Virtual camera not work

Reproduce steps: (win10)

  1. clone the rep
  2. yarn
  3. launch vcam as below
  4. add cvam to desktop apps. Zoom or desktop app links

Issue:
Can't be added to other live apps. Format not support

Zoom:
img_v3_02a9_2a02c212-0161-4d9d-9352-92ce18ea7c5g

Douyin:
image

Expected:
Have some way to adjust vcam output format,thus can be added

JavaScript runtime error: parameterSettings is undefined

Hi,
It's working with Electron 6.
However, I get the following error after I ran npm start:
grafik
I could fix it by change the getAvailableValues() function to this:

function getAvailableValues(category, subcategory, parameter) {
  const categorySettings = osn.NodeObs.OBS_settings_getSettings(category).data;
  const subcategorySettings = categorySettings.find(sub => sub.nameSubCategory === subcategory);
  const parameterSettings = subcategorySettings.parameters.find(param => param.name === parameter);
  if (parameterSettings && parameterSettings.values) {
    return parameterSettings.values.map(value => Object.values(value)[0]);
  }
  return [];
}

Then it's working.
Just for reference, categorySettings is

[
  { nameSubCategory: 'Untitled', parameters: [ [Object] ] },
  {
    nameSubCategory: 'Streaming',
    parameters: [ [Object], [Object], [Object], [Object] ]
  },
  {
    nameSubCategory: 'Recording',
    parameters: [ [Object], [Object], [Object], [Object], [Object] ]
  },
  {
    nameSubCategory: 'Replay Buffer',
    parameters: [ [Object], [Object] ]
  }
]

subcategorySettings is

  nameSubCategory: 'Recording',
  parameters: [
    {
      name: 'FilePath',
      type: 'OBS_PROPERTY_PATH',
      description: 'Recording Path',
      subType: '',
      currentValue: 'C:\\Users\\Hannes\\Desktop\\Angular\\obs-studio-node-example\\videos',
      values: [],
      visible: true,
      enabled: true,
      masked: false
    },
    {
      name: 'FileNameWithoutSpace',
      type: 'OBS_PROPERTY_BOOL',
      description: 'Generate File Name without Space',
      subType: '',
      currentValue: false,
      values: [],
      visible: true,
      enabled: true,
      masked: false
    },
    {
      name: 'RecQuality',
      type: 'OBS_PROPERTY_LIST',
      description: 'Recording Quality',
      subType: 'OBS_COMBO_FORMAT_STRING',
      currentValue: 'Stream',
      values: [Array],
      visible: true,
      enabled: true,
      masked: false
    },
    {
      name: 'RecFormat',
      type: 'OBS_PROPERTY_LIST',
      description: 'Recording Format',
      subType: 'OBS_COMBO_FORMAT_STRING',
      currentValue: 'mkv',
      values: [Array],
      visible: true,
      enabled: true,
      masked: false
    },
    {
      name: 'MuxerCustom',
      type: 'OBS_PROPERTY_EDIT_TEXT',
      description: 'Custom Muxer Settings',
      subType: '',
      currentValue: '',
      values: [],
      visible: true,
      enabled: true,
      masked: false
    }
  ]
}

and parameterSettings is then undefined.

I also noticed that only about 2/3 of my screen were recorded and in the logs (attached) it says this:

video settings reset:
    base resolution:   1536x960
    output resolution: 1228x768

My screen, however, is 1920x1200.
I don't know much about OBS, but I don't think this problem belongs to the RecEncoder settings, does it?

2020-04-13 06-51-24.txt

Using the correct scene resolution in multi-monitor setups

Simply using the primary screen resolution obtained from Electron is sufficient when there's just one monitor. However, some cases fail when there are more displays.

Thus far, I haven't been able to track down a consistent way to determine the correct resolution of a given monitor (indexed by obs-studio-node via 0, 1, ...) and use it for the scene.

Will make a post if I find something.

Padding bars around display

I needed to remove the padding around the display, because my display is in a fullscreen window and the bars make it scale down just a bit, so it is blurry...
This can be done with: osn.NodeObs.OBS_content_setPaddingSize(displayId, 0);.
Should we add this to the example app @Envek ?

OBS ignores programmatic set output video resolution

OBS seems to ignore programmatic changes to set output video resolution to 1920x1080 here:

const outputWidth = 1920;
setSetting('Video', 'OutputCX', outputWidth)
setSetting('Video', 'OutputCY', Math.round(outputWidth / aspectRatio))
const videoScaleFactor = realDisplayWidth / outputWidth;

Workaround: You can manually edit OBS configuration in osn-data subfolder and set OutputCX and OutputCY parameters under Video section to your display resolution (e.g. 1920 and 1080 respectively).

Originally posted by @hrueger in #2 (comment)

I also noticed that only about 2/3 of my screen were recorded and in the logs (attached) it says this:

video settings reset:
   base resolution:   1536x960
   output resolution: 1228x768

My screen, however, is 1920x1200.
I don't know much about OBS, but I don't think this problem belongs to the RecEncoder settings, does it?

2020-04-13 06-51-24.txt

After having a closer look at the code, I found that this already returns 1536x960. So no problem with your code, sorry! Probably a Windows scaling issue (my scaling is at 125% because I'm using a convertible). 1920 / 1.25 = 1536

  const { screen } = require('electron');
  const primaryDisplay = screen.getPrimaryDisplay();

Edit: After inspecting the whole code I saw that the scaleFactor is multiplied with the display size values retrieved from the electron screen module and the realDisplayWith and realDisplayHeight variables do have the correct value.

osn.InputFactory.create('window_capture', 'window-source') Black screen with Chinese

  const videoSource = osn.InputFactory.create('window_capture', 'window-source',{ device_id: 'does_not_exist' });
  let windows = videoSource.properties.get('window').details.items;
  const { physicalWidth, physicalHeight, aspectRatio } = displayInfo();
  let value=windows[0].value;
  let settings = videoSource.settings;
  settings['window'] = encodeURI(value);
  settings['width'] = physicalWidth;
  settings['height'] = physicalHeight;
  videoSource.update(settings);
  videoSource.save();
┏ Electron -------------------

  [{"name":"[electron.exe]: 直播客户端","enabled":true,"value":"直播客户端:Chrom
e_WidgetWin_1:electron.exe"},{"name":"[cmd.exe]: npm","enabled":true,"value":"np
m:ConsoleWindowClass:cmd.exe"},{"name":"[chrome.exe]: 百度一下,你就知道 - Googl
e Chrome","enabled":true,"value":"百度一下,你就知道 - Google Chrome:Chrome_Widg
etWin_1:chrome.exe"}]
  window value
  %E7%99%BE%E5%BA%A6%E4%B8%80%E4%B8%8B%EF%BC%8C%E4%BD%A0%E5%B0%B1%E7%9F%A5%E9%81
%93%20-%20Google%20Chrome:Chrome_WidgetWin_1:chrome.exe

┗ ----------------------------

When there is Chinese in the value, the screen will be black

this package not support mac for arm64?

Hi, would you mind helping me?
My environment:
Apple M1 Pro.

how to use Example Build? i can't use this command.

cmake .. -G"Visual Studio 17 2022" -A x64 -DCMAKE_PREFIX_PATH=%CD%/libobs-src/cmake/

How to get a stream or per frame event of the input source or scene

Hi guys,
I'm trying to use this as an example of how to use the obs-studio-node lib.
But what I'm actually trying to do is to get a stream/event of the captured input/preview screen so i can get data from every frame captured by the obs lib (in real time ish).
I just can't seem to find anything in the code that is updating the preview div tag let alone a way to get the frames of the input source.

Many Thanks in advance.

Node JS Version

Hi,
great job!
What version of NodeJS are you using? I always get an error that it requires another node version and that I should try and recompile.

Thanks!

Unable to set webcam resolution

I'v removed the comments in the corresponding section in obsRecorder.js, and set the resolution to 1920x1080, but the webcam still shows 640x480. Also setting width and height in InputFactory.create(...) does not seem to change anything.

// Way to update settings if needed:
let settings = obsCameraInput.settings;
console.debug('Camera settings:', obsCameraInput.settings);
settings['width'] = 1920;
settings['height'] = 1080;
obsCameraInput.update(settings);
obsCameraInput.save();

BTW: Thanks for this great example @Envek. This helped me a lot. Unfortunately obs-studio-node is not documented very well.

Error in building package this example with react

I am using this example with react. My project structure is

.
├── README.md
├── build
├── dist
├── node_modules
├── osn-data
├── package-lock.json
├── package.json
├── public
├── src
├── tsconfig.json
├── yarn-error.log
└── yarn.lock

My package.json is like

{
  "name": "alok",
  "version": "0.5.0",
  "main": "public/electron.js",
  "private": true,
  "homepage": ".",
  "dependencies": {
    "react": "^17.0.1",
    "rxjs": "^6.6.6",
    "obs-studio-node": "https://obsstudionodes3.streamlabs.com/osn-0.10.10-release-win64.tar.gz"
    // ... more modules
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "electron-dev": "concurrently \"BROWSER=none yarn start\" \"wait-on http://localhost:3000 && electron .\"",
    "electron-local-dev": "electron .",
    "make": "electron-forge make",
    "electron-forge-start": "electron-forge start",
    "preelectron-pack": "yarn build",
    "electron-pack": "electron-builder -c.extraMetadata.main=build/electron.js",
    "postinstall": "electron-builder install-app-deps"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "electron": "^11.0.3",
    "electron-builder": "^22.9.1",
    "wait-on": "^5.2.1"
    // more modules
  },
  "config": {
    
  },
  "build": {
    "mac": {
      "icon": "build/icon.png"
    },
    "win": {
      "icon": "build/icon.png"
    }
  }
}

on running command yarn electron-pack I am getting error which can be seen on this iamge https://i.stack.imgur.com/jEvgm.png
This error is related to app.asar path

How can I fix this?

Failed to host and connect

Hi
i'm using vue-cli-service with your exemple and i have this error : Failed to host and connect. I'm blocked and i don't kno how to solve this thanks !

> vue-cli-service electron:serve

 INFO  Starting development server...
 WARN  Express server  You have to launch the express server before if you want to use relative path in your code!
98% after emitting CopyPlugin

 DONE  Compiled successfully in 4528ms                                                                          10:21:51


  App running at:
  - Local:   http://localhost:8081/
  - Network: http://192.168.1.26:8081/

  Note that the development build is not optimized.
  To create a production build, run yarn build.

|  Bundling main process...

 DONE  Compiled successfully in 4346ms                                                                          10:21:56

  File                      Size                                         Gzipped

  dist_electron\index.js    3259.55 KiB                                  690.34 KiB

  Images and other types of assets omitted.

 INFO  Launching Electron...
initialize
Error: Failed to host and connect.
    at initOBS (webpack:///./obsRecorder.js?:40:25)
    at Object.initialize (webpack:///./obsRecorder.js?:22:5)
    at App.eval (webpack:///./src/background.js?:107:17)
    at App.emit (events.js:205:15)
(node:8452) UnhandledPromiseRejectionWarning: Error: Exception when initializing OBS process: Error: Failed to host and connect.

Projector / Display / Preview output

I tried to create a projector or a display, but I couldn't get it to work. In streamlabs-obs I found this code: https://github.com/stream-labs/streamlabs-obs/blob/e707f9819a10296893f4d3e058d12110c1ec44a7/app/services/video.ts#L254-L275
So I have the following code:

const t = new BrowserWindow({
    height: 300,
    width: 400,
    webPreferences: {
      nodeIntegration: true,
    }
  });

  osn.NodeObs.OBS_content_createDisplay(
    t.getNativeWindowHandle(),
    "test",
    1,
  );

But it just gives me the normal BrowserWindow.
Rendering mode can be 0, 1 or 2 as defined here but it doesn't work with any of them.

Did you get some kind of live output working?

Using OBS plugins

Hey! Is there a way through which I can use OBS plugins like virtual camera through nodeobs?

Audio output

And idea how I can output audio?
When I create a video source like here, I can't hear any sound.

Output to URL

Hello there !

I'm trying to capture & stream audio to an URL as provided in OBS-Studio. I've just cloned this minimal sample repo, rebuilt obs-studio-node from source, properly updated package.json and ran yarn install/start.

Electron is launching but won't send data to my URL (Icecast server) as set in basic.ini. I end up with the same situation when trying to set settings by myself in function configureOBS() (file obsRecorder.js)

I'm running this sample on a fresh Windows 10 install

Here's my basic.ini :
`[Video]
BaseCX=200
BaseCY=113
OutputCX=200
OutputCY=113
ScaleType=bicubic
FPSCommon=60

[Audio]
SampleRate=44100

[SimpleOutput]
Mode=Simple
VBitrate=2500
StreamEncoder=obs_x264
ABitrate=160
UseAdvanced=false
FilePath=C:\Users\julien\Videos
FileNameWithoutSpace=false
RecQuality=Stream
RecFormat=mp4
MuxerCustom=
RecRB=true
RecRBTime=20

[Output]
Mode=Advanced

[AdvOut]
TrackIndex=1
RecType=FFmpeg
RecTracks=1
FLVTrack=1
FFOutputToFile=false
FFURL=icecast://source:password@url:port/endpoint.ts
FFFormat=mpegts
FFFormatMimeType=video/MP2T
FFExtension=ts
FFVEncoderId=27
FFVEncoder=libx264
FFAEncoderId=86018
FFAEncoder=aac
FFAudioMixes=1
FFVBitrate=25
FFVGOPSize=2
FFIgnoreCompat=true
RescaleRes=1920x1080
RecRescaleRes=1920x1080
FFRescaleRes=140x80
FFABitrate=128
FFMCustom=
FFRescale=true
Encoder=obs_x264
ApplyServiceSettings=true
Rescale=false
RecFilePath=C:\Users\juju\Videos
RecFileNameWithoutSpace=false
RecFormat=flv
RecEncoder=none
RecRescale=false`

Here's my configureOBS() function
`
function configureOBS() {
console.debug('Configuring OBS');
setSetting('Output', 'Mode', 'Advanced');

setSetting('Output', 'TrackIndex', 1);
setSetting('Output', 'RecType', 'FFmpeg');
setSetting('Output', 'RecTracks', 1);
setSetting('Output', 'FLVTrack', 1);
setSetting('Output', 'FFOutputToFile', 0);
setSetting('Output', 'FFURL', 'icecast://source:password@url:port/endpoint.ts');
setSetting('Output', 'FFFormat', 'mpegts');
setSetting('Output', 'FFFormatMimeType', 'video/MP2T');
setSetting('Output', 'FFExtension', 'ts');
setSetting('Output', 'FFVEncoderId', 27);
setSetting('Output', 'FFVEncoder', 'libx264');
setSetting('Output', 'FFAEncoderId', 86018);
setSetting('Output', 'FFAEncoder', 'aac');
setSetting('Output', 'FFAudioMixes', 1);
setSetting('Output', 'FFVBitrate', 25);
setSetting('Output', 'FFVGOPSize', 2);
setSetting('Output', 'FFIgnoreCompat', 1);
setSetting('Output', 'RescaleRes', '1920x1080');
setSetting('Output', 'FFRescaleRes', '140x80');
setSetting('Output', 'FFABitrate', '140x80');
setSetting('Output', 'FFRescale', 1);

setSetting('Video', 'FPSCommon', 60);

console.debug('OBS Configured');
}
`

Congrats for all this wonderfull piece of software !
Best regards

Electron Error: Failed to host and connect.

I followed the example code provided, but my code is failing on the first step when I try to run osn.NodeObs.IPC.host("example"); I have the obsRecorder.js file imported into my main.ts file using const obsRecorder = require("./obsRecorder"); and I have set up ipcMain handlers to handle the actions just like in the example. I suspect it might be something with the updated version of electron or something in the example being out of date. Could someone please help me solve this?

How to get window capture ?

Hello there,
I'm trying to get all opened windows list and display them one by one with a selector (in the renderer).
But, here's my question, how to choose window capture instead of obsCamera (in the obsRecorder.js) ?
Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.