# OBS Mac M1/ARM compile progress - Scripting



## Heino Falcke (Aug 8, 2021)

Following some recipes on Reddit (e.g., https://www.reddit.com/r/obs/comments/njwbxl/compiling_obs_for_apple_silicon_m1/) I have been able to compile OBS natively on the new Mac M1 ARM processor. I need to do this, because the Rosetta emulation comes with a significant performance penalty and for what I need to do (several sources in our church and some special previews) I can’t even stream with 25 FPS/HD with Rosetta (but can do this when using the ARM/M1 code).

I was able to compile ndi-obs and the Advanced Scene Switcher and they both work (which is really nice!). I also run Lua-Scripts. That also compiles with the latest luajit beta, however, when running even a simple script (eg. a countdown timer) OBS crashes after 1-2 mins (just counting down). I am afraid this has to do with an issue in Luajit (pcall??), but wonder whether anyone has been able to get OBS Lua scripting working natively on an M1?


----------



## callimeron (Aug 9, 2021)

countdown timer script worked.








						imgur.com
					

4695 views on Imgur: The magic of the Internet




					imgur.com


----------



## callimeron (Aug 9, 2021)

There are multiple ways to build for Apple Silicon.
Please try them out.









						GitHub - carlosonunez/obs-installer-for-apple-silicon: Conveniently build and install OBS from source on your ultra-fast Apple M1 MacBook or Mac
					

Conveniently build and install OBS from source on your ultra-fast Apple M1 MacBook or Mac - GitHub - carlosonunez/obs-installer-for-apple-silicon: Conveniently build and install OBS from source on ...




					github.com
				











						Compile OBS for Apple Silicon
					

Youtube Video




					iambenmitchell.medium.com
				











						CI: Update build script to create arm64 builds for Apple silicon by Developer-Ecosystem-Engineering · Pull Request #4714 · obsproject/obs-studio
					

Description  Update Sparkle to universal Update full-build-macos to support arch Point at an arm64 CEF variant  Motivation and Context The resulting OBS Studio app will build native and run on Appl...




					github.com
				











						OBS(Apple Silicon arm64)をビルドする
					

M1 MacなどのApple Silicon搭載のMac上でネイティブに動作するOBSをソースコードからビルドする方法




					www.kilinbox.net
				











						CI: Add OBS browser + Apple silicon support by Developer-Ecosystem-Engineering · Pull Request #5063 · obsproject/obs-studio
					

Complete build including OBS Browser native support on Apple silicon Download artifacts from here: https://github.com/obsproject/obs-deps/pull/60/checks?check_run_id=2869389632 Unzip them and put t...




					github.com


----------



## Heino Falcke (Aug 9, 2021)

Interesting to hear that countdown timer works for you (I assume this is a .lua script?).  It doesn't work for me on two different computers. 

In any case, thank you, for this useful list. I actually used the one from Ben Mitchell in your list. Which of the versions did you use? Did you have to do anything special to include lua scripting? (I had to).



callimeron said:


> There are multiple ways to build for Apple Silicon.
> Please try them out.
> 
> 
> ...


----------



## Heino Falcke (Aug 9, 2021)

Sorry, just now watched the video clip. So, indeed this is an M1 compile with a .lua script (so disregard my question in brackets above). Mine crashed after 1:50 secs, your's didn't. So, that still leaves the question which of these compile recipes did you use ? (and which brew targets did you use - luajit doesn't compile via homebrew)?



Heino Falcke said:


> Interesting to hear that countdown timer works for you (I assume this is a .lua script?).  It doesn't work for me on two different computers.
> 
> In any case, thank you, for this useful list. I actually used the one from Ben Mitchell in your list. Which of the versions did you use? Did you have to do anything special to include lua scripting? (I had to).


----------



## callimeron (Aug 9, 2021)

Heino Falcke said:


> Sorry, just now watched the video clip. So, indeed this is an M1 compile with a .lua script (so disregard my question in brackets above). Mine crashed after 1:50 secs, your's didn't. So, that still leaves the question which of these compile recipes did you use ? (and which brew targets did you use - luajit doesn't compile via homebrew)?


Hmm, I don't remember, but I think it was one of the following methods.








						CI: Update build script to create arm64 builds for Apple silicon by Developer-Ecosystem-Engineering · Pull Request #4714 · obsproject/obs-studio
					

Description  Update Sparkle to universal Update full-build-macos to support arch Point at an arm64 CEF variant  Motivation and Context The resulting OBS Studio app will build native and run on Appl...




					github.com
				











						OBS(Apple Silicon arm64)をビルドする
					

M1 MacなどのApple Silicon搭載のMac上でネイティブに動作するOBSをソースコードからビルドする方法




					www.kilinbox.net


----------



## neonyme (Aug 10, 2021)

Is there any way that I could get the Advanced Scene Switcher compiled for M1/ARM?   I spent quite a lot of time to have a setup of OBS and plugins that is now well up-n-running on my M1 iMac, so I'm not willing to rebuild/reinstall anything at this time...   but this is the plugin i'm missing the most.   It would be wonderful if I could get my hand on a package just for this plugin!   :)  Thanks!


----------



## callimeron (Aug 10, 2021)

neonyme said:


> Is there any way that I could get the Advanced Scene Switcher compiled for M1/ARM?   I spent quite a lot of time to have a setup of OBS and plugins that is now well up-n-running on my M1 iMac, so I'm not willing to rebuild/reinstall anything at this time...   but this is the plugin i'm missing the most.   It would be wonderful if I could get my hand on a package just for this plugin!   :)  Thanks!


from https://github.com/WarmUpTill/SceneSwitcher

compiled here. not tested.





						firestorage | メッセージ
					






					firestorage.com
				



download password bnmihfsi


----------



## neonyme (Aug 12, 2021)

callimeron said:


> from https://github.com/WarmUpTill/SceneSwitcher
> 
> compiled here. not tested.



Oh man, you just saved my forthcoming livestream event!  I have tested it, and works perfectly for my use case (timed sequence).  Wonderful.  Thank you very much for this, I really really appreciate!

Bernard


----------



## Heino Falcke (Aug 12, 2021)

It was quite straightforward to compile the advanced scene switcher "in tree". I cloned the GIT rep of the advanced scene switcher into obs-studio/UI/frontend-plugins/

cd obs-studio/UI/frontend-plugins/
git clone --recursive https://github.com/WarmUpTill/SceneSwitcher.git

and edited CMakeLists.txt to include 
add_subdirectory(SceneSwitcher)

BTW, I also added obs-ndi
add_subdirectory(obs-ndi)

or compile directly 
cd obs-studio/UI/frontend-plugins/
git clone --recursive  https://github.com/Palakis/obs-ndi.git
cd obs-ndi
mkdir build && cd build
cmake -DLIBOBS_INCLUDE_DIR="/Users/falcke/Git/obs-studio/libobs"
-DLIBOBS_LIB="/Users/falcke/Git/obs-studio/libobs/libobs.dylib"
-DOBS_FRONTEND_LIB="/Users/falcke/Git/obs-studio/build/UI/obs-frontend-api/libobs-frontend-api.dylib"
-DQt5Core_DIR=/opt/homebrew/Cellar/qt\@5/5.15.2/lib/cmake/Qt5Core/
-DQt5Widgets_DIR=/opt/homebrew/Cellar/qt\@5/5.15.2/lib/cmake/Qt5Widgets/
..

BTW - you just  to make sure you have the correct libndi.4.dylib for ARM and copy it to /usr/local/lib/



neonyme said:


> Is there any way that I could get the Advanced Scene Switcher compiled for M1/ARM?   I spent quite a lot of time to have a setup of OBS and plugins that is now well up-n-running on my M1 iMac, so I'm not willing to rebuild/reinstall anything at this time...   but this is the plugin i'm missing the most.   It would be wonderful if I could get my hand on a package just for this plugin!   :)  Thanks!


----------



## Heino Falcke (Aug 12, 2021)

Strange. It sill doesn't work for me. Can't read method 2 well, but it doesn't seem to do anything special for LUA scripting (but i see Python mentioned), and method 1 doesn't automatically include obslua if you hadn't installed it already yourself. (I had it and also tried Method 1, so OBS compiled with lua, but then crashed already when loading a script). Could it be that you had an older version of luajit installed already?



callimeron said:


> Hmm, I don't remember, but I think it was one of the following methods.
> 
> 
> 
> ...


----------



## callimeron (Aug 13, 2021)

Heino Falcke said:


> Strange. It sill doesn't work for me. Can't read method 2 well, but it doesn't seem to do anything special for LUA scripting (but i see Python mentioned), and method 1 doesn't automatically include obslua if you hadn't installed it already yourself. (I had it and also tried Method 1, so OBS compiled with lua, but then crashed already when loading a script). Could it be that you had an older version of luajit installed already?



I'm sorry. I don't know why it crashes in your environment.

I recorded a video of me building OBS for your reference.








						imgur.com
					

Imgur: The magic of the Internet




					imgur.com


----------



## hakihaki95 (Aug 20, 2021)

I am building new version. and Lua script works well.
I used this script https://www.kilinbox.net/2021/02/obsarmbuild.html
and changed new cef binary address.
new binary code has no cefBrowserSettings.web_security = STATE_DISABLED;
I could solve this problem with https://qiita.com/kitazaki/items/2484a5475bbe89426c06
open "plugins/obs-browser/obs-browser-source.cpp"
and find "cefBrowserSettings.web_security = STATE_DISABLED;"
remove this line or add "//" in front of this line.
That's all.
I upload my script. and Copy it to CI folder.
and run.


