MCPcopy
hub / github.com/q191201771/lal

github.com/q191201771/lal @v0.37.4 sqlite

repository ↗ · DeepWiki ↗ · release v0.37.4 ↗
1,927 symbols 5,815 edges 242 files 582 documented · 30%
README

LAL

Platform Release CI goreportcard wechat qqgroup

中文文档

LAL is an audio/video live streaming broadcast server written in Go. It's sort of like nginx-rtmp-module, but easier to use and with more features, e.g RTMP, RTSP(RTP/RTCP), HLS, HTTP[S]/WebSocket[s]-FLV/TS, GB28181, H264/H265/AAC/G711/OPUS, relay, cluster, record, HTTP API/Notify/WebUI, GOP cache.

Install

There are 3 ways of installing lal:

1. Building from source

First, make sure that Go version >= 1.18

For Linux/macOS user:

$git clone https://github.com/q191201771/lal.git
$cd lal
$make build

Then all binaries go into the ./bin/ directory. That's it.

For an experienced gopher(and Windows user), the only thing you should be concern is that the main function is under the ./app/lalserver directory. So you can also:

$git clone https://github.com/q191201771/lal.git
$cd lal/app/lalserver
$go build

Or using whatever IDEs you'd like.

So far, the only direct and indirect dependency of lal is naza(A basic Go utility library) which is also written by myself. This leads to less dependency or version manager issues.

2. Prebuilt binaries

Prebuilt binaries for Linux, macOS(Darwin), Windows are available in the lal github releases page. Naturally, using the latest release binary is the recommended way. The naming format is lal_<version>_<platform>.zip, e.g. lal_v0.20.0_linux.zip

LAL could also be built from the source wherever the Go compiler toolchain can run, e.g. for other architectures including arm32 and mipsle which have been tested by the community.

3. Docker

option 1, using prebuilt image at docker hub, so just run:

$docker run -it -p 1935:1935 -p 8080:8080 -p 4433:4433 -p 5544:5544 -p 8083:8083 -p 8084:8084 -p 30000-30100:30000-30100/udp q191201771/lal /lal/bin/lalserver -c /lal/conf/lalserver.conf.json

option 2, build from local source with Dockerfile, and run:

$git clone https://github.com/q191201771/lal.git
$cd lal
$docker build -t lal .
$docker run -it -p 1935:1935 -p 8080:8080 -p 4433:4433 -p 5544:5544 -p 8083:8083 -p 8084:8084 -p 30000-30100:30000-30100/udp lal /lal/bin/lalserver -c /lal/conf/lalserver.conf.json

Using

Running lalserver:

$./bin/lalserver -c ./conf/lalserver.conf.json

Using whatever clients you are familiar with to interact with lalserver.

For instance, publish rtmp stream to lalserver via ffmpeg:

$ffmpeg -re -i demo.flv -c:a copy -c:v copy -f flv rtmp://127.0.0.1:1935/live/test110

Play multi protocol stream from lalserver via ffplay:

$ffplay rtmp://127.0.0.1/live/test110
$ffplay rtsp://127.0.0.1:5544/live/test110
$ffplay http://127.0.0.1:8080/live/test110.flv
$ffplay http://127.0.0.1:8080/hls/test110/playlist.m3u8
$ffplay http://127.0.0.1:8080/hls/test110/record.m3u8
$ffplay http://127.0.0.1:8080/hls/test110.m3u8
$ffplay http://127.0.0.1:8080/live/test110.ts

More than a server, act as package and client

Besides a live stream broadcast server which named lalserver precisely, project lal even provides many other applications, e.g. push/pull/remux stream clients, bench tools, examples. Each subdirectory under the ./app/demo directory represents a tiny demo.

Our goals are not only a production server but also a simple package with a well-defined, user-facing API, so that users can build their own applications on it.

LAL stands for Live And Live if you may wonder.

Contact

Bugs, questions, suggestions, anything related or not, feel free to contact me with lal github issues.

License

MIT, see License.

this note updated by yoko, 202404

Extension points exported contracts — how you extend this code

IClientSessionLifecycle (Interface)
--------------------------------------------------------------------------------------------------------------------- [10 …
pkg/base/t_session.go
IBaseInSessionObserver (Interface)
聚合PubSession和PullSession,也即流数据是输入类型的session IBaseInSessionObserver BaseInSession会向上层回调两种格式的数据(本质上是一份数据,业务方可自由选择使用): 1. [5 …
pkg/rtsp/base_in_session.go
IRtpPackerPayload (Interface)
(no doc) [9 implementers]
pkg/rtprtcp/rtp_packer_payload.go
IServerSessionObserver (Interface)
TODO chef: 没有进化成Pub Sub时的超时释放 [3 implementers]
pkg/rtmp/server_session.go
IGroupCreator (Interface)
--------------------------------------------------------------------------------------------------------------------- [2 …
pkg/logic/group_manager.go
IPathRequestStrategy (Interface)
IPathRequestStrategy 路由策略 接到HTTP请求时,对应文件路径的映射逻辑 [1 implementers]
pkg/hls/path_strategy.go
DataManger (Interface)
本demo的数据存储在内存中(只实现了DataManagerMemory),所以存在单点风险(指的是dispatch永久性发生故障,短暂故障或重启是ok的), 生产环境可以把数据存储在redis、mysql等数据库中(实现DataManag [1 …
app/demo/dispatch/datamanager/data_interface.go
OnReadFlvTag (FuncType)
OnReadFlvTag @param tag: 底层保证回调上来的Raw数据长度是完整的(但是不会分析Raw内部的编码数据)
pkg/httpflv/client_pull_session.go

Core symbols most depended-on inside this repo

Write
called by 87
pkg/rtmp/message_packer.go
Dispose
called by 76
pkg/logic/logic.go
UniqueKey
called by 75
pkg/logic/logic.go
WriteString
called by 61
pkg/rtmp/amf0.go
Bytes
called by 53
pkg/rtmp/message_packer.go
Len
called by 40
pkg/logic/group_manager.go
GetGopDataAt
called by 40
pkg/remux/gop_cache.go
UniqueKey
called by 38
pkg/base/t_session.go

Shape

Method 1,116
Function 509
Struct 223
Interface 42
FuncType 26
TypeAlias 11

Languages

Go100%

Modules by API surface

pkg/rtmp/client_session.go43 symbols
pkg/rtmp/server_session.go39 symbols
pkg/rtsp/client_command_session.go37 symbols
pkg/logic/server_manager__.go36 symbols
pkg/logic/logic.go33 symbols
pkg/rtmp/message_packer.go31 symbols
pkg/logic/group__.go30 symbols
pkg/hls/muxer.go30 symbols
pkg/mpegts/psi.go29 symbols
pkg/rtsp/client_pull_session.go27 symbols
pkg/rtsp/base_in_session.go27 symbols
pkg/rtsp/server_command_session.go26 symbols

Dependencies from manifests, versioned

github.com/q191201771/nazav0.30.48 · 1×

For agents

$ claude mcp add lal \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact