https://github.com/stream-labs/obs-studio-node Skip to content Sign up * Why GitHub? Features - + Mobile - + Actions - + Codespaces - + Packages - + Security - + Code review - + Issues - + Integrations - + GitHub Sponsors - + Customer stories- * Team * Enterprise * Explore + Explore GitHub - Learn and contribute + Topics - + Collections - + Trending - + Learning Lab - + Open source guides - Connect with others + The ReadME Project - + Events - + Community forum - + GitHub Education - + GitHub Stars program - * Marketplace * Pricing Plans - + Compare plans - + Contact Sales - + Education - [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this organization All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} stream-labs / obs-studio-node * Notifications * Star 280 * Fork 60 libOBS (OBS Studio) for Node.Js, Electron and similar tools GPL-2.0 License 280 stars 60 forks Star Notifications * Code * Issues 30 * Pull requests 2 * Actions * Security * Insights More * Code * Issues * Pull requests * Actions * Security * Insights staging Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags 910 branches 1,134 tags Code * Clone HTTPS GitHub CLI [https://github.com/s] Use Git or checkout with SVN using the web URL. [gh repo clone stream] Work fast with our official CLI. Learn more. * Open with GitHub Desktop * Download ZIP Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Go back Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Go back Launching Xcode If nothing happens, download Xcode and try again. Go back Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit @summeroff summeroff add process size for each process in sentry report (#985) ... a8b06f2 Aug 18, 2021 add process size for each process in sentry report (#985) * add process size for each process in sentry report * change proces size limit to 32mb * count failed processes as skipped a8b06f2 Git stats * 2,107 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time ci fix for osx sentry info upload (#779) Nov 9, 2020 cmake Upgrade cpp standard and fix compilcation error (#630) Apr 30, 2020 js add destroy method to volmeter and fader js api (#873) Apr 6, 2021 lib-streamlabs-ipc @ b667418 revert socket connection changes causing a regression Feb 2, 2021 obs-studio-client fix not asking for permissions on newer versions of OSX Jul 27, 2021 obs-studio-server add process size for each process in sentry report (#985) Aug 18, 2021 source Mac avcapture custom preset (#831) Jan 22, 2021 tests Update libobs to v27.1.0 (#972) Jul 14, 2021 tools tools/test-runner: Add filtering capabilities and don't use echo Sep 27, 2018 .clang-format formatting: Do not pack arguments Sep 20, 2018 .gitignore Update libobs to v27.0.3 (#951) Jun 17, 2021 .gitmodules project: Use automated obs-studio builds instead of obs-prebuild (Par... Feb 21, 2018 CMakeLists.txt Run tests on Mac (#720) Jul 30, 2020 CONTRIBUTING.md project: Huge rework of the ReadMe and Contributing Guidelines Aug 23, 2018 LICENSE Add license file Aug 16, 2017 README.md Blank commit Jan 14, 2020 azure-pipelines.yml Update libobs to v27.1.9 (#986) Aug 18, 2021 package.json update to latest electron 10 (#903) Apr 13, 2021 tsconfig.json Make osn-tests easier to run locally and in appveyor (#328) Mar 27, 2019 yarn.lock Bump path-parse from 1.0.6 to 1.0.7 (#980) Aug 11, 2021 View code [ ] libobs via node bindings Why CMake? Building Prerequisites Windows Example Build Custom OBS Build Further Building Static code analyzis cppcheck Clang Analyzer Tests Terminal commands Terminal using package.json scripts CMake GUI Running tests README.md libobs via node bindings This library intends to provide bindings to obs-studio's internal library, named libobs accordingly, for the purpose of using it from a node runtime. Currently, only Windows is supported. Why CMake? CMake offers better compatibility with existing projects than node-gyp and comparable solutions. It's also capable of generating solution files for multiple different IDEs and compilers, which makes it ideal for a native module. Personally, I don't like gyp syntax or the build system surrounding it or the fact it requires you to install python. Building Prerequisites You will need to have the following installed: * Git * Node.js * Yarn * CMake Windows Building on windows requires additional software: * Visual Studio 2017 or 2015 * Windows SDK (may be installed with Visual Studio 2017 Installer) Example Build We use a flexible cmake script to be as broad and generic as possible in order to prevent the need to constantly manage the cmake script for custom uses, while also providing sane defaults. It follows a pretty standard cmake layout and you may execute it however you want. Example: yarn install git submodule update --init --recursive mkdir build cd build cmake .. -G"Visual Studio 15 2017" -A x64 cmake --build . cpack -G ZIP This will will download any required dependencies, build the module, and then place it in an archive compatible with npm or yarn that you may specify in a given package.json. Custom OBS Build By default, we download a pre-built version of libobs if none is specified. However, this pre-built version may not be what you want to use or maybe you're testing a new obs feature. You may specify a custom archive of your own. However, some changes need to be made to obs-studio's default configuration before building: * ENABLE_SCRIPTING must be set to false * ENABLE_UI must be set to false * QTDIR should not be specified. If you don't know how to build obs-studio from source, you may find instructions here. Example (from root of obs-studio repository clone): mkdir build cd build cmake .. -DENABLE_UI=false -DDepsPath="C:\Users\computerquip\Projectslibobs-deps\win64" -DENABLE_SCRIPTING=false -G"Visual Studio 15 2017" -A x64 cmake --build . cpack -G ZIP This will create an archive that's compatible with obs-studio-node. The destination of the archive will appear after cpack is finished executing. Example: CPack: Create package using ZIP CPack: Install projects CPack: - Install project: obs-studio CPack: Create package CPack: - package: C:/Users/computerquip/Projects/obs-studio/build /obs-studio-x64-22.0.3-sl-7-13-g208cb2f5.zip generated. This archive may then be specified as a cmake variable when building obs-studio-node like so: cmake .. -G"Visual Studio 15 2017" -A x64 -DOSN_LIBOBS_URL="C:/Users/computerquip/Projects/obs-studio/build/obs-studio-x64-22.0.3-sl-7-13-g208cb2f5.zip" cmake --build . cpack -G ZIP Further Building I don't specify every possible combination of variables. Here's a list of actively maintained variables that control how obs-studio-node is built: * All configurable node-cmake variables found here. * OSN_LIBOBS_URL - Controls where to fetch the libobs archive. May be a directory, any compressed archive that cpack supports, or a URI of various types including FTP or HTTP/S. If you find yourself unable to configure something about our build script or have any questions, please file a github issue! define EXTENDED_DEBUG_LOG controls logging of ipc requests. Static code analyzis cppcheck Install cppcheck from http://cppcheck.sourceforge.net/ and add cppcheck folder to PATH To run check from console: cd build cmake --build . --target CPPCHECK Also target can be built from Visula Studio. Report output format set as compatible and navigation to file:line posiible from build results panel. Some warnings suppressed in files obs-studio-client/ cppcheck_suppressions_list.txt and obs-studio-server/ cppcheck_suppressions_list.txt. Clang Analyzer Ninja and LLVM have to be installed in system. Warning: depot_tool have broken ninja. To make build open cmd.exe. mkdir build_clang cd build_clang "c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat" set CCC_CC=clang-cl set CCC_CXX=clang-cl set CC=ccc-analyzer.bat set CXX=c++-analyzer.bat #set CCC_ANALYZER_VERBOSE=1 #make ninja project cmake -G "Ninja" -DCLANG_ANALYZE_CONFIG=1 -DCMAKE_INSTALL_PREFIX:PATH="" -DCMAKE_LINKER=lld-link -DCMAKE_BUILD_TYPE="Debug" -DCMAKE_SYSTEM_NAME="Generic" -DCMAKE_MAKE_PROGRAM=ninja.exe .. #try to build and "fix" errors ninja.exe #clean build to scan ninja.exe clean scan-build --keep-empty -internal-stats -stats -v -v -v -o check ninja.exe Step with "fixing" errors is important as code base and especially third-party code are not ready to be build with clang. And files which failed to compile will not be scanned for errors. Tests The tests for obs studio node are written in Typescript and use Mocha as test framework, with electron-mocha pacakage to make Mocha run in Electron, and Chai as assertion framework. You need to build obs-studio-node in order to run the tests. You can build it any way you want, just be sure to use CMAKE_INSTALL_PREFIX to install obs-studio-node in a folder of your choosing. The tests use this variable to know where the obs-studio-node module is. Since we use our own fork of Electron, you also need to create an environment variable called ELECTRON_PATH pointing to where the Electron binary is in the node_modules folder after you run yarn install. Below are three different ways to build obs-studio-node: Terminal commands In obs-studio-node root folder: 1. yarn install 2. git submodule update --init --recursive --force 3. mkdir build 4. cmake -Bbuild -H. -G"Visual Studio 15 2017" -A x64 -DCMAKE_INSTALL_PREFIX="path_of_your_choosing" 5. cmake --build build --target install Terminal using package.json scripts In obs-studio-node root folder: 1. mkdir build 2. yarn local:config 3. yarn local:build 4. Optional: To clean build folder to repeat the steps 2 to 3 again do yarn local:clean CMake GUI 1. yarn install 2. Create a build folder in obs-studio-node root 3. Open CMake GUI 4. Put obs-studio-node project path in Where is the source code: box 5. Put path to build folder in Where to build the binaries: box 6. Click Configure 7. Change CMAKE_INSTALL_PREFIX to a folder path of your choosing 8. Click Generate 9. Click Open Project to open Visual Studio and build the project there Running tests Some tests interact with Twitch and we use a user pool service to get users but in case we are not able to fetch a user from it, we use the stream key provided by an environment variable. Create an environment variable called SLOBS_BE_STREAMKEY with the stream key of a Twitch account of your choosing. * To run all the tests do yarn run test * To run only run one test do yarn run test --grep describe_name_value where describe_name_value is the name of the test passed to the describe call in each test file. Example: yarn run test --grep nodeobs_api About libOBS (OBS Studio) for Node.Js, Electron and similar tools Topics electron nodejs javascript c node cmake typescript cpp node-js node-module obs obs-studio Resources Readme License GPL-2.0 License Releases 1,134 v0.3.46 Latest Nov 8, 2018 + 1,133 releases Packages 0 No packages published Contributors 13 * @EddyGharbi * @computerquip-streamlabs * @Xaymar * @pdamasceno * @summeroff * @RodrigoHolztrattner * @Xaymar-Streamlabs * @dependabot[bot] * @florin0x01 * @borzun * @andycreeth + 2 contributors Languages * C++ 71.0% * TypeScript 22.8% * CMake 3.7% * JavaScript 1.1% * Objective-C++ 0.5% * PowerShell 0.4% * Other 0.5% * (c) 2021 GitHub, Inc. * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.