LoginSignup
4
2

More than 3 years have passed since last update.

macOS (Mojave、High Sierra) で OBS-Studio をビルドして obs-virtual-camera を試すメモ。

Last updated at Posted at 2020-05-03

はじめに

OBS-Studio の obs-mac-virtualcam プラグインを試めすため、macOS で OBS-Studio のビルドでハマったので備忘録を兼ねてメモに残しておきます。
(最終的にはビルドもインストールもうまく行きました!)

titile.png

(参考)

ビルド手順

環境

  • macOS (Mojave 10.14.6)

基本的な手順

OBS-Studio のビルド手順は以下のとおりです。

$ git clone --recursive https://github.com/obsproject/obs-studio.git
$ cd obs-studio
$ brew install FFmpeg x264 Qt5 cmake mbedtls swig
$ mkdir build
$ cd build
$ export QTDIR=/usr/local/opt/qt
$ cmake ..
$ make -j

mac-obs-virtual-camera のビルド手順は以下のとおりです。

$ git clone https://github.com/johnboiles/obs-mac-virtualcam.git
$ cd obs-mac-virtualcam
$ export OBS_DIR=$PWD/../obs-studio
$ mkdir build
$ cd build
$ cmake -DLIBOBS_INCLUDE_DIR:STRING=$OBS_DIR/libobs -DLIBOBS_LIB:STRING=$OBS_DIR/build/libobs/libobs.dylib -DOBS_FRONTEND_LIB:STRING=$OBS_DIR/build/UI/obs-frontend-api/libobs-frontend-api.dylib -DQTDIR:STRING=/usr/local/opt/qt ..
$ make -j
$ cp src/obs-plugin/obs-mac-virtualcam.so $OBS_DIR/build/rundir/RelWithDebInfo/obs-plugins/
$ sudo cp -r src/dal-plugin/obs-mac-virtualcam.plugin /Library/CoreMediaIO/Plug-Ins/DAL

OBS-Studio の起動手順は以下のとおりです。

$ cd $OBS_DIR/build/rundir/RelWithDebInfo/bin
$ ./obs

追加手順

ビルドに必要なパッケージを追加します。

$ brew install jack Luajit Jansson SpeexDSP
$ brew cask install vlc

zlib と libiconv をインストールします。

# zlib
$ curl -o zlib-1.2.11.tar.gz https://www.zlib.net/zlib-1.2.11.tar.gz
$ tar xvzf zlib-1.2.11.tar.gz
$ cd zlib-1.2.11
$ ./configure
$ make
$ sudo make install

# libiconv
$ curl -o libiconv-1.16.tar.gz https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gz
$ tar xvzf libiconv-1.16.tar.gz
$ cd libiconv-1.16
$ ./configure
$ make
$ sudo make install

問題点

1. make で zlib の gzclose_w() でエラー。

  "_gzclose_w", referenced from:
      _profiler_snapshot_dump_csv_gz in profiler.c.o
ld: symbol(s) not found for architecture x86_64

2. make で libiconv の iconv()、iconv_open()、iconv_close() でエラー。

Undefined symbols for architecture x86_64:
  "_iconv", referenced from:
      _sfnt_name_to_utf8 in find-font-iconv.c.o
  "_iconv_close", referenced from:
      _sfnt_name_to_utf8 in find-font-iconv.c.o
  "_iconv_open", referenced from:
      _sfnt_name_to_utf8 in find-font-iconv.c.o
ld: symbol(s) not found for architecture x86_64

3. cmake で VLC video plugin が disabled になってしまう。

-- Could NOT find LibVLC_INCLUDES (missing: VLC_INCLUDE_DIR) 
-- LibVLC includes not found, VLC video plugin disabled

原因

1. と 2. はライブラリの問題で、/usr/lib 配下と /usr/local/opt 配下の zlib、iconv には違いがあるためエラーが出ていました。
3. は VLC のインクルードファイルが見つからないため (VLC_INCLUDE_DIR オプションの指定が無いため) エラーが出ていました。

