@byxiaoxie3年前

11/3
17:56
Home

owncast 搭建自己的直播间(带聊天功能)

// 准备工作
系统 [Ubuntu 20.04] (其他系统自行测试)
GitHub:https://github.com/owncast/owncast
教程地址:https://owncast.online/docs/quickstart/
需要:FFmpeg版本4.2以上的版本 必须要支持:[x264/var_stream_map] 手动编译安装教程:https://www.byxiaoxie.com/?p=525
//安装 FFmpeg (Ubuntu20.04 ffmpeg版本4.2.4)

apt update

apt install ffmpeg
//下载[owncast] (GitHub上的发布版)

mkdir -p /opt/owncast && cd /opt/owncast  //创建文件夹并进入文件夹

wget https://github.com/owncast/owncast/releases/download/v0.0.2/owncast-0.0.2-linux-64bit.zip  //下载发布版

unzip owncast-0.0.2-linux-64bit.zip  // 解压
//编辑配置文件[config.yaml]

vim config.yaml

修改自己的串流秘钥和信息,我自己的文件内容如下:
# See https://owncast.online/docs/configuration/ for more details

instanceDetails:
  name: Gary   //名称
  title: Live Game Test  //网站标题

  logo:
    small: /img/logo128.png
    large: /img/logo256.png

  tags:
    - music
    - software
    - streaming

  # https://owncast.online/docs/configuration/#external-links
  # for full list of supported social links.  All optional.
  socialHandles:
    - platform: github
      url: http://github.com/owncast/owncast
    - platform: mastodon
      url: http://mastodon.something/owncast

videoSettings:
  # Change this value and keep it secure.  Treat it like a password to your live stream.
  streamingKey: xiaoxie   //串流秘钥
//启动 [owncast]

./owncast  //启动指令

启动后查看日志文件 [transcoder.log] 如果没有报错着运行成功,如报错无法正常串流播放

//使用后台运行  [owncast]

screen -S live  //创建新的命令行

cd cd /opt/owncast  //进入目录

./owncast  //执行脚本
服务器需要开放端口[1935,8080]
设置OBS串流

服务器 [rtmp://127.0.0.1/live]
串流秘钥 [xiaoxie] (名称自行修改)

播放器地址

播放地址 [http://127.0.0.1:8080]

//运行成功后的日志文件 [transcoder.log]

[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55b3856d6d40] stream 0, timescale not set
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'pipe:':
  Metadata:
    major_brand     : M4V 
    minor_version   : 1
    compatible_brands: M4V M4A isommp42
    creation_time   : 2020-06-24T05:39:23.000000Z
    title           : Owncast Offline
    keywords        : 6-16-20
    artist          : Gabe Kangas
  Duration: 00:00:08.05, start: 0.000000, bitrate: N/A
    Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 112 kb/s (default)
    Metadata:
      creation_time   : 2020-06-24T05:39:23.000000Z
      handler_name    : Core Media Audio
    Stream #0:1(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709, progressive), 854x480 [SAR 1:1 DAR 427:240], 518 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 48k tbc (default)
    Metadata:
      creation_time   : 2020-06-24T05:39:23.000000Z
      handler_name    : Core Media Video
    Stream #0:2: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 854x480 [SAR 72:72 DAR 427:240], 90k tbr, 90k tbn, 90k tbc (attached pic)
Stream mapping:
  Stream #0:1 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:0 -> #0:1 (copy)
[libx264 @ 0x55b385725dc0] using SAR=1/1
[libx264 @ 0x55b385725dc0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x55b385725dc0] profile High, level 3.0
[libx264 @ 0x55b385725dc0] 264 - core 155 r2917 0a84d98 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=2 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=7 lookahead_threads=7 sliced_threads=1 slices=7 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=1 keyint=239 keyint_min=120 scenecut=0 intra_refresh=0 rc_lookahead=0 rc=abr mbtree=0 bitrate=1200 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=1272 vbv_bufsize=1440 nal_hrd=none filler=0 ip_ratio=1.40 aq=1:1.00
[hls @ 0x55b3856dcb00] Opening 'webroot/hls/0/stream-1604393129.ts.tmp' for writing
Output #0, hls, to 'webroot/hls/%v/stream.m3u8':
  Metadata:
    major_brand     : M4V 
    minor_version   : 1
    compatible_brands: M4V M4A isommp42
    artist          : Gabe Kangas
    title           : Owncast Offline
    keywords        : 6-16-20
    encoder         : Lavf58.29.100
    Stream #0:0(und): Video: h264 (libx264), yuv420p, 854x480 [SAR 1:1 DAR 427:240], q=-1--1, 1200 kb/s, 24 fps, 90k tbn, 24 tbc (default)
    Metadata:
      creation_time   : 2020-06-24T05:39:23.000000Z
      handler_name    : Core Media Video
      encoder         : Lavc58.54.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 1272000/0/1200000 buffer size: 1440000 vbv_delay: -1
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 112 kb/s (default)
    Metadata:
      creation_time   : 2020-06-24T05:39:23.000000Z
      handler_name    : Core Media Audio
frame=   61 fps=0.0 q=8.0 size=N/A time=00:00:04.90 bitrate=N/A speed=9.74x    
frame=  140 fps=139 q=3.0 size=N/A time=00:00:07.93 bitrate=N/A speed=7.86x    
[hls @ 0x55b3856dcb00] Opening 'webroot/hls/0/stream.m3u8.tmp' for writing
[hls @ 0x55b3856dcb00] Opening 'webroot/hls/stream.m3u8.tmp' for writing
frame=  193 fps=151 q=0.0 Lsize=N/A time=00:00:08.04 bitrate=N/A speed=6.29x    
video:832kB audio:111kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[libx264 @ 0x55b385725dc0] frame I:1     Avg QP: 7.73  size:  2019
[libx264 @ 0x55b385725dc0] frame P:192   Avg QP: 3.23  size:  4422
[libx264 @ 0x55b385725dc0] mb I  I16..4: 95.1%  0.4%  4.4%
[libx264 @ 0x55b385725dc0] mb P  I16..4: 10.4%  0.2%  0.2%  P16..4: 11.5%  2.8%  2.2%  0.0%  0.0%    skip:72.7%
[libx264 @ 0x55b385725dc0] 8x8 transform intra:1.5% inter:3.2%
[libx264 @ 0x55b385725dc0] coded y,uvDC,uvAC intra: 6.3% 9.5% 8.2% inter: 7.2% 6.3% 4.9%
[libx264 @ 0x55b385725dc0] i16 v,h,dc,p: 93%  2%  5%  1%
[libx264 @ 0x55b385725dc0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 28% 21% 31%  2%  5%  5%  4%  1%  3%
[libx264 @ 0x55b385725dc0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 23% 30%  3%  6%  5%  4%  2%  2%
[libx264 @ 0x55b385725dc0] i8c dc,h,v,p: 93%  3%  3%  2%
[libx264 @ 0x55b385725dc0] Weighted P-Frames: Y:3.6% UV:0.5%
[libx264 @ 0x55b385725dc0] kb/s:846.59

未标题-1 owncast 搭建自己的直播间(带聊天功能)
 

owncast 搭建自己的直播间(带聊天功能)

加载中……