----------



## shiggitay (Aug 21, 2021)

callimeron said:


> There are multiple ways to build for Apple Silicon.
> Please try them out.
> 
> 
> ...



When I try and run that script I get this error:


/tmp/obs/plugins/obs-outputs/librtmp/handshake.h:29:10: fatal error: 'mbedtls/arc4.h' file not found
#include <mbedtls/arc4.h>
         ^~~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [plugins/obs-outputs/CMakeFiles/obs-outputs.dir/librtmp/rtmp.c.o] Error 1
make[1]: *** [plugins/obs-outputs/CMakeFiles/obs-outputs.dir/all] Error 2
make: *** [all] Error 2
[Fri Aug 20 20:14:28 EDT 2021] FATAL: Unable to build OBS; see above logs for more info. Try running this instead: REPACKAGE=true ./install.sh

Can anyone help with that? Or can someone post a binary?


----------



## hakihaki95 (Aug 21, 2021)

hakihaki95 said:


> I am building new version. and Lua script works well.
> I used this script https://www.kilinbox.net/2021/02/obsarmbuild.html
> and changed new cef binary address.
> new binary code has no cefBrowserSettings.web_security = STATE_DISABLED;
> ...


you need to run 
./full-build-mac-arm64.sh -p -b
And, you can find new compiled one in "build" folder. app and dmg. Both are the same thing.


shiggitay said:


> When I try and run that script I get this error:
> 
> 
> /tmp/obs/plugins/obs-outputs/librtmp/handshake.h:29:10: fatal error: 'mbedtls/arc4.h' file not found
> ...


There is some problem with newest mbedlts.
use this.








						GitHub - Zfauser/obs-installer-for-apple-silicon: Conveniently build and install OBS from source on your ultra-fast Apple M1 MacBook or Mac
					

Conveniently build and install OBS from source on your ultra-fast Apple M1 MacBook or Mac - GitHub - Zfauser/obs-installer-for-apple-silicon: Conveniently build and install OBS from source on your ...




					github.com


----------



## shiggitay (Aug 27, 2021)

hakihaki95 said:


> you need to run
> ./full-build-mac-arm64.sh -p -b
> And, you can find new compiled one in "build" folder. app and dmg. Both are the same thing.
> 
> ...



I used that fork and I'm still getting that same error. I don't have ./full-build-mac-arm64.sh -p -b. Can't you just post a binary you were able to compile?


----------



## shiggitay (Aug 27, 2021)

hakihaki95 said:


> you need to run
> ./full-build-mac-arm64.sh -p -b
> And, you can find new compiled one in "build" folder. app and dmg. Both are the same thing.
> 
> ...



EDIT: I actually went to that Japanese site and I c/p'd all the command line stuff and I got it building, but it fails at the last step:


[100%] Built target obs
[OBS-Studio] Creating macOS app bundle
[OBS-Studio] Preparing OBS.app bundle
  + Copy binary and plugins...
mv: rename ./OBS.app/Contents/Resources/data/obs-scripting/_obspython.so to ./OBS.app/Contents/MacOS/_obspython.so: No such file or directory
  + ERROR during build step: bundle app

No matter what I do I can't even launch the resulting OBS.app that's generated in the build directory. Help? Are you on the OBS Discord? Here's an invite link just in case you're not there already: https://discord.gg/obsproject.


----------



## Heino Falcke (Aug 27, 2021)

You can simply comment out all lines in full-build-macos-arm64.sh that contain obspython

    #        ./OBS.app/Contents/MacOS/_obspython.so

#        /bin/mv ./OBS.app/Contents/Resources/data/obs-scripting/_obspython.so ./OBS.app/Contents/MacOS/
#        /bin/mv ./OBS.app/Contents/Resources/data/obs-scripting/obspython.py ./OBS.app/Contents/MacOS/


----------



## Heino Falcke (Aug 28, 2021)

To add the advanced scene switcher:
add    line  ./OBS.app/Contents/PlugIns/advanced-scene-switcher.so 
to     BUNDLE_PLUGINS=( 
in full-build-macos-arm64.sh

in the Git clone of obs-studio download the source code of the advanced scene switcher:
cd obs-studio/UI/frontend-plugins/
git clone --recursive https://github.com/WarmUpTill/SceneSwitcher.git

Then modify the obs-studio/UI/frontend-plugins/CMakeLists.txt file and add an entry for the scene switcher: 
add_subdirectory(SceneSwitcher)

finally rerun the build script full-build-macos-arm64.sh


----------



## Heino Falcke (Aug 29, 2021)

Finally, I was able to compile a version of OBS running natively on M1, that includes lua scripting, the Advanced Scence Switcher, and obs-ndi.   I used the script by *hakihaki95 *and slightly modified it to avoid the error with python. I have attached the script and the notes/commands I used to compile the whole thing. This could probably be turned into a complete script by someone.


----------



## shiggitay (Aug 29, 2021)

Heino Falcke said:


> Finally, I was able to compile a version of OBS running natively on M1, that includes lua scripting, the Advanced Scence Switcher, and obs-ndi.   I used the script by *hakihaki95 *and slightly modified it to avoid the error with python. I have attached the script and the notes/commands I used to compile the whole thing. This could probably be turned into a complete script by someone.



Does OBS Browser Source (CEF etc) work with your build?


----------



## Heino Falcke (Aug 29, 2021)

shiggitay said:


> Does OBS Browser Source (CEF etc) work with your build?


I didn't need it and only now tested is. "What is not tested, doesn't work" - and indeed it crashed, when I tried to add a Browser source (but it was compiled). I won't have time to research that in greater detail unfortunately.


----------



## shiggitay (Aug 29, 2021)

Heino Falcke said:


> I didn't need it and only now tested is. "What is not tested, doesn't work" - and indeed it crashed, when I tried to add a Browser source (but it was compiled). I won't have time to research that in greater detail unfortunately.



No problem. Thanks for tweaking the process :)


----------



## Azzenie (Sep 12, 2021)

Heino Falcke first of all big thanks for sharing the .sh file; this really helped me get an M1 compatible version of OBS. 
I am struggling a bit with ndi-obs though. I followed through each and every step, however, when I copy libobs-ndi.so to the obs-plugins folder, OBS crashes.

Removing the file makes everything go back to normal. Is there any way you might know of to solve the issue, or perhaps you could share the exact .so files you managed to compile and successfuly run obs-ndi with? Would really appreciate any form of help here!


----------



## Heino Falcke (Sep 15, 2021)

Azzenie said:


> Heino Falcke first of all big thanks for sharing the .sh file; this really helped me get an M1 compatible version of OBS.
> I am struggling a bit with ndi-obs though. I followed through each and every step, however, when I copy libobs-ndi.so to the obs-plugins folder, OBS crashes.
> 
> Removing the file makes everything go back to normal. Is there any way you might know of to solve the issue, or perhaps you could share the exact .so files you managed to compile and successfuly run obs-ndi with? Would really appreciate any form of help here!


Can't answer this easily. Maybe there are conflicting versions flying around or you do not have the correct version of libndi.4.dylib

Actually, the statement
# Copy libndi.dylib from the NDI SDK to the obs-plugins folder too

is probably wrong, it should say

# Copy libndi.4.dylib to /usr/local/lib/libndi.4.dylib

The version I used is here: https://www.dropbox.com/s/ruvebdj4se0ujt7/libndi.4.dylib?dl=0


----------



## MikeElders (Sep 18, 2021)

Heino Falcke said:


> Finally, I was able to compile a version of OBS running natively on M1, that includes lua scripting, the Advanced Scence Switcher, and obs-ndi.   I used the script by *hakihaki95 *and slightly modified it to avoid the error with python. I have attached the script and the notes/commands I used to compile the whole thing. This could probably be turned into a complete script by someone.



What would be involved in making a complete script? Because I am just not smart enough to figure out all this compiling stuff. I used the carlosonunez link above and it installed great and the native M1 performance is incredible! But scripts don’t work, the whole script menu is missing, ugh.


----------



## VPinho (Sep 20, 2021)

Hello, i'm a newbie...i tryed all the commands to "compile" or something and it is always giving me errors when i try to install Homebrew...is that a way to make a Installer or something....if the "ARM Project build" is stable, why don't you make a Beta version of it that the user doen't have to use Terminal...? So, simply drop the executable to Application folder and done...? or Next Next Next Finish?
I am not a developer...i don't know nothing about "command lines"...i'm just a OBS user that has switched from Intel PC's to ARM Macs...

I'm sory but Homebrew errors is making me crazy!

If you are using OBS M1 Native version, please ZIP the executable that you have on"Application" Folder and share it here via Google Drive...


----------



## lucouto (Nov 20, 2021)

I second that from VPinho. Is it possible for someone to share the compiled OBS M1 version? That would be awesome!


----------



## thmsdj (Aug 1, 2022)

callimeron said:


> from https://github.com/WarmUpTill/SceneSwitcher
> 
> compiled here. not tested.
> 
> ...


Would it be possible to get the precompiled version of Advanced Scene Switcher for ARM M1 OBS? The link unfortunately is not available. 

I get a Cmake / qt5 error when trying to compile the plugin:

`CMake Error at CMakeLists.txt:67 (find_package):
  By not providing "FindQt5Core.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Qt5Core", but
  CMake did not find one.

  Could not find a package configuration file provided by "Qt5Core" with any
  of the following names:

    Qt5CoreConfig.cmake
    qt5core-config.cmake

  Add the installation prefix of "Qt5Core" to CMAKE_PREFIX_PATH or set
  "Qt5Core_DIR" to a directory containing one of the above files.  If
  "Qt5Core" provides a separate development package or SDK, be sure it has
  been installed.`

Thanks in advance!


----------

