简介

OpenStreamingPlatform是一个开源的视频直播平台,可以用来搭建自己的直播网站。

Open Streaming Platform (OSP) is an open-source, RTMP streamer software front-end for Arut's NGINX RTMP Module. OSP was designed a self-hosted alternative to services like Twitch.tv, Ustream.tv, and Youtube Live.

官方文档:
https://gitlab.com/Deamos/flask-nginx-rtmp-manager

安装

  • 安装 docker :

    apt -y update
    apt -y install curl
    curl -sSL https://get.docker.com/ | sh
    systemctl start docker
    systemctl enable docker
  • 安装 docker-compose :

    curl -L https://github.com/docker/compose/releases/download/1.25.4/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
    chmod +x /usr/local/bin/docker-compose
  • 创建两个目录:

    mkdir -p /opt/traefik
    mkdir -p /opt/stream
  • 创建 acme.json

    touch /opt/traefik/acme.json && chmod 600 /opt/traefik/acme.json
  • 新建 traefik的traefik.toml

    nano /opt/traefik/traefik.toml
  • traefik的traefik.toml 写入如下配置:
defaultEntryPoints = ["https","http"]

[entryPoints]
  [entryPoints.http]
  address = ":80"
    [entryPoints.http.redirect]
    entryPoint = "https"
  [entryPoints.https]
  address = ":443"
  [entryPoints.https.tls]

[acme]
email = "example@qq.com"
storage = "acme.json"
entryPoint = "https"
onHostRule = true
[acme.httpChallenge]
entryPoint = "http"

注:替换邮箱example@qq.com为你自己的。

  • 新建 traefik 的 docker-compose :

    nano /opt/traefik/docker-compose.yml
  • 写入如下配置:

    version: '3.5'
    
    services:
      reverse-proxy:
        container_name: traefik
        image: traefik:v1.7
        command: --api --docker
        ports:
          - "80:80"
          - "443:443"
          - "8080:8080"
        networks:
          - traefik
        volumes:
          - /var/run/docker.sock:/var/run/docker.sock
          - /opt/traefik/traefik.toml:/traefik.toml
          - /opt/traefik/acme.json:/acme.json
    
    networks:
      traefik:
        name: ensucc
  • 新建 openstreamingplatform 的 docker-compose :

    nano /opt/stream/docker-compose.yml
  • 写入如下配置:

    version: '3.5'
    
    services: 
      openstram:
          container_name: openstream
          image: deamos/openstreamingplatform:latest
          ports:
              - 1935:1935
          environment: 
              - REDIS_HOST=redis-osp
              - FLASK_SECRET=""
              - FLASK_SALT=""
              - OSP_REQUIREVERIFICATION=False
              - OSP_ALLOWREGISTRATION=False
          labels: 
              - "traefik.frontend.rule=Host:stream.ensu.cc"
          volumes: 
              - ./data:/var/www
              - ./db:/opt/osp/db 
      redis-osp:
          container_name: redis
          image: redis
    
    networks:
      default:
          external:
              name: ensucc

注:

  1. FLASK_SECRET/FLASK_SALT 填写一点任意字符。
  2. OSP_REQUIREVERIFICATION 是关闭注册,如果需要注册功能去掉这行env。
  3. OSP_ALLOWREGISTRATION 是关闭注册用户邮箱验证,如果打开的话需要配置SMTP服务,为方便建议关掉。
  4. stream.ensu.cc 的域名替换为你自己的。
  • 进入这两个项目目录 up :

    docker-compose up -d

直播

  1. 创建频道和直播key
  2. 登录后右上角点你的账户头像-My Channels-Create Channel
  3. 点击下拉菜单-齿轮按钮,往下翻会有一个Stream Key。
  4. OBS流设置如下图,rtsp/rtmp都可以:

测试




转载自:荒岛博客 ,对之前此文未能及时标注出处,深表歉意,无意侵权。在此向作者"lala.im"致歉,并将引以为戒。

Last modification:March 11, 2020
如果觉得我的文章对你有用,欢迎打赏!