原文地址:https://lala.im/7440.html,請支持原作者!該處僅作轉載。
owncast是一个单用户的直播工具,带有聊天功能。
程序转码需要用到ffmpeg,建议在一台性能稍好的VPS上安装,安装基本工具:
apt -y update
apt -y install ffmpeg unzip nginx python-certbot-nginx supervisor
systemctl start supervisor nginx
systemctl enable supervisor nginx
下载解压二进制文件:
mkdir -p /opt/owncast && cd /opt/owncast
wget https://github.com/owncast/owncast/releases/download/v0.0.2/owncast-linux-0.0.2.zip
unzip owncast-linux-0.0.2.zip
新建配置文件:
nano config.yaml
写入如下配置:
ffmpegPath: /usr/bin/ffmpeg
webServerPort: 8080
instanceDetails:
name: imlala
title: MapleStory Solo Lotus
summary: "Welcome"
extraUserInfoFileName: "/static/content.md"
logo:
small: /img/logo128.png
large: /img/logo256.png
tags:
- game
- music
- tech
socialHandles:
- platform: github
url: http://github.com/owncast/owncast
- platform: mastodon
url: http://mastodon.something/owncast
videoSettings:
chunkLengthInSeconds: 5
streamingKey: password
offlineContent: static/offline.m4v
streamQualities:
- low:
videoBitrate: 400
scaledWidth: 600
audioPassthrough: true
encoderPreset: veryfast
- medium:
videoBitrate: 800
encoderPreset: fast
- high:
videoBitrate: 2000
encoderPreset: faster
如果你只想开箱即用的话,修改streamingKey后面的值即可,这是你的直播密码。
其他的配置可参考如下地址的说明:
https://owncast.online/docs/configuration/
接下来新建一个supervisor配置文件用于守护owncast的进程:
nano /etc/supervisor/conf.d/owncast.conf
写入如下配置:
[program:owncast]
priority=1
directory=/opt/owncast
command=/opt/owncast/owncast
autostart=true
autorestart=true
redirect_stderr=true
stdout_logfile=/var/log/supervisor/owncast.log
更新supervisor配置即可启动owncast:
supervisorctl update
接下来新建nginx站点配置文件用于反向代理:
nano /etc/nginx/conf.d/owncast.conf
写入如下配置:
server {
listen 80;
server_name owncast.imlala.best;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
}
}
使用certbot签一个ssl证书:
certbot --nginx --agree-tos --no-eff-email --email [email protected]
推流地址:
rtmp://owncast.imlala.best/live
OBS推流设置:
流名称就是你在config.yaml内设置的streamingKey密码。
测试一下: