静看光阴荏苒
不管不顾不问不说也不念

Owncast:一个人的直播间

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 example@qq.com

推流地址:

rtmp://owncast.imlala.best/live

OBS推流设置:

流名称就是你在config.yaml内设置的streamingKey密码。

测试一下:

赞(4)
未经允许不得转载:荒岛 » Owncast:一个人的直播间
分享到: 更多 (0)

评论 5

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
  1. #1

    :cry: 泪目

    橘子3周前 (10-08) Google Chrome 81.0.4044.93 Google Chrome 81.0.4044.93 Windows 10 Windows 10回复
  2. #2

    大佬,服务器应该开发哪个端口给OBS推流,实在找不到,我打开了所有端口才能正常推流,但这样不安全,望给予指导,谢谢

    甜脆柿子2周前 (10-14) Google Chrome 88.0.4286.0 Google Chrome 88.0.4286.0 Android 10 Android 10回复
    • 8080和1935。

      LALA2周前 (10-14) Google Chrome 85.0.4183.121 Google Chrome 85.0.4183.121 GNU/Linux x64 GNU/Linux x64回复
  3. #3

    https://************/hls/stream.m3u8?cachebust=1603335465 404 (Not Found)
    大佬这个是怎么回事?推流成功了,查看了owncast.log如下,
    time=”2020-10-22T02:45:48Z” level=info msg=”Owncast v0.0.2-linux (ef3796a033b32a312ebf5b334851cbf9959e7ecb)”
    time=”2020-10-22T02:45:48Z” level=info msg=”Web server running on port: 8080″
    time=”2020-10-22T02:45:48Z” level=info msg=”RTMP server is listening for incoming stream on port: 1935″
    time=”2020-10-22T02:52:05Z” level=info msg=”Owncast v0.0.2-linux (ef3796a033b32a312ebf5b334851cbf9959e7ecb)”
    time=”2020-10-22T02:52:05Z” level=info msg=”Web server running on port: 8080″
    time=”2020-10-22T02:52:05Z” level=info msg=”RTMP server is listening for incoming stream on port: 1935″
    time=”2020-10-22T02:55:49Z” level=info msg=”Incoming RTMP connected.”

    yaya4天前 Google Chrome 86.0.4240.75 Google Chrome 86.0.4240.75 Windows 10 x64 Edition Windows 10 x64 Edition回复
    • 这个log看不出来是什么问题,猜测你的ffmpeg路径可能没配置好?

      LALA4天前 Google Chrome 86.0.4240.75 Google Chrome 86.0.4240.75 GNU/Linux x64 GNU/Linux x64回复

分享创造快乐

广告合作资源投稿