Skip to content

Instantly share code, notes, and snippets.

@gregbook
Created August 19, 2023 16:10
Show Gist options
  • Save gregbook/ff8ca5b64f9b3f9d195fd3ee7a70522b to your computer and use it in GitHub Desktop.
Save gregbook/ff8ca5b64f9b3f9d195fd3ee7a70522b to your computer and use it in GitHub Desktop.
How to build StreamFX for OBS 29 on MacOS Apple Silicon

How to build StreamFX for OBS 29 on MacOS Apple Silicon

Note: Adapted for Mac OS based on Nichijou blog article.

Why

The pre-built binaries of StreamFX are only available to sponsors now. And the author purged all the 0.12 alpha builds from GitHub. The only free option for OBS 27+ users is to build it from source. Okay, fair enough.

How

There is a official guide for how to build the project. It works in general but misses some details. If you are familar with GitHub actions, it is better to check the main.yml out.

All the following instructions are a de-templatized version of the original action, and they are MacOS arm64 only (adapt according to your needs)

Prerequisites

Install the perequesites based on https://github.com/Xaymar/obs-StreamFX/wiki/Building#1-install-prerequisites--dependencies

Based on the DEPS_VERSION_MAC in this file, find the needed OBS dependencies here

At the time of this article DEPS_VERS_MAC is 2023-04-12 so you need to download the following OBS dependencies:

  • macos-deps-qt6-2023-04-12-arm64.tar.xz
  • macos-deps-2023-04-12-arm64.tar.xz

Download depencendies with curl

cd /tmp
curl -OJL "https://github.com/obsproject/obs-deps/releases/download/2023-04-12/macos-deps-2023-04-12-arm64.tar.xz"
curl -OJL "https://github.com/obsproject/obs-deps/releases/download/2023-04-12/macos-deps-qt6-2023-04-12-arm64.tar.xz"

Clone StreamFX repository and its submodules

cd /tmp
git clone --recursive https://github.com/Xaymar/obs-StreamFX.git obs-streamfx

Build LibOBS (commands are MacOS specific)

Create a build folder inside obs-streamfx repository

mkdir -p /tmp/obs-streamfx/build

Extract dependencies in the build folder for building obs-studio

mkdir -p "/tmp/obs-streamfx/build/qt"
tar -xvf "/tmp/macos-deps-qt6-2023-04-12-arm64.tar.xz" -C "/tmp/obs-streamfx/build/qt"

mkdir -p "/tmp/obs-streamfx/build/obsdeps"
tar -xvf "macos-deps-2023-04-12-arm64.tar.xz" -C "/tmp/obs-streamfx/build/obsdeps"

Apply patches to obs-studio (Removes CMAKE warnings)

pushd "/tmp/obs-streamfx/third-party/obs-studio" > /dev/null
        for f in ../../patches/obs-studio/*.patch; do
          echo "Applying patch '${f}''..."
          [ -e "$f" ] || continue
          git apply "$f"
        done
        popd > /dev/null

Export CMAKE variables

export CMAKE_GENERATOR="Xcode"
# Necessary otherwise one cmake step cache fails (update according to your Mac OS Version)
export CMAKE_OSX_DEPLOYMENT_TARGET="13.5"
export CMAKE_OSX_ARCHITECTURES="arm64"

Run

cmake \
    -S "/tmp/obs-streamfx/third-party/obs-studio" \
    -B "/tmp/obs-streamfx/build/obs" \
    -DCMAKE_INSTALL_PREFIX="/tmp/obs-streamfx/build/obs/install" \
    -DCMAKE_PREFIX_PATH="/tmp/obs-streamfx/build/obsdeps;/tmp/obs-streamfx/build/qt" \
    -DENABLE_PLUGINS=OFF \
    -DENABLE_UI=OFF \
    -DENABLE_SCRIPTING=OFF
Output
-- OBS:  Application Version: 29.1.1-modified - Build Number: 1
-- The C compiler identification is AppleClang 14.0.3.14030022
-- The CXX compiler identification is AppleClang 14.0.3.14030022
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test C_COMPILER_SUPPORTS_OPENMP_SIMD
-- Performing Test C_COMPILER_SUPPORTS_OPENMP_SIMD - Success
-- Performing Test CXX_COMPILER_SUPPORTS_OPENMP_SIMD
-- Performing Test CXX_COMPILER_SUPPORTS_OPENMP_SIMD - Success
-- Found OpenGL: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/System/Library/Frameworks/OpenGL.framework
-- Found FFmpeg: /tmp/obs-streamfx/build/obsdeps/lib/../lib/libavcodec.dylib (found version "#define LIBAVCODEC_VERSION_MINOR   3;#define LIBAVCODEC_VERSION_MICRO 100.3.100") found components: avcodec avdevice avutil avformat
-- Found CURL: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/usr/lib/libcurl.tbd (found version "7.87.0")
-- OBS:  DISABLED   obs-scripting
-- OBS:  Using system Jansson library.
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Found FFmpeg: /tmp/obs-streamfx/build/obsdeps/lib/libavformat.dylib (found version "#define LIBAVFORMAT_VERSION_MINOR   3;#define LIBAVFORMAT_VERSION_MICRO 100.3.100") found components: avformat avutil swscale swresample avcodec
-- Found ZLIB: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/usr/lib/libz.tbd (found version "1.2.11")
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY - Success
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success
-- OBS:  Building with plugins disabled.
-- OBS:  DISABLED   OBS UI
-- Configuring done (13.9s)
-- Generating done (0.0s)
-- Build files have been written to: /tmp/obs-streamfx/build/obs

Run

cmake \
    --build "/tmp/obs-streamfx/build/obs" \
    --config RelWithDebInfo \
    --target obs-frontend-api

You should see ** BUILD SUCCEEDED **

Run

cmake \
    --install "/tmp/obs-streamfx/build/obs" \
    --config RelWithDebInfo \
    --component obs_libraries

Build StreamFX

Run

cmake \
    -S "/tmp/obs-streamfx/" \
    -B "/tmp/obs-streamfx/build/ci" \
    -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
    -Dlibobs_DIR="/tmp/obs-streamfx/build/obs/install" \
    -DQt6_DIR="/tmp/obs-streamfx/build/qt" \
    -DFFmpeg_DIR="/tmp/obs-streamfx/build/obsdeps" \
    -DCURL_DIR="/tmp/obs-streamfx/build/obsdeps" \
    -DCMAKE_OSX_DEPLOYMENT_TARGET="13.5" \ # Update based on your Mac OS Version (cmake cache issue otherwise)
Output
-- [StreamFX] Target is 64bit ARM with a pointer size of 64bit.
-- [StreamFX] Version 0.12.0b300-ge82823d4
-- [StreamFX] Found FFmpeg: /tmp/obs-streamfx/build/obsdeps/lib/libavutil.dylib (found version "58.2.100") found components: avutil avcodec swscale
-- [StreamFX] Using Qt6.
-- [StreamFX] Applying custom flags for AppleClang style build.
-- Configuring done (2.2s)
-- Generating done (0.0s)
-- Build files have been written to: /tmp/obs-streamfx/build/ci

Run

cmake --build "/tmp/obs-streamfx/build/ci" --config Debug --target StreamFX

You should see ** BUILD SUCCEEDED **

Use StreamFX with OBS

You can now go to /tmp/obs-streamfx/build/ci/Debug/ and copy StreamFX.plugin to your OBS installation plugin folder. /Users/xxx/Library/Application Support/obs-studio/plugins (if the plugins folder does not exist create it)

Launch OBS and you should see the filters from StreamFX

Screenshot 2023-08-19 at 18 52 08

Not all filters will be available due to being on Mac OS and not having an NVIDIA graphic card

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment