{"id":26769399,"url":"https://github.com/streamlabs/obs-studio-node","last_synced_at":"2025-05-15T06:07:04.029Z","repository":{"id":37743161,"uuid":"108473348","full_name":"streamlabs/obs-studio-node","owner":"streamlabs","description":"libOBS (OBS Studio) for Node.Js, Electron and similar tools","archived":false,"fork":false,"pushed_at":"2025-05-14T17:54:02.000Z","size":126483,"stargazers_count":644,"open_issues_count":64,"forks_count":101,"subscribers_count":15,"default_branch":"staging","last_synced_at":"2025-05-15T06:06:20.435Z","etag":null,"topics":["c","cmake","cpp","electron","javascript","node","node-js","node-module","nodejs","obs","obs-studio","typescript"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/streamlabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-10-26T22:43:28.000Z","updated_at":"2025-05-14T16:39:09.000Z","dependencies_parsed_at":"2022-07-11T14:11:06.172Z","dependency_job_id":"b5611cab-b638-4de4-a1cb-c99f22299737","html_url":"https://github.com/streamlabs/obs-studio-node","commit_stats":{"total_commits":2205,"total_committers":22,"mean_commits":"100.22727272727273","dds":0.8104308390022675,"last_synced_commit":"3da9fd3c8cfdccadd410306ed508abb6e8f75966"},"previous_names":["streamlabs/obs-studio-node","stream-labs/obs-studio-node"],"tags_count":1661,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamlabs%2Fobs-studio-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamlabs%2Fobs-studio-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamlabs%2Fobs-studio-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamlabs%2Fobs-studio-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/streamlabs","download_url":"https://codeload.github.com/streamlabs/obs-studio-node/tar.gz/refs/heads/staging","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254283350,"owners_count":22045141,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","cmake","cpp","electron","javascript","node","node-js","node-module","nodejs","obs","obs-studio","typescript"],"created_at":"2025-03-28T22:09:28.517Z","updated_at":"2025-05-15T06:07:04.022Z","avatar_url":"https://github.com/streamlabs.png","language":"C++","readme":"# libobs via node bindings\nThis library intends to provide bindings to obs-studio's internal library, named libobs accordingly, for the purpose of using it from a node runtime.\nCurrently, only Windows and MacOS are supported.\n\n# Building\n\n## Prerequisites\nYou will need to have the following installed:\n\n* Git\n* [Node.js](https://nodejs.org/en/)\n* [Yarn](https://yarnpkg.com/en/docs/install#windows-stable)\n* [CMake](https://cmake.org/)\n\n### Windows\nBuilding on windows requires additional software:\n\n* [Visual Studio 2019 or 2022](https://visualstudio.microsoft.com/)\n* [Windows SDK](https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk) (may be installed by Visual Studio 2022 Installer)\n\n### Example Build\nWe 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.\n\nExample:\n```\nyarn install\ngit submodule update --init --recursive\nmkdir build\ncd build\ncmake .. -G\"Visual Studio 17 2022\" -A x64 -DCMAKE_PREFIX_PATH=%CD%/libobs-src/cmake/\ncmake --build . --target install --config RelWithDebInfo\n```\n\nThis 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.\n\n### Custom OBS Build\nBy 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.\n\nYou may specify a custom archive of your own. However, some changes need to be made to obs-studio's default configuration before building:\n\n* `ENABLE_SCRIPTING` must be set to `false`\n* `ENABLE_UI` must be set to `false`\n* `QTDIR` should *not* be specified as it is not used.\n\nIf you don't know how to build obs-studio from source, you may find instructions [here](https://github.com/obsproject/obs-studio/wiki/Install-Instructions#windows-build-directions).\n\n\n#### cppcheck \n\nInstall cppcheck from http://cppcheck.sourceforge.net/ and add cppcheck folder to PATH \nTo run check from command line:  \n```\ncd build \ncmake --build . --target CPPCHECK\n```\n\nAlso target can be built from Visula Studio. \nReport output format set as compatible and navigation to file:line posiible from build results panel.  \n\nSome warnings suppressed in files `obs-studio-client/cppcheck_suppressions_list.txt` and `obs-studio-server/cppcheck_suppressions_list.txt`.\n\n#### Clang Analyzer \n\n`Ninja` and `LLVM` have to be installed in system. Warning: depot_tool have broken ninja.  \nTo make build open `cmd.exe`. \n\n\n```\nmkdir build_clang\ncd build_clang\n\n\"c:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\bin\\amd64\\vcvars64.bat\"\n \nset CCC_CC=clang-cl\nset CCC_CXX=clang-cl\nset CC=ccc-analyzer.bat\nset CXX=c++-analyzer.bat\n#set CCC_ANALYZER_VERBOSE=1\n\n#make ninja project \ncmake  -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 ..\n\n#try to build and \"fix\" errors \nninja.exe \n\n#clean build to scan \nninja.exe clean \n\nscan-build --keep-empty -internal-stats -stats -v -v -v -o check ninja.exe\n```\nStep 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.\n\n### Tests\n\nThe 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.\n\nYou 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:\n\n#### Terminal commands\nIn obs-studio-node root folder:\n1. `yarn install`\n2. `git submodule update --init --recursive --force`\n3. `mkdir build`\n4. `cmake -Bbuild -H. -G\"Visual Studio 16 2019\" -A x64 -DCMAKE_INSTALL_PREFIX=\"path_of_your_choosing\"`\n5. `cmake --build build --target install`\n\n#### Terminal using package.json scripts\nIn obs-studio-node root folder:\n1. `mkdir build`\n2. `yarn local:config`\n3. `yarn local:build`\n4. Optional: To clean build folder to repeat the steps 2 to 3 again do `yarn local:clean`\n\n#### CMake GUI\n1. `yarn install`\n2. Create a build folder in obs-studio-node root\n3. Open CMake GUI\n4. Put obs-studio-node project path in `Where is the source code:` box\n5. Put path to build folder in `Where to build the binaries:` box\n6. Click `Configure`\n7. Change CMAKE_INSTALL_PREFIX to a folder path of your choosing\n8. Click `Generate`\n9. Click `Open Project` to open Visual Studio and build the project there\n\n#### Running tests\nSome 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.\n\n* To run all the tests do `yarn run test` \n* 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. Examples: `yarn run test --grep nodeobs_api` or `yarn run test -g \"Start streaming\"`\n\n#### Debugging tests\nIf you wish to debug a specific test change the wildcard character to the name of your test (for ex, change `*.ts` into `test_nodeobs_api.ts`) in your launch.json:\n```\n{\n    \"version\": \"0.2.0\",\n    \"configurations\": [\n        {\n            \"type\": \"node\",\n            \"request\": \"launch\",\n            \"name\": \"Debug Electron-Mocha Tests\",\n            \"program\": \"${workspaceFolder}/node_modules/electron-mocha/bin/electron-mocha\",\n            \"args\": [\n                \"-r\",\n                \"ts-node/register\",\n                \"${workspaceFolder}/tests/osn-tests/src/*.ts\"\n            ],\n            \"cwd\": \"${workspaceFolder}\",\n            \"env\": {\n                \"ELECTRON_ENABLE_LOGGING\": \"true\"\n            },\n            \"outputCapture\": \"std\", // Enables capturing test output directly\n            \"internalConsoleOptions\": \"openOnSessionStart\",\n            \"skipFiles\": [\"\u003cnode_internals\u003e/**\"] // Avoid stepping into Electron internals\n        }\n    ]\n}\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstreamlabs%2Fobs-studio-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstreamlabs%2Fobs-studio-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstreamlabs%2Fobs-studio-node/lists"}