Ubuntu 下编译 obs 多路推流插件

Ubuntu 下编译 obs 多路推流插件

一、安装 obs-studio

1
sudo apt-get install obs-studio

二、下载 obs-multi-rtmp 源码

1
git clone https://github.com/sorayuki/obs-multi-rtmp/	

三、一些必要环境

  • Build system dependencies

    1
    sudo apt install cmake ninja-build pkg-config clang clang-format build-essential curl ccache git
  • OBS dependencies (core):

    1
    sudo apt install libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev libavutil-dev libswresample-dev libswscale-dev libx264-dev libcurl4-openssl-dev libmbedtls-dev libgl1-mesa-dev libjansson-dev libluajit-5.1-dev python3-dev libx11-dev libxcb-randr0-dev libxcb-shm0-dev libxcb-xinerama0-dev libxcomposite-dev libxinerama-dev libxcb1-dev libx11-xcb-dev libxcb-xfixes0-dev swig libcmocka-dev libxss-dev libglvnd-dev libgles2-mesa libgles2-mesa-dev libwayland-dev
  • OBS dependencies (UI):

    1
    sudo apt install qt6-base-dev qt6-base-private-dev libqt6svg6-dev qt6-wayland
  • If Qt6 is not available:

    1
    sudo apt install qtbase5-dev qtbase5-private-dev libqt5svg5-dev qtwayland5
  • Plugin dependencies:

    1
    sudo apt install libasound2-dev libfdk-aac-dev libfontconfig-dev libfreetype6-dev libjack-jackd2-dev libpulse-dev libsndio-dev libspeexdsp-dev libudev-dev libv4l-dev libva-dev libvlc-dev libdrm-dev

四、编译

项目目录下

1
./build_linux.sh
  1. 如报错 /usr/bin/ld: 找不到 -llibobs: 没有那个文件或目录

手动

1
2
sudo updatedb
locate */libobs.so

将 CMakelists.txt 中的

1
set(LIB_OBS libobs)

改为

1
set(LIB_OBS /usr/lib/x86_64-linux-gnu/libobs.so) # 根据 locate 得到的位置来
  1. 如报错需要设置 OBS_SRC_DIR 则
1
export OBS_SRC_DIR=/usr/include/obs/

五、使用

解压得到的 obs-multi-rtmp_Linux_0.2.8.0.tar.xz 复制 /usr/share 对应目录

但不知为什么默认不加载 /usr/lib/obs-plugins 的 so 文件,查看 obs 其他插件的 log 后复制到对应位置

1
sudo cp ./obs-multi-rtmp.so /usr/lib/x86_64-linux-gnu/obs-plugins