対策

cmake 実行時にオプションを指定します。

  • -DCMAKE_PREFIX_PATH=/usr/local/opt
  • -DVLC_INCLUDE_DIR=/Applications/VLC.app/Contents/MacOS/include/vlc

最終的にビルドが通ったログです。

$ cmake -DCMAKE_PREFIX_PATH=/usr/local/opt -DVLC_INCLUDE_DIR=/Applications/VLC.app/Contents/MacOS/include/vlc ..
-- OBS_VERSION: 25.0.7-65-g2d14ee3-modified
-- Found FFmpeg: /usr/local/Cellar/ffmpeg/3.2/lib/../lib/libavcodec.dylib (found version "57.64.100") found components: avcodec avdevice avutil avformat 
-- Scripting: Luajit supported
-- Scripting: Python 3 supported
-- Using system Jansson library
-- Found FFmpeg: /usr/local/Cellar/ffmpeg/3.2/lib/../lib/libavformat.dylib (found version "57.56.100") found components: avformat avutil swscale swresample avcodec 
-- Using libavcodec for image loading in libobs
-- Found LibVLC_INCLUDES: /Applications/VLC.app/Contents/MacOS/include/vlc  
-- Found jack: /usr/local/lib/libjack.dylib
-- Using the bundled VST header.
-- Found FFmpeg: /usr/local/Cellar/ffmpeg/3.2/lib/../lib/libavcodec.dylib (found version "57.64.100") found components: avcodec avfilter avdevice avutil swscale avformat swresample 
-- Found FFmpeg: /usr/local/Cellar/ffmpeg/3.2/lib/../lib/libavcodec.dylib (found version "57.64.100") found components: avcodec avutil avformat 
-- Found ftl-sdk: ftl outputs enabled
-- SpeexDSP supported
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/kitazaki/tmp/20200503/obs-studio/build

$ make -j
[  1%] Built target media-playback
[  2%] Built target glad
[  3%] Built target obspython_swig_compilation
[  3%] Built target obslua_swig_compilation
[  8%] Built target syphon-framework
[  8%] Built target obs-ffmpeg-mux
[ 27%] Built target libobs
[ 30%] Built target libobs-opengl
[ 31%] Built target mac-avcapture
[ 32%] Built target image-source
[ 33%] Built target mac-capture
[ 33%] Built target file-updater
[ 34%] Built target obs-x264
Scanning dependencies of target vlc-video
[ 35%] Built target obs-libfdk
[ 42%] Built target obs-outputs
[ 44%] Built target obs-ffmpeg
[ 46%] Built target text-freetype2
[ 48%] Built target obs-transitions
[ 49%] Built target linux-jack
[ 49%] Building C object plugins/vlc-video/CMakeFiles/vlc-video.dir/vlc-video-source.c.o
[ 49%] Automatic MOC for target obs-vst
[ 55%] Built target obs-filters
[ 55%] Building C object plugins/vlc-video/CMakeFiles/vlc-video.dir/vlc-video-plugin.c.o
[ 60%] Built target mac-decklink
[ 60%] Built target mac-syphon
[ 61%] Built target mac-vth264
[ 62%] Built target coreaudio-encoder
[ 62%] Built target obs-vst_autogen
[ 62%] Built target obs-frontend-api
[ 64%] Built target obs-vst
[ 64%] Automatic MOC for target obs
[ 65%] Built target rtmp-services
[ 68%] Built target obs-scripting
[ 68%] Automatic MOC for target decklink-ouput-ui
[ 68%] Built target obs_autogen
[ 69%] Built target obslua
[ 69%] Built target _obspython
[ 69%] Automatic MOC for target frontend-tools
[ 69%] Built target decklink-ouput-ui_autogen
[ 69%] Built target frontend-tools_autogen
[ 72%] Built target decklink-ouput-ui
[ 77%] Built target frontend-tools
[ 99%] Built target obs
[100%] Linking C shared module vlc-video.so
[100%] Built target vlc-video
4
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
2