complete-computing-environment/obs-v4l2sink.org

3.6 KiB

v4l2loopback and obs-v4l2sink let you use OBS for your webcam

v4l2loopback and obs-v4l2sink let you use the OBS scene builder for your webcam. Run shell:sudo modprobe v4l2loopback devices=1 video_nr=10 card_label="OBS%20Cam&%2334;%20exclusive_caps=1%20& to install the module in to a running system. It will fail if the kernel is updated, run shell:bash /home/rrix/org/cce/cce.shell -t obs-v4l2 & to rebuild the kernel module. Based on Hacking the video stream for BlueJeans on Linux: spot — LiveJournal. Use it by opening roam:Open Broadcast Studio and enabling the V4L sink in the Tools menu.

v4l2loopback is built with a Makefile:

- name: v4l2loopback cloned
  git:
    version: origin/master
    repo: https://github.com/umlaeute/v4l2loopback
    dest: /home/{{local_account}}/Code/v4l2loopback
  register: v4l2l_clone
  become_user: "{{local_account}}"
  become: yes
  tags:
  - obs-v4l2
  - media

- name: kernel headers and other libs are available
  dnf:
    state: installed
    name:
    - kernel-devel
    - obs-studio-devel
  tags:
  - obs-v4l2
  - media

- name: compile kernel module
  shell:
    cmd: make v4l2loopback.ko
    chdir: /home/{{local_account}}/Code/v4l2loopback
  become_user: "{{local_account}}"
  become: yes
  tags:
  - obs-v4l2
  - media

- name: install kernel module
  shell:
    cmd: make install
    chdir: /home/{{local_account}}/Code/v4l2loopback
  tags:
  - obs-v4l2
  - media

That can be tested with shell:v4l2-ctl --all & and shell:v4l2-ctl -d /dev/video10 --list-formats-ext &.

Now obs-v4l2sink is compiled with some simple changes to make it work on Fedora Linux:

- name: obs-v4l2sink cloned
  git:
    version: origin/master
    repo: https://github.com/CatxFish/obs-v4l2sink.git
    dest: /home/{{local_account}}/Code/obs-v4l2sink
    force: yes # haha suckers!
  register: v4l2s_clone
  become_user: "{{local_account}}"
  become: yes
  tags:
  - obs-v4l2
  - media

- name: build dir exists
  file:
    state: directory
    path: ~/Code/obs-v4l2sink/build
  become_user: "{{local_account}}"
  become: yes
  tags:
  - obs-v4l2
  - media

- name: fix for LibObs cmake helper not working
  lineinfile:
    regexp: cmake/external/ObsPluginHelpers.cmake
    line: "       include(/usr/lib64/cmake/LibObs/ObsPluginHelpers.cmake)"
    path: /home/{{local_account}}/Code/obs-v4l2sink/external/FindLibObs.cmake
  become_user: "{{local_account}}"
  become: yes
  tags:
  - obs-v4l2
  - media

- name: cmake generates makefile
  shell:
    cmd: cmake .. -DLIBOBS_INCLUDE_DIR=/usr/include/obs -DCMAKE_INSTALL_PREFIX=/usr/
    chdir: /home/{{local_account}}/Code/obs-v4l2sink/build
  become_user: "{{local_account}}"
  become: yes
  tags:
  - obs-v4l2
  - media

- name: compile obs-v4l2sink
  shell:
    cmd: make
    chdir: /home/{{local_account}}/Code/obs-v4l2sink/build
  become_user: "{{local_account}}"
  become: yes
  tags:
  - obs-v4l2
  - media

- name: install obs-v4l2sink
  shell:
    cmd: make install
    chdir: /home/{{local_account}}/Code/obs-v4l2sink/build
  tags:
  - obs-v4l2
  - media