Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

successful build on M1 Mac with homebrew deps #16

Closed
wants to merge 1 commit into from

Conversation

gdhgdhgdh
Copy link

Hello - thanks for the recent pointers by email. The compile + run worked fine and I'm offering the changes I made to enable a successful compile

deps were installed with brew install jpeg-turbo and brew install ffmpeg

@aramg
Copy link
Collaborator

aramg commented Nov 14, 2021

Hi, excellent thank you. Will keep this open for now and link from the FAQs.
An official M1 build should come around in the near future.

@iambenmitchell
Copy link

Could you tell me what command you ran?

I want to build this for M1 too (to go with M1 OBS)

@gdhgdhgdh
Copy link
Author

Could you tell me what command you ran?

I want to build this for M1 too (to go with M1 OBS)

Literally just make

@iambenmitchell
Copy link

iambenmitchell commented Dec 1, 2021

I'm getting this error:
fatal error: 'libavcodec/avcodec.h' file not found

Full Log
Last login: Wed Dec 1 12:57:37 on ttys001 benmitchell@Scylla ~ % cd /Users/benmitchell/Files/obs/droidcam-obs-plugin benmitchell@Scylla droidcam-obs-plugin % make g++ -std=c++11 -x c++ -Wall -fPIC -dead_strip -Isrc/ -I/opt/homebrew/opt/qt5/include -I/opt/homebrew/opt/qt5/include/QtCore -I/opt/homebrew/opt/qt5/include/QtWidgets -I/opt/homebrew/opt/libjpeg-turbo/include -I../ffmpeg -I../obs-studio/UI -I../obs-studio/libobs -L/Applications/OBSM1.app/Contents/Resources/bin -L/opt/homebrew/opt/libjpeg-turbo/lib -lobs-frontend-api -lobs.0 -lavcodec.58 -lavformat.58 -lavutil.56 -lturbojpeg -bundle src/command.c src/ffmpeg_decode.c src/mjpeg_decode.c src/net.c src/plugin.c src/sys/unix/cmd.c -o build/droidcam-obs.so In file included from src/ffmpeg_decode.c:20: src/ffmpeg_decode.h:34:10: fatal error: 'libavcodec/avcodec.h' file not found #include ^~~~~~~~~~~~~~~~~~~~~~ 1 error generated. In file included from src/plugin.c:23: src/ffmpeg_decode.h:34:10: fatal error: 'libavcodec/avcodec.h' file not found #include ^~~~~~~~~~~~~~~~~~~~~~ 1 error generated. make: *** [build/droidcam-obs.so] Error 1 benmitchell@Scylla droidcam-obs-plugin % brew install gnutls Warning: gnutls 3.6.16_1 is already installed and up-to-date. To reinstall 3.6.16_1, run: brew reinstall gnutls benmitchell@Scylla droidcam-obs-plugin % clear

benmitchell@Scylla droidcam-obs-plugin % make
g++ -std=c++11 -x c++ -Wall -fPIC -dead_strip -Isrc/ -I/opt/homebrew/opt/qt5/include -I/opt/homebrew/opt/qt5/include/QtCore -I/opt/homebrew/opt/qt5/include/QtWidgets -I/opt/homebrew/opt/libjpeg-turbo/include -I../ffmpeg -I../obs-studio/UI -I../obs-studio/libobs -L/Applications/OBSM1.app/Contents/Resources/bin -L/opt/homebrew/opt/libjpeg-turbo/lib -lobs-frontend-api -lobs.0 -lavcodec.58 -lavformat.58 -lavutil.56 -lturbojpeg -bundle src/command.c src/ffmpeg_decode.c src/mjpeg_decode.c src/net.c src/plugin.c src/sys/unix/cmd.c -o build/droidcam-obs.so
In file included from src/ffmpeg_decode.c:20:
src/ffmpeg_decode.h:34:10: fatal error: 'libavcodec/avcodec.h' file not found
#include <libavcodec/avcodec.h>
^~~~~~~~~~~~~~~~~~~~~~
1 error generated.
In file included from src/plugin.c:23:
src/ffmpeg_decode.h:34:10: fatal error: 'libavcodec/avcodec.h' file not found
#include <libavcodec/avcodec.h>
^~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make: *** [build/droidcam-obs.so] Error 1
benmitchell@Scylla droidcam-obs-plugin %

@iambenmitchell
Copy link

I downloaded the FFmpeg project and put it in the parent directory. The error has changed a bit but I still get ../ffmpeg/libavutil/macros.h:28:10: fatal error: 'libavutil/avconfig.h' file not found

Full Log
benmitchell@Scylla droidcam-obs-plugin % make g++ -std=c++11 -x c++ -Wall -fPIC -dead_strip -Isrc/ -I/opt/homebrew/opt/qt5/include -I/opt/homebrew/opt/qt5/include/QtCore -I/opt/homebrew/opt/qt5/include/QtWidgets -I/opt/homebrew/opt/libjpeg-turbo/include -I../ffmpeg -I../obs-studio/UI -I../obs-studio/libobs -L/Applications/OBSM1.app/Contents/Resources/bin -L/opt/homebrew/opt/libjpeg-turbo/lib -lobs-frontend-api -lobs.0 -lavcodec.58 -lavformat.58 -lavutil.56 -lturbojpeg -bundle src/command.c src/ffmpeg_decode.c src/mjpeg_decode.c src/net.c src/plugin.c src/sys/unix/cmd.c -o build/droidcam-obs.so In file included from src/ffmpeg_decode.c:20: In file included from src/ffmpeg_decode.h:34: In file included from ../ffmpeg/libavcodec/avcodec.h:30: In file included from ../ffmpeg/libavutil/samplefmt.h:24: In file included from ../ffmpeg/libavutil/avutil.h:296: In file included from ../ffmpeg/libavutil/common.h:43: ../ffmpeg/libavutil/macros.h:28:10: fatal error: 'libavutil/avconfig.h' file not found #include "libavutil/avconfig.h" ^~~~~~~~~~~~~~~~~~~~~~ 1 error generated. In file included from src/plugin.c:23: In file included from src/ffmpeg_decode.h:34: In file included from ../ffmpeg/libavcodec/avcodec.h:30: In file included from ../ffmpeg/libavutil/samplefmt.h:24: In file included from ../ffmpeg/libavutil/avutil.h:296: In file included from ../ffmpeg/libavutil/common.h:43: ../ffmpeg/libavutil/macros.h:28:10: fatal error: 'libavutil/avconfig.h' file not found #include "libavutil/avconfig.h" ^~~~~~~~~~~~~~~~~~~~~~ 1 error generated. make: *** [build/droidcam-obs.so] Error 1 benmitchell@Scylla droidcam-obs-plugin %

@iambenmitchell
Copy link

@gdhgdhgdh could you share your already compiled version with me please? I'm not sure what I am missing to compile it myself.

Thanks : )

@iambenmitchell
Copy link

nvm I am stupid. For some reason when I cloned the project, I forgot to checkout this branch.

Anyways, you need to make a build folder and then running make will work. Also make sure that the OBS.app you reference is compiled for ARM, personally I have two. A normal x86 OBS.app and a ARM OBSM1.app.
build.zip

@iambenmitchell
Copy link

Can confirm that replacing the droidcam-obs.so in /Library/Application Support/obs-studio/plugins/droidcam-obs/bin does indeed work.

Hardware acceleration also works now too, before it would black screen.

The only issue I have encountered is that the iOS app says "Update OBS plugin" leading me to believe that this repo is not up to date?

@aramg
Copy link
Collaborator

aramg commented Dec 1, 2021

The only issue I have encountered is that the iOS app says "Update OBS plugin" leading me to believe that this repo is not up to date?

You're right, seems there was missing a git push, sorry -- updated.You can use git rebase upstream master to sync this PR branch and recompile if you'd like.

@iambenmitchell
Copy link

You're right, seems there was missing a git push, sorry -- updated.You can use git rebase upstream master to sync this PR branch and recompile if you'd like.

Thanks :)

I have compiled this updated version for M1 and have attached it to this reply for anyone who wants it. build.zip

@iambenmitchell
Copy link

Is there an ETA for when an official version will be released?

My hardware acceleration has stopped working. Not sure why.

info: [DroidCamOBS] use hw: 1
info: [DroidCamOBS] @decoder alloc: size=45345
info: [DroidCamOBS] @decoder alloc: size=127629
info: [DroidCamOBS] @decoder alloc: size=15043
[h264 @ 0x12a81b000] hardware accelerator failed to decode picture
warning: [DroidCamOBS] error decoding video
info: [DroidCamOBS] discarding frame.. decoder failed
info: [DroidCamOBS] discarding frame.. decoder failed
info: [DroidCamOBS] discarding frame.. decoder failed

@aramg
Copy link
Collaborator

aramg commented Jan 22, 2022

Mostly waiting for OBS Studio to be released officially with M1 support.
Hardware acceleration is done via FFMpeg (videotoolbox hw interface), if it worked before maybe just needs a reboot?

@lupus2k
Copy link

lupus2k commented Feb 16, 2022

Hi folks, I got this problem when I tried to make on my M1, Can you help me?

