前面探讨了如何安装Jitsi meet,我当时以为安装好了就可以录制的,因为我看到了有开始录制的菜单,于是我就用力的点了这个菜单。。。
结果是左下角橙色预警,录制不能开启,我当时就F12,一路跟到github 原来是要安装Jibri, 我心想凭我的机智不就是分分钟吗,没想到人外有人,坑外有坑,让我原本就不富余的发量雪上加光
开始:
按照之前的约定
1 一个虚拟Ubuntu 20.04.2.0 LTS 桌面版的 我设置的IP是192.168.1.127,安装Jitsi meet (前文已经安装好)
2 一个虚拟Ubuntu 16.04 LTS 服务器版的 我设置的IP是192.168.1.94, 安装Jibri(注意是server版的 不是desktop版的,还有就是由于网络问题可能apt源不好用,要去改成国内的,好像在安装时会让你填写,我也忘记了,安装好再改也可以就是有点烦)
事实证明酒喝多了真的伤脑子
我们到1.94上命令行
如果是虚拟机要安装linux-image-extra-virtual这个包,我是进入系统直接sudo su的,安装时会出错什么的,参考这个吧,说的很详细((1条消息) Ubuntu 16.04 Unable to locate package linux-image-extra-4.15.0-29-generic_路西法Lucifer-CSDN博客)
以root用户身份执行以下命令
设置要在引导时加载的模块:echo "snd-aloop" >> /etc/modules
将模块加载到正在运行的内核:modprobe snd-aloop
检查模块是否已加载:lsmod | grep snd_aloop
如果输出显示snd aloop模块已加载,就OK了。
如下图:
如果你安装的是ubuntu 14.04,代表你标新立异,与众不同,所以你要执行下面的命令:
sudo add-apt-repository ppa:mc3man/trusty-media
sudo apt-get update
sudo apt-get install ffmpeg
接下来安装Google Chrome stable & Chromedriver
由于官方的安装方式需要科学上网,所以我找了这个链接,如果不行的话,可以自行搜索,不是啥大事 (1条消息) ubuntu16.04中安装google chrome_小妖666个人笔记-CSDN博客
安装完Chrome后,添加chrome管理的策略文件,并将CommandLineFlagSecurityWarningsEnabled设置为false。要不然录像中会有一个Chrome警告,这样设置:
mkdir -p /etc/opt/chrome/policies/managed
echo '{ "CommandLineFlagSecurityWarningsEnabled": false }' >>/etc/opt/chrome/policies/managed/managed_policies.json
然后安装Chromedriver, 就是下载下来zip 解压之,复制到/usr/local/bin/chromedriver这个路径,然后赋予相应权限,不一定要用下面命令,自己用其他方法也可以
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
接下来安装一系列依赖,前面安装可能会提示curl不存在,wget不存在什么的,但是提示里会给你安装命令,这不是把用户当傻子吗,不过我喜欢
apt-get install default-jre-headless ffmpeg curl alsa-utils icewm xdotool xserver-xorg-input-void xserver-xorg-video-dummy
万事俱备,只欠挖坑,开始吧,离成功又近了一点
curl https://download.jitsi.org/jitsi-key.gpg.key | sudo sh -c 'gpg --dearmor > /usr/share/keyrings/jitsi-keyring.gpg'
echo 'deb [signed-by=/usr/share/keyrings/jitsi-keyring.gpg] https://download.jitsi.org stable/' | sudo tee /etc/apt/sources.list.d/jitsi-stable.list > /dev/null
sudo apt-get update
sudo apt-get install jibri
屏幕上又chua,chua,chua了 这种感觉很爽,不亚于在火车上吃泡面和鸡爪的感觉
安装完后,会创建一个jibri用户,要把这个用户放在下面几个组里,才可以用系统的音频、视频等等
sudo usermod -aG adm,audio,video,plugdev jibri
好了 jibri安装好了,一切归于平静,But.....要和jitsi发生关系,是需要配的,双方都需要,大概意思是jitsi说我要你录制我,jibri说你哪位啊? 要不咱俩加个微信?
先从jibri开始吧,配置文件在/etc/jitsi/jibri/目录下,以前版本叫config.json 现在版本是jibri.conf, 这点是要注意的 并且格式不一样了,可以到github去了解下,我贴出我的配置
jibri {
// A unique identifier for this Jibri
// TODO: eventually this will be required with no default
id = ""
// Whether or not Jibri should return to idle state after handling
// (successfully or unsuccessfully) a request. A value of 'true'
// here means that a Jibri will NOT return back to the IDLE state
// and will need to be restarted in order to be used again.
single-use-mode = false
api {
http {
external-api-port = 2222
internal-api-port = 3333
}
xmpp {
// See example_xmpp_envs.conf for an example of what is expected here
environments = [
{
name = "prod environment"
xmpp-server-hosts = ["192.168.1.127"]
xmpp-domain = "192.168.1.127"
control-muc {
domain = "internal.auth.192.168.1.127"
room-name = "JibriBrewery"
nickname = "jibri"
}
control-login {
domain = "auth.192.168.1.127"
username = "jibri"
password = "jibriauthpass"
}
call-login {
domain = "recorder.192.168.1.127"
username = "recorder"
password = "jibrirecorderpass"
}
strip-from-room-domain = "conference."
usage-timeout = 0
trust-all-xmpp-certs = true
}
]
}
}
recording {
recordings-directory = "/srv/recordfile"
# TODO: make this an optional param and remove the default
# finalize-script = "/path/to/finalize"
}
streaming {
// A list of regex patterns for allowed RTMP URLs. The RTMP URL used
// when starting a stream must match at least one of the patterns in
// this list.
rtmp-allow-list = [
// By default, all services are allowed
".*"
]
}
ffmpeg {
resolution = "1920x1080"
// The audio source that will be used to capture audio on Linux
audio-source = "alsa"
// The audio device that will be used to capture audio on Linux
audio-device = "plug:bsnoop"
}
chrome {
// The flags which will be passed to chromium when launching
flags = [
"--use-fake-ui-for-media-stream",
"--start-maximized",
"--kiosk",
"--enabled",
"--disable-infobars",
"--autoplay-policy=no-user-gesture-required",
// "--headless",
"--no-sandbox",
//"--disable-dev-shm-usage",
"--ignore-certificate-errors"
]
}
stats {
enable-stats-d = true
}
webhook {
// A list of subscribers interested in receiving webhook events
subscribers = []
}
jwt-info {
// The path to a .pem file which will be used to sign JWT tokens used in webhook
// requests. If not set, no JWT will be added to webhook requests.
# signing-key-path = "/path/to/key.pem"
// The kid to use as part of the JWT
# kid = "key-id"
// The issuer of the JWT
# issuer = "issuer"
// The audience of the JWT
# audience = "audience"
// The TTL of each generated JWT. Can't be less than 10 minutes.
# ttl = 1 hour
}
call-status-checks {
// If all clients have their audio and video muted and if Jibri does not
// detect any data stream (audio or video) comming in, it will stop
// recording after NO_MEDIA_TIMEOUT expires.
no-media-timeout = 30 seconds
// If all clients have their audio and video muted, Jibri consideres this
// as an empty call and stops the recording after ALL_MUTED_TIMEOUT expires.
all-muted-timeout = 10 minutes
// When detecting if a call is empty, Jibri takes into consideration for how
// long the call has been empty already. If it has been empty for more than
// DEFAULT_CALL_EMPTY_TIMEOUT, it will consider it empty and stop the recording.
default-call-empty-timeout = 30 seconds
}
}
里面的配置项自己研究,其中有个/srv/recordfile是录制文件目录,需要权限的
mkdir /srv/recordfile
chown jibri:jibri /srv/recordfile
ok 1.94的jibri配置就可以了,我们转向1.127
vim /etc/prosody/prosody.cfg.lua
将文件内容下面部分注释去掉并改成如下这样
---Set up a MUC (multi-user chat) room server on conference.example.com:
Component "conference.192.168.1.127" "muc"
--- Store MUC messages in an archive and allow users to access it
modules_enabled = { "muc_mam" }
vim /etc/prosody/conf.d/192.168.1.127.cfg.lua
上面这个192.168.1.127是在安装jitsi时录入的域名,还记得吗?
在这个文件里加入下面配置,注意格式
Component "internal.auth.192.168.1.127" "muc"
modules_enabled = {
"ping";
}
storage = "memory"
muc_room_cache_size = 1000
VirtualHost "recorder.192.168.1.127"
modules_enabled = {
"ping";
}
authentication = "internal_plain"
然后设置两个号,供jibri用, 就是jibri.conf里配置的那两个
prosodyctl register jibri auth.192.168.1.127 jibriauthpass
prosodyctl register recorder recorder.192.168.1.127 jibrirecorderpass
向Jicofo注册一个静默用户
vim /etc/jitsi/jicofo/sip-communicator.properties
增加如下配置:
org.jitsi.jicofo.jibri.BREWERY=JibriBrewery@internal.auth.192.168.1.127
org.jitsi.jicofo.jibri.PENDING_TIMEOUT=90
接下来编辑,jitsi meet的配置文件,这个配置文件会被前台会议启动时拉取
vim /etc/jitsi/meet/192.168.1.127-config.js
找到如下配置解除注释并设置为true,hiddendomain如果没有就直接添加在liveStreamingEnabled: true下面一行
fileRecordingsEnabled: true, // If you want to enable file recording
liveStreamingEnabled: true, // If you want to enable live streaming
hiddenDomain: 'recorder.192.168.1.94',//jibri ip
还有一步说是要安装jdk1.8然后让jibri在java 1.8下启动,但试无妨(注意是在1.94上)
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
上面不是唯一的方式安装jdk8 , 重要的是下面的配置
vim /opt/jitsi/jibri/launch.sh
将里面的exec 后面的java 替换成 /usr/lib/jvm/adoptopenjdk-8-hotspot-amd64/bin/java
替换后大概如下 exec /usr/lib/jvm/adoptopenjdk-8-hotspot-amd64/bin/java -Djava.util.....................
注意空格
一切就绪,只欠重启,其实可以先来个免费的reboot,然后在1.127上
在1.127上
systemctl restart prosody
systemctl restart jicofo
systemctl restart jitsi-videobridge2
在1.94上
systemctl restart jibri
好了,可以进入会议了,前面文章说过加入会议的方法,
之后会语音提示开始录制,录制一会还是在这个菜单来点结束录制,录制文件会生成在jibri.conf配置的192.168.1.94的 /svr/recordfile下面
由于本人长的太丑,摄像头识别不出我,所以我就不放录像了,后面一篇会写一下PC端的jitsi meet的编译,先上张图吧
水平有限,可能在理解上有所偏差,难免有所纰漏,如果有什么不对的地方还请多多指教