Clone
1
Startup Parameters
yangjiechina edited this page 2024-11-20 15:43:39 +08:00
This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
  "gop_cache": true,
  "gop_buffer_size": 8192000,
  "probe_timeout": 2000,
  "write_timeout": 5000,
  "mw_latency": 350,
  "listen_ip" : "0.0.0.0",
  "public_ip": "192.168.2.148",
  "idle_timeout": 60,
  "receive_timeout":60,
  "debug": false,

  "http": {
    "port": 8080
  },

  "rtmp": {
    "enable": true,
    "port": 1935
  },

  "hls": {
    "enable": true,
    "segment_duration": 2,
    "playlist_length": 10,
    "dir": "../tmp"
  },

  "rtsp": {
    "enable": true,
    "port": [554,20000,30000],
    "password": "123456",
    "transport": "UDP|TCP"
  },

  "webrtc": {
    "enable": true,
    "port": 8000,
    "transport": "UDP"
  },

  "gb28181": {
    "enable": true,
    "port": [50000,60000],
    "transport": "UDP|TCP"
  },

  "jt1078": {
    "enable": true,
    "port": 1078
  },

  "record": {
    "enable": false,
    "format": "flv",
    "dir": "../record"
  },

  "hooks": {
    "enable": false,
    "timeout": 10,

    "on_started": "http://localhost:9000/api/v1/hook/on_started",

    "on_publish": "http://localhost:9000/api/v1/hook/on_publish",
    "on_publish_done": "http://localhost:9000/api/v1/hook/on_publish_done",
    "on_play" : "http://localhost:9000/api/v1/hook/on_play",
    "on_play_done" : "http://localhost:9000/api/v1/hook/on_play_done",

    "on_record": "http://localhost:9000/api/v1/hook/on_record",
    "on_idle_timeout": "http://localhost:9000/api/v1/hook/on_idle_timeout",
    "on_receive_timeout": "http://localhost:9000/api/v1/hook/on_receive_timeout"
  },

  "log": {
    "file_logging": false,
    "level": -1,
    "name": "./logs/lkm.log",
    "max_size":   10,
    "max_backup": 100,
    "max_age":    7,
    "compress":  false
  }
}

gop_cache

GOP缓存开关是实现拉流秒开的关键所在,目前代码里面强制开启。WebRtc和RTSP输出流中不使用GOP缓存。

gop_buffer_size

GOP缓存区大小初始值单位Bytes取值范围512KB-20MB(4Mb码率-160Mb码率区间)。 合理的初始值可以有效降低因内存不足,造成重新扩容的可能性。

probe_timeout

解析推流Track的超时时间单位毫秒。如果该计时器触发Track数量不为0以当前Track数量为准 后续解析出来的Track都将丢弃否则(Track数量为0)关闭Source。

write_timeout

针对TCP拉流Sink的发包超时时间超过该时间会强制关闭该连接。

mw_latency

合并写延迟大小,单位毫秒,目前强制开启。 针对RTMP/FLV输出流将缓存指定时长的传输流一次性发送给Sink。可有效降低用户态和内核态交互频率, 大幅提升服务器性能。

listen_ip

监听地址。

public_ip

公网IP。

idle_timeout

空闲超时单位秒。如果Source没有一路拉流将在该计时器触发时决定是否关闭Source。

receive_timeout

收流超时, 单位秒。如果Source没有收到推流数据包将在该计时器触发时决定是否关闭Source。

debug

如果开启,将保存推流数据包。

hls

segment_duration

单个TS切片时长。

playlist_length

最大TS切片数量。

dir

TS切片存放目录。

rtsp

port

[554,20000,30000] 第一个RTSP Server监听端口, 第二个和第三个指定UDP拉流的端口范围。如果只开启TCP拉流只需要配置一个554端口。

password

鉴权密码。

transport

UDP|TCP同时开启TCP和UDP拉流可以只配置一项。

webrtc.transport

目前仅支持UDP拉流。

gb28181

port

[50000,60000] GB28181收流端口范围, 如果只有一个元素则表示单端口收流。

transport

UDP|TCP同时开启TCP和UDP推流可以只配置一项。

1078.port

目前仅支持TCP单端口推流。

record

format

录制格式目前仅支持FLV录制。

dir

录制文件存放的目录。

hook

timeout

发送http请求的超时时间单位秒。

on_started

lkm启动通知。

on_publish

推流通知。

on_publish_done

推流结束通知。

on_play

拉流通知。

on_play_done

拉流结束通知。

on_record

推流的录制文件通知。

on_idle_time

空闲超时通知。

on_receive_timeout

收流超时通知。

log

file_logging

日志是否保存到文件,默认不保存。

level

日志级别,-1-5级别详情如下

const (
	// DebugLevel logs are typically voluminous, and are usually disabled in
	// production.
	DebugLevel Level = iota - 1
	// InfoLevel is the default logging priority.
	InfoLevel
	// WarnLevel logs are more important than Info, but don't need individual
	// human review.
	WarnLevel
	// ErrorLevel logs are high-priority. If an application is running smoothly,
	// it shouldn't generate any error-level logs.
	ErrorLevel
	// DPanicLevel logs are particularly important errors. In development the
	// logger panics after writing the message.
	DPanicLevel
	// PanicLevel logs a message, then panics.
	PanicLevel
	// FatalLevel logs a message, then calls os.Exit(1).
	FatalLevel

	_minLevel = DebugLevel
	_maxLevel = FatalLevel

	// InvalidLevel is an invalid value for Level.
	//
	// Core implementations may panic if they see messages of this level.
	InvalidLevel = _maxLevel + 1
)

name

日志文件名称,同时可指明存放的目录。

max_size

单个日志文件最大大小单位MB。

max_backup

最多允许保留多少个日志文件。

max_age

最多允许保留多少天的日志文件。

compress

是否压缩日志文件,默认不压缩。