跳到主要內容

利用 Jitsi 建立個人化的視訊會議平台

 

近期因為疫情的關係,越來越多企業開始實施分流或在家工作,視訊會議的需求也日益增加。
在商用解決方案選擇上,有不少企業會選擇知名品牌的產品,例如 Cisco WebexGoogle MeetMicrosoft TeamsZoom 都是很不錯的方案。

KKBOX 集團在去年便試行及做好充分 work from home 的準備,今年五月也因應疫情升溫,全員 work from home 至今兩個月有餘。
當然,取之 Open Source,也要對社群有些貢獻。在這一屆 COSCUP,我們要來介紹 Open Source 圈中也很知名,效果也很不錯的一套視訊會議平台:Jitsi
除了基本的視訊會議功能外,在最後我們也會示範如何透過 Jitsi 畫面輸出到 YouTube/Twitch 或其他支援 RTMP 的平台進行直播。

由於篇幅有限,且 Jitsi 可以調整的細節非常多。今天我們純粹很快速的示範,如何簡單的建置出一個 Jitsi 環境,並提供單場會議內容錄影或直播。
Jitsi 的文件可以在這裡找到。

今天透過 AWS Lightsail 的 $10/month instance(1 core CPU + 2GB RAM + 60GB SSD),作業系統則是 Ubuntu 20.04 來示範。當然,使用其他 VPS 亦可,大同小異,這邊直接跳過 VPS 相關的建置過程。
*firewall 相關資料參考這裡這裡

針對系統做必要的更新

基本的 apt repository 更新:

$ sudo apt update

因為後面要示範的會議錄影及直播需要使用 ALSA loopback device,如果是 EC2 or Lightsail 則需要額外安裝 generic kernel():

$ sudo apt install linux-image-generic linux-headers-generic linux-image-extra-virtual

接著做系統套件們的更新:

$ sudo apt dist-upgrade
$ sudo apt autoremove

如果是 AWS EC2 or Lightsail 則需要另外再將預設的 AWS optimized kernel 移除():

$ sudo apt remove linux-image-aws linux-aws-* linux-image-*-aws

最後將 snd-aloop module 設為開機自動載入,重開機:

$ sudo sh -c "echo 'snd-aloop' >> /etc/modules"
$ sudo reboot

:可以參考這裡*

接著將 Jitsi 官方的 apt repository 與 gpg key 加進來,並安裝 jitsi-meet:

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

過程中會提示輸入 server hostname,在這裡我們輸入 coscup.kk.stream(請自行替換這個 hostname 為你自己的 hostname)。

在安裝過程時先選擇自己簽發憑證(self-signed)

後面再透過 Let’s Encrypt 簽發真正可用的憑證或自行替換購買的憑證:

$ sudo /usr/share/jitsi-meet/scripts/install-letsencrypt-cert.sh

接下來參考這裡相關的說明,開始調整 Jitsi 設定。

調整 Prosody 的設定:

$ sudo vim /etc/prosody/conf.d/coscup.kk.stream.cfg.lua

找到 VirtualHost "coscup.kk.stream" 這一段,將裡面的 authentication = "anonymous" 改成 authentication = "internal_hashed"(關閉匿名使用模式,使用簡單帳號管理機制)

接著在 VirtualHost "coscup.kk.stream" 這一段的後面加上:

VirtualHost "guest.coscup.kk.stream"
    authentication = "anonymous"
    c2s_require_encryption = false

調整 jitsi-meet 的設定:

$ sudo vim /etc/jitsi/meet/coscup.kk.stream-config.js

找到 hosts 的區段,加上 anonymous domain 設定 anonymousdomain: 'guest.coscup.kk.stream',

調整 jicofo 設定:

$ sudo sh -c "echo 'org.jitsi.jicofo.auth.URL=XMPP:coscup.kk.stream' >> /etc/jitsi/jicofo/sip-communicator.properties"

建立一個接下來會用到的 Jitsi 管理者帳號:

$ sudo prosodyctl register <帳號名稱> coscup.kk.stream <密碼>
# 例如 sudo prosodyctl register coscup coscup.kk.stream ilovecoscup

錄影需求,接下來安裝 Jibri 與 FFmpeg 與 Google Chrome 與 Chromedriver

$ sudo apt install jibri ffmpeg
$ wget -qO - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
$ sudo sh -c "echo 'deb http://dl.google.com/linux/chrome/deb/ stable main' > /etc/apt/sources.list.d/google-chrome.list"
$ sudo apt update
$ sudo apt install google-chrome-stable
$ sudo mkdir -p /etc/opt/chrome/policies/managed
$ sudo sh -c "echo '{ "CommandLineFlagSecurityWarningsEnabled": false }' >>/etc/opt/chrome/policies/managed/managed_policies.json"
$ 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
$ sudo apt install default-jre-headless curl alsa-utils icewm xdotool xserver-xorg-input-void xserver-xorg-video-dummy

加上 Prosody 錄影相關的 vhost:

$ sudo vim /etc/prosody/conf.d/coscup.kk.stream.cfg.lua

加上這一段

VirtualHost "recorder.coscup.kk.stream"
    modules_enabled = {
        "ping";
    }
    authentication = "internal_plain"

建立兩個帳號給 jibri(密碼自行替換):

$ sudo prosodyctl register jibri auth.coscup.kk.stream jibriauthpass
$ sudo prosodyctl register recorder recorder.coscup.kk.stream jibrirecorderpass

調整 jicofo 的 jibri BREWERY 及 PENDING_TIMEOUT 及 SHORT_ID 參數:

$ sudo sh -c "echo 'org.jitsi.jicofo.jibri.BREWERY=JibriBrewery@internal.auth.coscup.kk.stream' >> /etc/jitsi/jicofo/sip-communicator.properties"
$ sudo sh -c "echo 'org.jitsi.jicofo.jibri.PENDING_TIMEOUT=90' >> /etc/jitsi/jicofo/sip-communicator.properties"
$ sudo sh -c "echo 'org.jitsi.jicofo.SHORT_ID=1' >> /etc/jitsi/jicofo/sip-communicator.properties"

最後開啟 Jitsi 的錄影及 live 功能:

$ sudo vim /etc/jitsi/meet/coscup.kk.stream-config.js

在 testing 區段找到相關地方調整成

        fileRecordingsEnabled: true, 
        liveStreamingEnabled: true, 
        hiddenDomain: 'recorder.coscup.kk.stream',

加上 jibri 設定:

$ sudo vim /etc/jitsi/jibri/jibri.conf

置換成這樣(其中 jibri 及 recorder 這兩個帳號的密碼要跟早先建立的相同)

jibri {
  id = "coscup.kk.stream-1"
  single-use-mode = false
  api {
    http {
      external-api-port = 2222
      internal-api-port = 3333
    }
    xmpp {
      environments = [{
        name = "COSCUP Jitsi Demo"
        xmpp-server-hosts = ["coscup.kk.stream"]
        xmpp-domain = "coscup.kk.stream"
        control-login = {
          domain = "auth.coscup.kk.stream"
          username = "jibri"
          password = "jibriauthpass"
        }
        control-muc = {
          domain = "internal.auth.coscup.kk.stream"
          room-name = "JibriBrewery"
          nickname = "jibri-nickname"
        }
        call-login = {
          domain = "recorder.coscup.kk.stream"
          username = "recorder"
          password = "jibrirecorderpass"
        }
        strip-from-room-domain = "conference."
        usage-timeout = 3 hour
        trust-all-xmpp-certs = true
      }]
    }
  }
  recording {
    recordings-directory = "/srv/recordings"
    finalize-script = ""
  }
  streaming {
    rtmp-allow-list = [
      ".*"
    ]
  }
  ffmpeg {
    resolution = "1920x1080"
    audio-source = "alsa"
    audio-device = "plug:bsnoop"
  }
  chrome {
    flags = [
      "--use-fake-ui-for-media-stream",
      "--start-maximized",
      "--kiosk",
      "--enabled",
      "--disable-infobars",
      "--autoplay-policy=no-user-gesture-required"
    ]
  }
  stats {
    enable-stats-d = true
  }
  webhook {
    subscribers = []
  }
  call-status-checks {
    no-media-timeout = 30 seconds
    all-muted-timeout = 10 minutes
    default-call-empty-timeout = 30 seconds
  }
}

建立錄影用的目錄:

$ sudo mkdir /srv/recordings
$ sudo chown jibri:jibri /srv/recordings

將 jibri 加入存取 video/audio 相關 device 的系統群組:

$ sudo usermod -aG adm,audio,video,plugdev jibri

讓 jibri 開機就跑起來:

$ sudo systemctl enable jibri

重開機,大功告成

$ sudo reboot

接著就能直接以瀏覽器打開 Jitsi,並且可以建立新的會議室:

如果主持人尚未加入,請等待主持人。

如果你就是主持人,則輸入稍早建立的管理者帳號密碼:

