I tried to create an environment where you can have a fun Zoom meeting with Linux (Ubuntu) + Zoom + OBS Studio + sound effects

What I wanted to do

I created an environment where you can do the following so that you can have a fun Zoom meeting with home telework.

--Building a Zoom meeting environment on Linux (Ubuntu) --Process the scene with OBS Studio --Sound effects are popped out during the meeting

All you need is a virtual camera for Zoom, OBS Studio, OBS Studio, and a web app for sound effect popping. No additional hardware such as a mixer is required other than the webcam.

[Supplement] In my environment, I stopped creating virtual microphones in the second half. This is because the echo could not be completely erased at the destination.

Zoom installation

  1. Download Zoom

Go to https://zoom.us/download. dl.png

  1. Install Zoom

When the download is complete, the message "Click to install Zoom" will appear, so click it. inst.png

  1. Run the installer

The installer will start, so click "Install". inst2.png

  1. Installation completed If you see the blue Zoom icon, the installation is complete. icon.png

Install OBS Studio

You can install it with the apt command by pulling the repository. Since my environment is 18.04, skip the installation of FFmpeg and execute the following command. For other versions and for more information, see the references below.

sudo add-apt-repository ppa:obsproject/obs-studio
sudo apt update
sudo apt install obs-studio

Reference: OBS Project Install instruction

Virtual camera installation

I referred to the article on the following site here, and with some exceptions, I was able to successfully introduce it if I did it this way. It is explained in detail with a screen snap, so it is better to see here. Original article: [Day of Speed] stream the video synthesized by OBS Studio on Linux to Skype or Zoom using obs-v4l2sink The following are the commands when installed in my environment.

  1. Install v4l2loopback
sudo apt install v4l2loopback-dkms v4l2loopback-utils
  1. Loading v4l2loopback
sudo modprobe v4l2loopback devices=1 video_nr=10 card_label="OBS Cam" exclusive_caps=1
  1. Download the obs-v4l2sink plugin Download the obs-v4l2sink.deb package from below.

https://github.com/CatxFish/obs-v4l2sink/releases

  1. Install obs-v4l2sink plugin Move to the downloaded directory and install with the following command.
sudo apt install ./obs-v4l2sink.deb
  1. Create symbolic links for obs-v4l2sink plugins It is said that the installation destination and the reference destination of OBS Studio are different, so it is necessary to create a symbolic link with the following command (see the original article).
cd /usr/lib/x86_64-linux-gnu/obs-plugins
sudo ln -s /usr/lib/obs-plugins/v4l2sink.so 
  1. Settings on the OBS Studio side

It is necessary to click "Settings" in "Control" at the bottom right of the screen of OBS Studio, select "Video" from the left of the dialog that appears, and match the basic resolution and camera resolution. Please refer to the original article for a detailed explanation with a screen snapshot.

  1. Enable virtual camera

Enables the virtual camera, that is, allows you to select the virtual camera as the camera from Zoom. If the above commands and settings are successful, * v4l2sink * should appear in the "Tools" menu of OBS Studio, so click it.

obsmenu.png

The following dialog will appear.

v4l2sink_dlg.png

Press "Start" to activate the virtual camera. If you check "Auto Start", the virtual camera will be automatically enabled when OBS Studio starts, even if you do not set it each time.

This time, select the virtual camera as the camera on the Zoom side. When the Zoom meeting starts, click the up arrow next to * Start Video * at the bottom left of the meeting screen and you should see * OBS Cam * in your camera choices. Select it. The name of the virtual camera will be the one specified by the option * card_label = "OBS Cam" * given when loading v4l2loopback above.

obscam.png

Persistence of virtual camera

The virtual camera can be used in the above, but the module is not automatically loaded when the OS is restarted, so you need to enter a command each time. Therefore, make the module load persistent. I used /etc/modules-load.d, but if you are familiar with Linux itself, there may be a better way to do it.

  1. Create a conf file in /etc/modules-load.d

If you create a conf file in modules-load.d, the specified kernel module will be loaded at startup. In my case, I created a new file called obs.conf and put it in /etc/modules-load.d as follows.

/etc/modules-load.d/obs.conf


v4l2loopback

Create it as a super user by sudo.

  1. Create a conf file in /etc/modprobe.d

In order to pass the options that were attached when loading the kernel module with * modprobe * from the command line at the time of loading at startup, describe the options in /etc/modprobe.d. In my case, I created a new file called obs_opt.conf and put it in /etc/modprobe.d as follows.

/etc/modprobe.d/obs_opt.conf


options v4l2loopback devices=1 video_nr=10 card_label="OBS Cam" exclusive_caps=1

The order in the line is * options *, which means adding options, followed by the name of the module to which this option is attached, and the option to be added after that.

Create it as a super user by sudo.

Create a virtual microphone to play sound effects and music

Since OBS Studio is equipped with an audio mixer, it is possible to broadcast the audio from the microphone overlaid with the music being played on the PC. However, this is effective when broadcasting from OBS Studio on YouTube etc., but the sound of the mixer does not flow to Zoom even if it is projected on Zoom with a virtual camera. It would be nice to have a virtual broadcast plugin, but unfortunately I couldn't find it.

By the way, if you want to cover the sound on the PC while using Share screen, you can do it without a virtual microphone (described later). This section describes the settings required to cover the audio sent as a meeting participant.

Here, a virtual microphone is created and the playback sound on the PC and the sound from the microphone are mixed and played. Regarding the creation of a virtual microphone, I referred to the following post (or rather, that's it).

Original article: Redirecting Pulseaudio sink to a virtual source The last answer in the article is the creation method itself. The * pactl * command is used in the article, but now it seems to have been replaced by * pacmd *.

This is achieved by creating a virtual microphone using PulseAudio, which is the upper layer of the Linux sound management mechanism, and setting the sound being played from the app and the sound from the microphone to flow into it.

  1. Generate Sink to mix microphone audio with playback audio on PC

Generate a Sink with the name mix-for-virtual-mic.

pacmd load-module module-null-sink sink_name=mix-for-virtual-mic sink_properties=device.description=Mix-for-Virtual-Microphone
  1. Generate a Sink that mixes the playback audio and microphone audio on the PC
pacmd load-module module-combine-sink sink_name=virtual-microphone-and-speakers slaves=mix-for-virtual-mic,alsa_output.pci-0000_00_1b.0.analog-stereo
  1. Loopback to Sink to mix mic audio
pacmd load-module module-loopback source=alsa_input.pci-0000_00_1b.0.analog-stereo sink=mix-for-virtual-mic latency_msec=20
  1. Dummy echo cancel Sink generation

Since the output of the echo canceller is not used, prepare a null sink.

pacmd load-module module-null-sink sink_name=silence sink_properties=device.description=silent-sink-for-echo-cancel
  1. Create a virtual microphone

Create a virtual microphone (Virtual-Microphone) using the echo canceller module. Use this from Zoom.

pacmd load-module module-echo-cancel sink_name=virtual-microphone source_name=virtual-microphone source_master=mix-for-virtual-mic.monitor sink_master=silence aec_method=null source_properties=device.description=Virtual-Microphone sink_properties=device.description=Virtual-Microphone
  1. Zoom settings

If there is no error in executing each command so far, the setting is successful. Each Sink you create will be visible to Zoom. On the Zoom side, select the microphone and speaker as follows.

mix.png

Now, for example, if you play music on your PC and speak with a microphone, both the music and your voice will reach the participants in the Zoom meeting.

Persistence of virtual microphone

You can use the virtual microphone above, but as with the virtual camera, it will disappear when you restart the OS, so make it permanent.

All the settings up to this point are executed on PulseAudio, so if you write them in the PulseAudio startup script, Sink will start automatically when the OS starts. The startup script can be one of the following: I made the system settings.

--~ / .pulse / default.pa: Personal settings --/etc/pulse/default.pa: System settings

When you open /etc/pulse/default.pa, various settings are already included, so add the following at the very end

/etc/pulse/default.Addition to pa


load-module module-null-sink sink_name=mix-for-virtual-mic sink_properties=device.description=Mix-for-Virtual-Microphone
load-module module-combine-sink sink_name=virtual-microphone-and-speakers slaves=mix-for-virtual-mic,alsa_output.pci-0000_00_1b.0.analog-stereo
load-module module-loopback source=alsa_input.pci-0000_00_1b.0.analog-stereo sink=mix-for-virtual-mic latency_msec=20
load-module module-null-sink sink_name=silence sink_properties=device.description=silent-sink-for-echo-cancel
load-module module-echo-cancel sink_name=virtual-microphone source_name=virtual-microphone source_master=mix-for-virtual-mic.monitor sink_master=silence aec_method=null source_properties=device.description=Virtual-Microphone sink_properties=device.description=Virtual-Microphone

Play sound effects

You can download a suitable free sound effect and play it on the player, but I have a useful web application, so I am using it. If you have all this, you won't be in trouble. I am very grateful to use it.

Sound Effect Lab Pon App https://soundeffect-lab.info/pon/app.html pon.png

[Supplement] Share the OBS Studio scene with Zoom and share the audio on your PC.

There may be other ways, but the distribution of OBS Studio scenes with a virtual camera does not appear in screen sharing as it is, so I tried the following method.

  1. Display on the screen with the window projector of the scene of OBS Studio

Select the scene you want to share from the OBS Studio scenes, right-click and select the window projector.

winprj.png

The combined result of the scene will then open as a window.

  1. Share the window projector as an app share on Share Screen

If you select Share Screen, a dialog will appear, so share the window projector you just opened.

sharescreen.png

At this time, if you check Share computer sound at the bottom left of the dialog, you can play sound effects, music, etc. on Zoom (although it was a function only for Windows version until the previous version of Zoom). , Now it's also available for Linux).

Recommended Posts

I tried to create an environment where you can have a fun Zoom meeting with Linux (Ubuntu) + Zoom + OBS Studio + sound effects
I tried to build an environment with WSL + Ubuntu + VS Code in a Windows environment
I tried to create an environment of MkDocs on Amazon Linux
I tried to build an environment of Ubuntu 20.04 LTS + ROS2 with Raspberry Pi 4
When I tried to create a virtual environment with Python, it didn't work
Quickly create an environment where you can play with Raspberry Pi 4 (target 1 hour)
I tried to create an environment to check regularly using Selenium with AWS Fargate
I tried to create a table only with Django
I tried to create a reinforcement learning environment for Othello with Open AI gym
You can drink Zoom! !! I tried to make a just one style cooperative theme guessing game with Flask + Heroku
I tried to automatically create a report with Markov chain
I tried to create an article in Wiki.js with SQLAlchemy
I came up with a way to create a 3D model from a photo Part 01 Creating an environment
I tried to create a server environment that runs on Windows 10
Try to create a python environment with Visual Studio Code & WSL
I tried to create a list of prime numbers with python
I made a LINE stamp where you can study Linux commands
I tried to create Bulls and Cows with a shell program
I tried to create a program to convert hexadecimal numbers to decimal numbers with python
I tried to create a plug-in with HULFT IoT Edge Streaming [Development] (2/3)
I tried to create a plug-in with HULFT IoT Edge Streaming [Execution] (3/3)
[Outlook] I tried to automatically create a daily report email with Python
I tried to create a plug-in with HULFT IoT Edge Streaming [Setup] (1/3)
I tried to build a Mac Python development environment with pythonz + direnv
I want to create an Ubuntu chrome User Profile with Colab only
I tried to create a linebot (implementation)
I tried to create a linebot (preparation)
I tried to create a class that can easily serialize Json in Python
Creating an environment for OSS-DB Silver # 1_Create a Linux environment (CentOS7 virtual environment) with VirtualBox/Vagrant
I tried to easily create a fully automatic attendance system with Selenium + Python
[Azure] I tried to create a Linux virtual machine in Azure of Microsoft Learn
I tried to extract a line art from an image with Deep Learning
I tried to create a button for Slack with Raspberry Pi + Tact Switch
I tried to create a model with the sample of Amazon SageMaker Autopilot
I tried to easily create a high-precision 3D image with one photo [1]. (Depth can now be edited in PNG.)
You can easily create a GUI with Python
I tried to detect an object with M2Det!
I tried to operate Linux with Discord Bot
I tried to make a real-time sound source separation mock with Python machine learning
How to create a Python 3.6.0 environment by putting pyenv on Amazon Linux and Ubuntu
[Python] I tried to automatically create a daily report of YWT with Outlook mail
I tried to create a class to search files with Python's Glob method in VBA
I tried scraping food recall information with Python to create a pandas data frame
I tried to build an environment for machine learning with Python (Mac OS X)
I tried to build an environment where work in the Docker container on the remote server can be done directly from the local VS Code with SSH connection