Skip to content
Trouffman edited this page May 24, 2024 · 22 revisions

Development

NDI License Requirements Summary

Per

Summary:

  • Provide a link to https://ndi.video/ in
    • in OBS-NDI app
    • on OBS-NDI web site
    • in OBS-NDI documentation
  • Use "NDI®" along with the statement “NDI® is a registered trademark of Vizrt NDI AB” located on the same page near the mark where it is first used, or at the bottom of the page in footnotes. You are required to use the registered trademark designation only on the first use of the word NDI within a single document.
  • Your application’s About Box and any other locations where trademark attribution is provided should also specifically indicate that “NDI® is a registered trademark of Vizrt NDI AB”.
  • Provide a user link to the NDI-provided download of this application at http://ndi.link/NDIRedistV6. At runtime, the location of the NDI runtime DLLs can be determined from the environment variable NDI_RUNTIME_DIR_V6.

Other References:

  • SDK's
    • NDI SDK License Agreement.pdf
    • NDI SDK Documentation.pdf

Building

Linux

NOTE: Only Debian and Ubuntu are officially supported

In terminal (Debian):

git clone https://github.com/obs-ndi/obs-ndi.git
cd obs-ndi
.github/scripts/build-linux
...
.github/scripts/package-linux
...
sudo cp -r release/obs-plugins/64bit/* /usr/local/lib/x86_64-linux-gnu/obs-plugins/
...
sudo cp -r release/data/obs-plugins/* /usr/local/share/obs/obs-plugins/
...
sudo ldconfig

In terminal (Ubuntu):

git clone https://github.com/obs-ndi/obs-ndi.git
cd obs-ndi
.github/scripts/build-linux
...
.github/scripts/package-linux
...
sudo cp -r release/RelWithDebInfo/lib/x86_64-linux-gnu/obs-plugins/* /usr/lib/x86_64-linux-gnu/obs-plugins/
...
sudo cp -r release/RelWithDebInfo/share/obs/obs-plugins/* /usr/share/obs/obs-plugins/
...
sudo ldconfig

Subsequent builds can be sped up by using build-linux --skip-deps.
See build-linux --help for more details.

Raspbian

# install prerequisites
apt install -y zsh libobs-dev libgles2-mesa-dev

# clone and cd into the repo, all following instructions will be given relative to obs-ndi/
git clone https://github.com/obs-ndi/obs-ndi.git
cd obs-ndi

# I had to comment out line 38 that adds the ppa in obs-ndi/.github/scripts/utils.zsh/setup_linux
# 38   # sudo add-apt-repository --yes ppa:obsproject/obs-studio
# if you don't comment out this line, you may run into the error described in https://github.com/obs-ndi/obs-ndi/issues/987

# build the plugin
# note: if you're using OBS from repos, as of this writing OBS is using QT5, so set `QT_VERSION=5` when running the build script.
#       if OBS is using QT6, omit `QT_VERSION=6`
QT_VERSION=5 .github/scripts/build-linux --target linux-aarch64

# install the plugin locally
cp release/RelWithDebInfo/lib/aarch64-linux-gnu/obs-plugins/obs-ndi.so /usr/lib/aarch64-linux-gnu/obs-plugins/obs-ndi.so
cp -r release/RelWithDebInfo/share/obs/obs-plugins/obs-ndi /usr/share/obs/obs-plugins/

# bundle the plugin to install on other Pis
# This will create an `obs-ndi-<version>-aarch64-linux-gnu.tar.xz` pacakge,
# e.g.: obs-ndi-4.13.1-aarch64-linux-gnu.tar.xz
.github/scripts/package-linux

# Install on another Pi
tar vxf obs-ndi-4.13.1-aarch64-linux-gnu.tar.xz -C obs-ndi
cp obs-ndi/lib/aarch64-linux-gnu/obs-plugins/obs-ndi.so /usr/lib/aarch64-linux-gnu/obs-plugins/obs-ndi.so
cp -r obs-ndi/share/obs/obs-plugins/obs-ndi /usr/share/obs/obs-plugins/

MacOS

In terminal:

git clone https://github.com/obs-ndi/obs-ndi.git
cd obs-ndi
.github/scripts/build-macos
...
.github/scripts/package-macos
...
cp -r release/RelWithDebInfo/obs-ndi.plugin ~/Library/Application\ Support/obs-studio/plugins/
...

Subsequent builds can be sped up by using build-macos --skip-deps.
See build-macos --help for more details.

Combine all 3:

.github/scripts/build-macos --skip-deps && .github/scripts/package-macos && cp -r release/RelWithDebInfo/obs-ndi.plugin ~/Library/Application\ Support/obs-studio/plugins/

If you get a No CMAKE_C_COMPILER could be found error:

  1. Launch XCode -or-
  2. Run sudo xcode-select --reset

Windows

In PowerShell Core 7+ terminal:

git clone https://github.com/obs-ndi/obs-ndi.git
cd obs-ndi

First build:

.github/scripts/Build-Windows.ps1 && .github/scripts/Package-Windows.ps1 -BuildInstaller

Subsequent builds:

.github/scripts/Build-Windows.ps1 -SkipDeps && .github/scripts/Package-Windows.ps1 -BuildInstaller

See Help .github/scripts/Build-Windows.ps1 for more details.

If you get SecurityError/PSSecurityException/UnauthorizedAccess error then:

Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser

Formatting

Install Pre-requisities

Requires [obsproject/tools/]clang-format@16, cmakelang, and zsh installed.

From https://brew.sh/ ...

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

...then follow the instructions printed out at the end of install.

From .github\actions\run-clang-format\action.yaml...

brew install --quiet obsproject/tools/clang-format@17

...then follow the instructions printed out at the end of install.

Linux/MacOS

Open a terminal:

./build-aux/run-clang-format
./build-aux/run-cmake-format

Windows (WSL)

Open a WSL Ubuntu terminal:

...
clang-format-16 -i src/obs-ndi-filter.cpp
clang-format-16 -i src/obs-ndi-source.cpp
clang-format-16 -i src/plugin-main.cpp
...

Supress Formatting/Code Errors/Warnings

I keep forgetting how to do this, so adding a note here.
On rare/sparing/appropriate basis, suppress Lint errors with:

#if defined(__linux__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfoo"
#endif
    ...foo code...
#if defined(__linux__)
#pragma GCC diagnostic pop
#endif

Replace __linux__ w/ __GNUC__ or WIN32 type of macros as appropriate.

Updating obs-plugintemplate

This plugin is based off of https://github.com/obsproject/obs-plugintemplate, and has occasionally contributed back to it.

If obs-plugintemplate is template is updated, then this plugin should also be updated.

The code is not forked, so updated need to be applied manually, and may not be easy to cherry-pick.

To update this plugin's obs-plugintemplate code:

  1. Clone this plugin's code
  2. Clone https://github.com/obsproject/obs-plugintemplate
  3. Diff the two code bases and incorporate MOST of obs-plugintemplate's changes into this plugin.
    DO NOT OVERWRITE THIS PLUGIN'S PLUGIN SPECIFIC CHANGES IN THESE FILES!
    Example:
    • buildspec.json
    • CMakeLists.txt
    • ...

Updating OBS Dependencies

Almost all of the time, all of the necessary OBS dependencies get updated when updating the obs-plugintemplate.

To update this plugin's OBS dependencies:

  1. ...

Updating NDI Dependencies

Occasionally a new version of the NDI SDK is released.

To update this plugin's NDI dependencies:

  1. ...

Pre-Release

Seeking Testers

This plugin is based off of https://github.com/obsproject/obs-plugintemplate that supports CI packaging installers if the PR is labeled with Seeking Testers:
https://github.com/obsproject/obs-plugintemplate/blob/e385ac1863b8c658e7f6cc564f04040c9057c9f0/.github/workflows/build-project.yaml#L32C1-L36

Use this feature when wanting testing/feedback on a branch build.

Release Candidate

WIP... Use this feature when wanting testing/feedback on a build imminent for release.

Release

  1. Update ./buildspec.json "version" to the new version number
    (ex: "4.13.2").
  2. Edit https://github.com/obs-ndi/obs-ndi/wiki/1.-Installation
    1. Search and replace all of the previous version number with the new version number
      (ex: 4.13.1 -> 4.13.2)
  3. Commit and push these changes to the branch to be merged to master.
  4. Merge to master when ready.
  5. Create tag for new version (ex: 4.13.2) and push tag to obs-ndi origin.
  6. Update https://obsproject.com/forum/resources/obs-ndi-newtek-ndi%E2%84%A2-integration-into-obs-studio.528/updates NOTE: As of 2024/05 @Palakis is still looking into transferring ownership of this plugin to the obsndi@obsndiproject.com account.

NOTE: Per https://github.com/obs-ndi/obs-ndi/issues/724 this plugin also generates a flatpak via https://github.com/flathub/flathub/pull/4701 ...

Post-Release

MacOS

Similar to Windows, MacOS also complains about the installer. obs-ndi-macos-security-issue For developers only You can force run by clicking "control" to open. ...

Windows

The Windows installer is not [yet?] signed.
This can result in errors while downloading and running.
To mitigate this:

  1. Manually try a download

    1. If Chrome's "Google Safe Browsing" says "Suspicious download blocked":



    2. Other browsers? ...
  2. If Windows Defender detects/warns/deletes the file as suspicious:

  3. If the file launches but says it is suspicious: ...


NOTE: Non-Rewrite vs Rewrite Branch Translations

In 2022 @tt2468 did a fantastic job implementing a near total rewrite on the https://github.com/obs-ndi/obs-ndi/tree/rewrite branch.

The following is just my personal opinion:

I (@paulpv) do love that code, but I personally do think that code may have gone a bridge too far for what I think most OBS-NDI users really wanted.

I think most users just wanted the same old OBS-NDI that worked on the (at the time) latest OBS v28

@tt2468's changes are great, but they took the plugin in a different direction.

That direction was not bad, but I don't think most OBS-NDI users were ready for it at that time.

I would still love to cherry-pick from that excellent code where possible in bits and pieces over time.

The names of several files changed in the branches, so this table helps [me] to remember what files are similar.

master [non-rewrite] branch vs/to<->from rewrite branch:

=non-rewrite= =rewrite= =note=
preview-output? aux-output
config config
? input-utils
obs-ndi-source input
plugin-main obs-ndi
output-manager
obs-ndi-output output
main-output ?
obs-ndi-filter ?