接著就可以邀請大家加入會議啦:

也可以建立這場會議的錄影或將其透過 RTMP 往其他直播平台輸出:

留言

這個網誌中的熱門文章

Lead the Trend — COSCUP 2026 Early Bird CfP

COSCUP 2026 Early Bird CfP Lead the Trend — COSCUP 2026 Early Bird CfP Embracing the open-source spirit of release early, the Early Bird program allows the community to discover your ideas sooner and helps COSCUP build a stronger, more coherent program. As the conference continues to grow each year while volunteer capacity becomes leaner, Early Bird submissions this year will be reviewed and announced together with the regular CfP. If you already have something you’re eager to share, make the most of the timeline by preparing and submitting early. We look forward to seeing your discoveries and adventures in open-source spark conversations at COSCUP 2026. Event Information Dates: August 8–9, 2026 Venue: National Taiwan University of Science and Technology (No. 43, Sec. 4, Keelung Rd., Da-an Dist., Taipei) Topics & Format Proposals should relate to open culture or open source technology. ...

COSCUP 2026 Call for Participation, 議程軌與攤位即日起開放申請

Jump to English   COSCUP 2026的社群議程/攤位即日起開始接受申請,社群議程於3月23日截止申請,社群攤位於6月9號截止。請有興趣在今年與我們共襄盛舉的社群把握機會! 👉  申請加入 以下介紹如何在 COSCUP 籌辦議程軌或攤位的流程及注意事項。 社群議程 大會提供開源專案或社群場地與行政協助,您可以在活動期間舉辦關於任何開源議題的討論、座談、工作坊等。 重要日期 2026-02-23 社群招募表單 Open 2026-03-11 合作社群招募說明會 2026-03-23 社群議程截止申請 2026-03-26 公佈 COSCUP 2026 議程合作社群名單 2026-03-28 聯合徵稿開始 2026-05-09 聯合徵稿截止 2026-06-09 公告並通知錄取及未錄取稿件 2026-06-23 議程表安排 due day 2026-08-08~2026-08-09 COSCUP 2026 參與方式與注意事項 為使合作順利,請詳閱社群合作準則,申請加入即視為貴社群同意相關合作準則。 議程可利用時段 主辦社群可利用之時段預設為一日,約 3-6 小時左右。歷年來 COSCUP 演講教室及時段皆供不應求,因此我們不希望資源浪費。申請此案代表您承諾將充分利用所配發的議程空間。排設議程時,每段議程時間長短、是否有休息時間等,由主辦社群自由決定。主辦社群需在約定時限前完成議程表安排。 如果您沒有信心稿件能填滿全天議程,請與其他社群共同申請,或在申請書上註明希望 COSCUP 協助配對,我們會盡力而為但無法保證。 議程管理系統及共同徵稿流程 大會會建置議程管理系統 (Pretalx),所有議程內容需匯入以出現在大會議程表。 預設會安排各社群共同徵稿,若貴社群有其他安排請務必在申請加入時額外提出。 您需要在申請加入時提供徵稿時所希望收集的資訊(例如希望有哪類稿件、有沒有特殊欄位等等),大會將統整後一併發佈徵稿消息及表單。 現場紀錄 大會需要貴社群安排人力共同參與現場紀錄。現場工作人員務必協助確保講廳內的錄影器材持續運作、正確錄製影片。會後會預留人力依據指南協助剪輯影片。 影片將以 CC BY 4.0 授權釋出。如果特定講者要求不可錄影或直播,請謹慎考慮是否收納,並與大會溝通後方可收入議程。 大會僅能運用有限資源及人...

COSCUP 2018 CfP is open! Submit your proposal before May 25th, 2018.

Finally, the CfP of COSCUP 2018 is here ! (中文見下方) We have pleasure to work with GNOME.Asia Summit to have a joint conference this year, plus 16 Community Room tracks and special tracks hosted by the staff, makes COSCUP 2018 a 15-parallel-tracks conference -- wow! Thanks to all the community members to make it happen. We are looking for talks in several open-source related areas, please submit your proposal before May 25th, 2018 . After the review process from the coordinators, we will publish the full programme in early July. All the talks will possibly be recorded and the video clips will be released under CC:BY-SA 4.0 . If you have something in your talk that cannot be recorded or released under CC, please do leave a note in your proposal. Important dates: Submission deadline: May 25th, 2018 Full programme published: Early July COSCUP 2018: Aug 11-12 (with welcome party at 10th night), at National Taiwan University of Science and Technology Submit your proposal here! 今年 ...