complete-computing-environment/obs-v4l2sink.org

133 lines
3.6 KiB
Org Mode

:PROPERTIES:
:ID: cce/obs-v4l2sink
:ROAM_ALIASES: obs-v4l2sink v4l2loopback
:END:
#+TITLE: v4l2loopback and obs-v4l2sink let you use OBS for your webcam
#+ARCOLOGY_KEY: cce/obs-v4l2sink
#+ARCOLOGY_ALLOW_CRAWL: t
#+filetags: :CCE:
#+PROPERTY: header-args :mkdirp yes :results none
#+PROPERTY: header-args:emacs-lisp :tangle obs-v4l2sink.el
#+PROPERTY: header-args:yaml :tangle roles/endpoint/tasks/obs-v4l2sink.yml
#+CCE_ANSIBLE: obs-v4l2sink
#+CCE_PRIORITY: 90
#+CCE_PREDICATE: (and (cce/using-linux) (not (cce/using-termux)))
#+NAME: description
=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 Cam" exclusive_caps=1 &]] 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 [[id:70dbd5ac-05c0-404a-b187-1c0019bcd3fc][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=:
#+begin_src yaml
- 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
#+end_src
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 [[id:fedora_linux][Fedora Linux]]:
#+begin_src yaml
- 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
#+end_src