当前位置:网站首页>Jitsi meet video recording with jibri

Jitsi meet video recording with jibri

2022-06-09 05:43:00 Die hard audio and video

Want to learn more WebRTC knowledge , Please pay attention to WebRTC The Chinese community

Preface

When we were making a video conference system , There is usually a conference recording function , As a leader in open source video conferencing ,Jitsi How to do this , In the case of official documents and their obscurity , How can we successfully build a video recording service ? Now I'll take you to practice .

Yangwebrtc

yangwebrtc It is a self-developed support Webrtc/Srt/Rtmp Of rtc framework , Including a variety of video and audio codec and processing .

Support video conference 、 HD recording and broadcasting live 、 Live interaction and other video and audio applications .
It can be used for distance education 、 telemedicine 、 Command and dispatch 、 Security monitoring 、 Film and television recording and broadcasting 、 Cooperative Office 、 Live interactive and other industry applications .
webrtc Support independent research and development , Non Google lib, compatible webrtc agreement , Available with Google Lib And browser

Google webrtc Slow download , The problem of hard compilation ,Yangwebrtc A lightweight , Compilation difficulty is reduced , Prepared by the Chinese themselves , Welcome to the community , Jointly create an audio and video ecology for Chinese people ,

To a star

What is? Jibri

Jibri Provides for recording or streaming Jitsi Meet Conference services .

It does this by starting the Chrome Example and use ffmpeg Capture and encode output work . It is designed to work on a separate computer ( or VM) Up operation , There are no other applications that use display or audio devices . Single jibri Only one recording is supported at a time .

Note here ** Single Jibri Only one recording is supported at a time ** , That is to say a Jibri The service can only record one video conference at a time , If you start recording while recording in another conference room , Then he will return that no recording device is available , Or the device is busy

Jibri Design idea

My understanding may be biased , Because I have just come into contact with 2 God , Welcome to add .
Jibri Added a new Hidden user , This user is invisible to you , Users don't perceive , Into the conference room , It has been used. Chrome Driver To control Chrome example , In the use of ffmpeg Capture and then encode the output as mp4 Format of video files .

How to record

Recording server

The advantage is that customers don't have to worry about recording failure due to their own computer problems ( Such as insufficient disk space ), It won't preempt resources when recording (CPU High occupancy ) And cause problems in other applications ; The disadvantage is that the implementation complexity is very high .

Client recording :

The advantage is that it is convenient for the recording party to operate and control , And the recorded video has high definition , Implementation is relatively simple . Here you can make a comparison with the server recording , Generally, the resolution of the client camera is very high ( Such as 1280x720), So client recording can record very clear video ; But it is very difficult for the server to do this , When the local HD video is uploaded to the server, the network bandwidth is insufficient , The resolution of the video is likely to be automatically reduced to 640x360, This causes the video to be particularly blurry when the user looks back , Poor user experience . However, client-side recording has its drawbacks , One of the main disadvantages is the consumption CPU. and CPU After the occupation is too high , It is very easy to cause the application to get stuck . besides , It has an impact on memory 、 The requirement of hard disk is also very high , But today, with the development of computer hardware , This is no longer a big problem

preparation :

  • For official documents Ubuntu16.04 Installation in progress , I tested it with Ubuntu18.04 Installation , Choose one of the two .
  • It's set up jitsi-meet, And can make normal video calls , If it's not built Jitsi-meet, I can follow the rules Last article To set up

Installation dependency :

apt install linux-image-extra-virtual ffmpeg curl unzip software-properties-common

Because of the installation of linux-image-extra-virtual Kernel packages , To make it work , We need to restart the operating system , Be careful The following command will restart your computer

reboot

After restarting the computer , again ssh Enter the virtual machine

load snd-aloop modular :

Set the modules to load at startup :

echo "snd-aloop" >> /etc/modules

Load the module into the running kernel :

modprobe snd-aloop

Check if the module is loaded :

lsmod | grep snd_aloop

Output the following content to load successfully

[email protected]:~# lsmod | grep snd_aloop
snd_aloop              24576  0
snd_pcm                98304  1 snd_aloop
snd                    81920  3 snd_timer,snd_aloop,snd_pcm

install Google Chrome:

curl -sS -o - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add
echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list
apt-get -y update
apt-get -y install google-chrome-stable

install ChromeDriver, He is used to control Chrome:

CHROME_DRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE`
wget -N http://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip -P ~/
unzip ~/chromedriver_linux64.zip -d ~/
rm ~/chromedriver_linux64.zip
sudo mv -f ~/chromedriver /usr/local/bin/chromedriver
sudo chown root:root /usr/local/bin/chromedriver
sudo chmod 0755 /usr/local/bin/chromedriver

install Jibri:

wget -qO - https://download.jitsi.org/jitsi-key.gpg.key | sudo apt-key add -
sudo sh -c "echo 'deb https://download.jitsi.org stable/' > /etc/apt/sources.list.d/jitsi-stable.list"
sudo apt-get update
sudo apt-get install jibri

In execution sudo apt-get install jibri If prompted to choose , choice keyboard configuration, And choose English English, If there is no prompt, please ignore .

take Jibri The user account of is added to the user group :

usermod -aG adm,audio,video,plugdev jibri

To configure Prosody

Be careful

  • Following jitsi.example.com Replace all with your domain name
  • my jitsi-meet On a server ,Jibri On another server . When I think there is no problem installing on a server .
vim /etc/prosody/conf.d/you config.cfg.lua

If there are the following , Please ignore , If not, please add

---Set up a MUC (multi-user chat) room server on conference.example.com:
Component "conference.jitsi.example.com" "muc"
--- Store MUC messages in an archive and allow users to access it
modules_enabled = { "muc_mam" }

add to internal MUC Components

--- internal muc component, meant to enable pools of jibri and jigasi clients
Component "internal.auth.jitsi.example.com" "muc"
modules_enabled = {
"ping";
}
storage = "internal"
muc_room_cache_size = 1000

add to VirtualHost To save jibri user

VirtualHost "recorder.jitsi.example.com"
modules_enabled = {
"ping";
}
authentication = "internal_plain"

by Jibri Create two new accounts , One is used to control , One for recording :

prosodyctl register jibri auth.jitsi.example.com Jibripssword
prosodyctl register recorder recorder.jitsi.example.com recorderPssword

To configure Jicofo:

vim /etc/jitsi/jicofo/sip-communicator.properties
[email protected]main.com
org.jitsi.jicofo.jibri.PENDING_TIMEOUT=90

To configure Jitsi Meet:

To configure Jitsi Meet Let the record button display in the interface

vim /etc/jitsi/meet/jitsi.example.com-config.js
 Find the following configuration uncomment 
fileRecordingsEnabled: true, //  Enable file recording 
liveStreamingEnabled: true, //  Enable live streaming recording , This option can be directly pushed to the oil pipe for live broadcast 
hiddenDomain: 'recorder.yourdomain.com', // Hidden fields 

You can also save recorded files directly to cloud storage , But for now, I support dropbox

 // dropbox: {
    //     appKey: 'you app key', // Specify your app key here.
    //     // A URL to redirect the user to, after authenticating
    //     // by default uses:
    //     redirectURI: 'https://jitsi.example.com/static/oauth.html'
    //` },

Creating dropbox When applied OAuth 2 Of Redirect URIs direct writing

'https://jitsi.example.com/static/oauth.htm

This configuration will take effect

Create a directory to store recordings and set their permissions :

mkdir srv/recordings
chown jibri:jibri srv/recordings

To configure Jibri:

vim /etc/jitsi/jibri/config.json
"recording_directory": "srv/recordings", / / Recording files  
"finalize_recording_script_path": "", // Started after recording shell Script , The official here wrote a list of paths , But I didn't find him , So it was cancelled directly 

// Just configure the above Prosody Configuration of 
"xmpp_server_hosts": [
"jitsi.example.com"
],
"xmpp_domain": "jitsi.example.com",
"control_login": {
"domain": "auth.jitsi.example.com",
"username": "jibri",
"password": "[email protected]"
},
//  Be careful , If you want to configure multiple Jibri, Record multiple rooms at the same time , The user names here cannot be the same 
"control_muc": {
"domain": "internal.auth.jitsi.example.com",
"room_name": "JibriBrewery",
"nickname": "jibri"
},
"call_login": {
"domain": "recorder.jitsi.example.com",
"username": "recorder",
"password": "[email protected]"
},

Restart the service

systemctl restart prosody
systemctl restart jicofo
systemctl restart jitsi-videobridge2
systemctl restart jibri

Start recording

Open your domain name and enter the room , Click on the bottom right corner

 Insert picture description here
When you hear the voice and start recording, it means success , Let's take a look at the folder we created to save the videos

cd srv/recordings
 Will automatically create a folder of letters 
 When we enter the folder, we can see mp4 The folder , If you don't cancel recording this video, the size will change all the time 
ll 22_2020-07-16-23-15-21.mp4
 The format of the video file name is   Room name _ current time 

Stop recording

When the person who starts recording clicks the stop recording button, the recording will stop
When everyone leaves the room, the recording will stop .

optional

If the virtual machine does not Java8 The environment needs to be installed Java8

wget -O - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | sudo apt-key add -
add-apt-repository https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/
apt update
apt install adoptopenjdk-8-hotspot

If there are multiple virtual machines Java The environment needs to be specified Java8 function Jirbri
take Java Replace the word with Java8 Full path to

vim /opt/jitsi/jibri/launch.sh

Replace with the following

exec /usr/lib/jvm/adoptopenjdk-8-hotspot-amd64/bin/java -Djava.util.logging.config.file=/etc/jitsi/jibri/logging.properties -jar /opt/jitsi/jibri/jibri.jar --config "/etc/jitsi/jibri/config.json"

Restart after replacement

systemctl restart jibri

Cancel video recording warning

When we copy the recorded video to the local player for playback , We'll see a warning above the video
Pictured :
 Insert picture description here

This is a chrome Warning from , The solution to the warning is as follows :

mkdir -p /etc/opt/chrome/policies/managed
echo '{ "CommandLineFlagSecurityWarningsEnabled": false }' >>/etc/opt/chrome/policies/managed/managed_policies.json

restart jibri

systemctl restart jibri

Record again and there will be no .

Record video for every room

Obviously, only one video can be recorded in one room at the same time , Can not meet our business needs , however Jibri Recording through virtual machine again , Only one virtual machine can be installed jibri, That means , We recorded hundreds of meetings at the same time , Then there are hundreds of servers working at the same time , The cost of servers will be a huge number .

Official communities and forums do not provide complete solutions , Just say you can create one Jibri pool , Similar to the concept of connection pool , I think maybe containerization docker It's a good choice .

Or use the client to record .

  • One server installs multiple jibri Multiple video recordings at the same time

follow-up

If you encounter problems during installation, you can check the log , Solve according to the error

tail -f /var/log/jitsi/jibri

If you set up more than one server Jibri Have different ideas , You are also welcome to join the discussion .
 Please add a picture description

WebRTC The Chinese community

原网站

版权声明
本文为[Die hard audio and video]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/03/202203021427408984.html