g++ -std=c++11 -x c++ -Wall -fPIC -dead_strip -Isrc/ -I/usr/local/opt/qt5/include -I/usr/local/opt/qt5/include/QtCore -I/usr/local/opt/qt5/include/QtWidgets -I/usr/local/opt/libjpeg-turbo/include -I../ffmpeg -I../obs-studio-24.0.2/UI -I../obs-studio-24.0.2/libobs  -L/Applications/OBS.app/Contents/Resources/bin -L/usr/local/opt/libjpeg-turbo/lib -lobs-frontend-api -lobs.0 -lavcodec.58 -lavformat.58 -lavutil.56 -lturbojpeg  -bundle src/command.c src/ffmpeg_decode.c src/mjpeg_decode.c src/net.c src/plugin.c src/sys/unix/cmd.c  -o build/droidcam-obs.so
In file included from src/command.c:26:
In file included from src/command.h:5:
src/plugin.h:5:10: fatal error: 'obs-module.h' file not found
#include <obs-module.h>
         ^~~~~~~~~~~~~~
1 error generated.
In file included from src/ffmpeg_decode.c:19:
src/plugin.h:5:10: fatal error: 'obs-module.h' file not found
#include <obs-module.h>
         ^~~~~~~~~~~~~~
1 error generated.
In file included from src/mjpeg_decode.c:17:
src/plugin.h:5:10: fatal error: 'obs-module.h' file not found
#include <obs-module.h>
         ^~~~~~~~~~~~~~
1 error generated.
In file included from src/net.c:20:
src/plugin.h:5:10: fatal error: 'obs-module.h' file not found
#include <obs-module.h>
         ^~~~~~~~~~~~~~
1 error generated.
src/plugin.c:18:10: fatal error: 'util/threading.h' file not found
#include <util/threading.h>
         ^~~~~~~~~~~~~~~~~~
1 error generated.
In file included from src/sys/unix/cmd.c:21:
In file included from src/command.h:5:
src/plugin.h:5:10: fatal error: 'obs-module.h' file not found
#include <obs-module.h>
         ^~~~~~~~~~~~~~
1 error generated.
make: *** [build/droidcam-obs.so] Error 1```

Thanks in advance!

@aramg
Copy link
Collaborator

aramg commented Feb 19, 2022

All, the following package contains a universal build of the droidcam plugin, with both Intel and M1 support.

Requires OBS Studio 27.1.3 or lower. OBS v27.2 introduced a breaking change that should be resolved with their next update, making this universal package work again.

If I could get extra confirmation everything works on M1 Macs (including hardware acceleration), we can make this available to all users.

https://files.dev47apps.net/obs/DroidCamOBS_Universal_1.2.3.pkg

After installation,

$ file /Library/Application\ Support/obs-studio/plugins/droidcam-obs/bin/droidcam-obs.so

/Library/Application Support/obs-studio/plugins/droidcam-obs/bin/droidcam-obs.so: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit bundle x86_64] [arm64:Mach-O 64-bit bundle arm64]

@AussieBrickster
Copy link

All, the following package contains a universal build of the droidcam plugin, with both Intel and M1 support.

Requires OBS Studio 27.1.3 or lower. OBS v27.2 introduced a breaking change that should be resolved with their next update, making this universal package work again.

If I could get extra confirmation everything works on M1 Macs (including hardware acceleration), we can make this available to all users.

https://files.dev47apps.net/obs/DroidCamOBS_Universal_1.2.3.pkg

After installation,

$ file /Library/Application\ Support/obs-studio/plugins/droidcam-obs/bin/droidcam-obs.so

/Library/Application Support/obs-studio/plugins/droidcam-obs/bin/droidcam-obs.so: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit bundle x86_64] [arm64:Mach-O 64-bit bundle arm64]

tried it on M1 27.1.3 , no luck

Replaced the .so with the build from dec 2nd and no luck either

@eklepitsch
Copy link

All, the following package contains a universal build of the droidcam plugin, with both Intel and M1 support.

Requires OBS Studio 27.1.3 or lower. OBS v27.2 introduced a breaking change that should be resolved with their next update, making this universal package work again.

If I could get extra confirmation everything works on M1 Macs (including hardware acceleration), we can make this available to all users.

https://files.dev47apps.net/obs/DroidCamOBS_Universal_1.2.3.pkg

After installation,

$ file /Library/Application\ Support/obs-studio/plugins/droidcam-obs/bin/droidcam-obs.so

/Library/Application Support/obs-studio/plugins/droidcam-obs/bin/droidcam-obs.so: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit bundle x86_64] [arm64:Mach-O 64-bit bundle arm64]

I gave this a try on my M1 Mac Mini and it worked beautifully. The file command reports both x86 and ARM architectures, and the plugin works with OBS 27.1.3. I'm able to use both WIFI and USB, both with and without hardware acceleration.

Thanks so much for making this available. I've been looking for a solution to connect my Android camera to the M1 Mac (via USB) for weeks and this finally did the trick!

@aramg
Copy link
Collaborator

aramg commented Mar 16, 2022

The universal download has been live on the website for some time now with no reported issues.

@aramg aramg closed this Mar 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants