livego README

The project's README from github.com/gwuhaolin/livego. As one markdown file: README.md.

中文

Test Release CodeQL Advanced

Simple and efficient live broadcast server:

Supported transport protocols

Supported container formats

Supported encoding formats

Installation

After directly downloading the compiled binary file, execute it on the command line.

Boot from Docker

Run docker run -p 1935:1935 -p 7001:7001 -p 7002:7002 -p 8090:8090 -d gwuhaolin/livego to start

Compile from source

  1. Download the source code git clone https://github.com/gwuhaolin/livego.git
  2. Go to the livego directory and execute go build or make build

Use

  1. Start the service: execute the livego binary file or make run to start the livego service;
  2. Get a channelkey(used for push the video stream) from http://localhost:8090/control/get?room=movie and copy data like your channelkey.
  3. Upstream push: Push the video stream to rtmp://localhost:1935/{appname}/{channelkey} through the RTMP protocol(default appname is live), for example, use ffmpeg -re -i demo.flv -c copy -f flv rtmp://localhost:1935/{appname}/{channelkey} push(download demo flv);
  4. Downstream playback: The following three playback protocols are supported, and the playback address is as follows:
    • RTMP:rtmp://localhost:1935/{appname}/movie
    • FLV:http://127.0.0.1:7001/{appname}/movie.flv
    • HLS:http://127.0.0.1:7002/{appname}/movie.m3u8
  5. Use hls via https: generate ssl certificate(server.key, server.crt files), place them in directory with executable file, change "use_hls_https" option in livego.yaml to true (false by default)

all options:

./livego  -h
Usage of ./livego:
      --api_addr string       HTTP manage interface server listen address (default ":8090")
      --config_file string    configure filename (default "livego.yaml")
      --flv_dir string        output flv file at flvDir/APP/KEY_TIME.flv (default "tmp")
      --gop_num int           gop num (default 1)
      --hls_addr string       HLS server listen address (default ":7002")
      --hls_keep_after_end    Maintains the HLS after the stream ends
      --httpflv_addr string   HTTP-FLV server listen address (default ":7001")
      --level string          Log level (default "info")
      --read_timeout int      read time out (default 10)
      --rtmp_addr string      RTMP server listen address

Use with flv.js

Interested in Golang? Please see Golang Chinese Learning Materials Summary

livego (gwuhaolin/livego)

Searching Database…

10.2K ·GitHub
这是什么东西?livego 是一个用纯 Go 编写的简单高效的直播流媒体服务器:你把视频流推给它,它再通过 RTMP、HTTP-FLV 和 HLS 把流分发给观看者。
它是我自己运行的服务器,还是写代码调用的库?是一个自己部署的独立服务器:启动 livego 可执行文件,通过它的 HTTP API 获取一个 channelkey,推流和播放它都帮你搞定——不需要写代码。
怎么把它跑起来?最快的方式是用 Docker:docker run -p 1935:1935 -p 7001:7001 -p 7002:7002 -p 8090:8090 -d gwuhaolin/livego。也可以下载编译好的可执行文件直接运行,或者用 go build 或 make build 从源码编译。
除了 livego 之外还需要安装别的东西吗?不需要——它是一个自成一体的纯 Go 可执行文件。你只需要准备一个用来推流的编码器(README 示例用的是 ffmpeg),以及一个支持 RTMP、FLV 或 HLS 的播放器。
它支持哪些协议和编码格式——有什么是它不能播放的?它覆盖常见的直播技术栈:传输方面支持 RTMP、AMF、HLS 和 HTTP-FLV,封装格式支持 FLV 和 TS,视频支持 H264,音频支持 AAC 或 MP3。不在这个清单里的格式都不支持。
用它需要懂 Go 吗?不需要——运行它就是执行一个可执行文件或一条 Docker 命令。只有当你想自己从源码编译它时才需要懂 Go。
怎么发布直播流并播放?先从运行中的服务器获取一个 channelkey,把你的流推送到 rtmp://localhost:1935/{appname}/{channelkey}(appname 默认是 'live'),然后通过 README 里列出的 RTMP、FLV 或 HLS 播放地址观看。
它监听哪些端口?Docker 命令暴露了四个端口:1935 用于 RTMP,另外 7001、7002 和 8090 承载基于 HTTP 的功能——channelkey API 以及 HTTP-FLV/HLS 播放。
HLS 输出能通过 HTTPS 提供吗?可以:生成一个 SSL 证书(server.key 和 server.crt),把这两个文件放在 livego 可执行文件旁边,然后把 livego.yaml 里的 usehlshttps 改成 true——默认是 false。
作者为什么要做 livego?README 里说明的目标是做一个安装和使用都非常简单的直播服务器:用纯 Go 实现高性能和跨平台运行,常见直播协议都内置。
Creator
gwuhaolin
Size
2.6 MB
Stars
10.2K
Age
9y
Commits · 90 Days