部署alfg/nginx-rtmp

这里使用Docker Compose

version: '3.9'
services:
  alfg:
    image: alfg/nginx-rtmp:latest
    restart: always
    container_name: alfg-container
    ports:
    - 1935:1935
    - 1936:80
    environment:
      - HTTP_PORT=80
      - HTTPS_PORT=443
      - RTMP_PORT=1935

部署后在OBS上配置

  • 服务:自定义

  • 服务器:rtmp://服务器地址:1935/stream

  • #外网我是利用ddns-go及反向代理使用域名得到网址rtmp://域名:端口/stream

  • 推流码:hello

观看直播

  • 在浏览器中加载示例 hls.js 播放器:

http://服务器地址:1936/player.html?url=http://localhost:1936/live/hello.m3u8
  • 或者在 Safari、VLC 或任何 HLS 播放器中,打开:

http://服务器地址:1936/live/$STREAM_NAME.m3u8
  • 示例播放列表:http://localhost:1936/live/hello.m3u8

  • 也可以利用反向代理使用域名得到播放地址http://域名:端口/live/hello.m3u8

也可以利用SyncTV建立自己的互动直播间邀请好友观看互动