@ -9,36 +9,44 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
@@ -9,36 +9,44 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- JSON Web Token support.
``` json
// .livego.json
// livego.json
{
"jwt": {
"secret": "testing",
"algorithm": "HS256s"
"algorithm": "HS256"
},
"server": [
{
"appname": "live",
"liveon": "on",
"hlson": "on"
"live": true,
"hls": true
}
]
}
```
- Use redis for store room keys
``` json
// .livego.json
// livego.json
{
"redis_addr": "localhost:6379",
"server": [
{
"appname": "live",
"liveon": "on",
"hlson": "on"
"live": true,
"hls": true
}
]
}
```
- Makefile
### Changed
- Show `players`.
- Show `stream_id`.
- Show `stream_id`.
- Deleted keys saved in physical file, now the keys are in cached using `go-cache` by default.
- Using `logrus` like log system.
- Using method `.Get(queryParamName)` to get an url query param.
- Replaced `errors.New(...)` to `fmt.Errorf(...)`.
- Replaced types string on config params `liveon` and `hlson` to booleans `live: true/false` and `hls: true/false`
- Using viper for config, allow use file, cloud providers, environment vars or flags.
@ -20,7 +20,7 @@ Simple and efficient live broadcast server:
@@ -20,7 +20,7 @@ Simple and efficient live broadcast server:
#### Supported encoding formats
- H264
- AAC
- sMP3
- MP3
## Installation
After directly downloading the compiled [binary file](https://github.com/gwuhaolin/livego/releases), execute it on the command line.
@ -30,12 +30,27 @@ Run `docker run -p 1935:1935 -p 7001:7001 -p 7002:7002 -d --name livego gwuhaoli
@@ -30,12 +30,27 @@ Run `docker run -p 1935:1935 -p 7001:7001 -p 7002:7002 -d --name livego gwuhaoli
#### 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`
2. Go to the livego directory and execute `go build` or `make build`
## Use
2. Start the service: execute the livego binary file to start the livego service;
3. Upstream push: Push the video stream to `rtmp://localhost:1935/live/movie` through the` RTMP` protocol, for example, use `ffmpeg -re -i demo.flv -c copy -f flv rtmp://localhost:1935/live/movie` push;
4. Downstream playback: The following three playback protocols are supported, and the playback address is as follows:
```bash
./livego -h
Usage of ./livego:
--api_addr string HTTP manage interface server listen address (default ":8090")
--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")
--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 (default ":1935")
--write_timeout int write time out (default 10)
```
2. Start the service: execute the livego binary file or `make run` to start the livego service;
3. Get a channelkey `curl http://localhost:8090/control/get?room=movie` and copy data like your channelkey.
4. Upstream push: Push the video stream to `rtmp://localhost:1935/live/movie`(`rtmp://localhost:1935/{appname}/{channelkey}`) through the` RTMP` protocol, for example, use `ffmpeg -re -i demo.flv -c copy -f flv rtmp://localhost:1935/live/movie` push;
5. Downstream playback: The following three playback protocols are supported, and the playback address is as follows:
@ -46,5 +45,5 @@ func (e *Encoder) Encode(w io.Writer, val interface{}, ver Version) (int, error)
@@ -46,5 +45,5 @@ func (e *Encoder) Encode(w io.Writer, val interface{}, ver Version) (int, error)
returne.EncodeAmf3(w,val)
}
return0,Error("encode amf: unsupported version %d",ver)
return0,fmt.Errorf("encode amf: unsupported version %d",ver)
@ -294,32 +295,32 @@ func (e *Encoder) EncodeAmf3Object(w io.Writer, val TypedObject, encodeMarker bo
@@ -294,32 +295,32 @@ func (e *Encoder) EncodeAmf3Object(w io.Writer, val TypedObject, encodeMarker bo
m,err=e.encodeAmf3Uint29(w,u29)
iferr!=nil{
returnn,Error("amf3 encode: cannot encode trait header for object: %s",err)
returnn,fmt.Errorf("amf3 encode: cannot encode trait header for object: %s",err)
}
n+=m
m,err=e.encodeAmf3Utf8(w,trait.Type)
iferr!=nil{
returnn,Error("amf3 encode: cannot encode trait type for object: %s",err)
returnn,fmt.Errorf("amf3 encode: cannot encode trait type for object: %s",err)
}
n+=m
for_,prop:=rangetrait.Properties{
m,err=e.encodeAmf3Utf8(w,prop)
iferr!=nil{
returnn,Error("amf3 encode: cannot encode trait property for object: %s",err)
returnn,fmt.Errorf("amf3 encode: cannot encode trait property for object: %s",err)
@ -337,20 +338,20 @@ func (e *Encoder) EncodeAmf3Object(w io.Writer, val TypedObject, encodeMarker bo
@@ -337,20 +338,20 @@ func (e *Encoder) EncodeAmf3Object(w io.Writer, val TypedObject, encodeMarker bo