ZLMediaKit/README.md

241 lines
11 KiB
Markdown
Raw Normal View History

2020-07-26 20:02:46 +08:00
![logo](https://raw.githubusercontent.com/xia-chu/ZLMediaKit/master/www/logo.png)
2020-01-07 15:16:01 +08:00
2020-07-26 20:02:46 +08:00
[english readme](https://github.com/xia-chu/ZLMediaKit/blob/master/README_en.md)
2020-01-07 15:16:01 +08:00
2019-12-24 18:35:46 +08:00
# 一个基于C++11的高性能运营级流媒体服务框架
2020-04-09 22:47:19 +08:00
2020-09-14 14:39:10 +08:00
[![license](http://img.shields.io/badge/license-MIT-green.svg)](https://github.com/xia-chu/ZLMediaKit/blob/master/LICENSE)
[![C++](https://img.shields.io/badge/language-c++-red.svg)](https://en.cppreference.com/)
[![platform](https://img.shields.io/badge/platform-linux%20|%20macos%20|%20windows-blue.svg)](https://github.com/xia-chu/ZLMediaKit)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-yellow.svg)](https://github.com/xia-chu/ZLMediaKit/pulls)
[![Build Status](https://travis-ci.org/xia-chu/ZLMediaKit.svg?branch=master)](https://travis-ci.org/xia-chu/ZLMediaKit)
2017-04-01 16:42:00 +08:00
2019-12-24 18:35:46 +08:00
## 项目特点
2020-04-09 22:47:19 +08:00
- 基于C++11开发避免使用裸指针代码稳定可靠性能优越。
2020-09-30 10:30:28 +08:00
- 支持多种协议(RTSP/RTMP/HLS/HTTP-FLV/WebSocket-FLV/GB28181/HTTP-TS/WebSocket-TS/HTTP-fMP4/WebSocket-fMP4/MP4),支持协议互转。
2020-04-09 22:47:19 +08:00
- 使用多路复用/多线程/异步网络IO模式开发并发性能优越支持海量客户端连接。
- 代码经过长期大量的稳定性、性能测试,已经在线上商用验证已久。
- 支持linux、macos、ios、android、windows全平台。
2020-07-26 20:02:46 +08:00
- 支持画面秒开、极低延时([500毫秒内最低可达100毫秒](https://github.com/xia-chu/ZLMediaKit/wiki/%E5%BB%B6%E6%97%B6%E6%B5%8B%E8%AF%95))。
- 提供完善的标准[C API](https://github.com/xia-chu/ZLMediaKit/tree/master/api/include),可以作SDK用或供其他语言调用。
- 提供完整的[MediaServer](https://github.com/xia-chu/ZLMediaKit/tree/master/server)服务器,可以免开发直接部署为商用服务器。
- 提供完善的[restful api](https://github.com/xia-chu/ZLMediaKit/wiki/MediaServer%E6%94%AF%E6%8C%81%E7%9A%84HTTP-API)以及[web hook](https://github.com/xia-chu/ZLMediaKit/wiki/MediaServer%E6%94%AF%E6%8C%81%E7%9A%84HTTP-HOOK-API),支持丰富的业务逻辑。
2020-04-09 22:47:19 +08:00
- 打通了视频监控协议栈与直播协议栈对RTSP/RTMP支持都很完善。
2020-08-01 20:56:34 +08:00
- 全面支持H265/H264/AAC/G711/OPUS。
2019-12-24 18:35:46 +08:00
## 项目定位
2020-04-09 22:47:19 +08:00
2019-12-24 18:35:46 +08:00
- 移动嵌入式跨平台流媒体解决方案。
- 商用级流媒体服务器。
- 网络编程二次开发SDK。
## 功能清单
2020-09-22 16:07:11 +08:00
### 功能一览
2020-12-19 20:38:39 +08:00
<img width="800" alt="图片" src="https://user-images.githubusercontent.com/11495632/102689561-09824200-423a-11eb-9cf9-b39d1378ef68.png">
2020-04-09 22:47:19 +08:00
2020-05-18 09:10:35 +08:00
- RTSP[S]
- RTSP[S] 服务器支持RTMP/MP4/HLS转RTSP[S],支持亚马逊echo show这样的设备
- RTSP[S] 播放器支持RTSP代理支持生成静音音频
- RTSP[S] 推流客户端与服务器
2020-01-06 14:19:15 +08:00
- 支持 `rtp over udp` `rtp over tcp` `rtp over http` `rtp组播` 四种RTP传输方式
- 服务器/客户端完整支持Basic/Digest方式的登录鉴权全异步可配置化的鉴权接口
2019-12-24 18:35:46 +08:00
- 支持H265编码
- 服务器支持RTSP推流(包括`rtp over udp` `rtp over tcp`方式)
2020-08-01 10:32:05 +08:00
- 支持H264/H265/AAC/G711/OPUS编码其他编码能转发但不能转协议
2019-12-24 18:35:46 +08:00
2020-05-18 09:10:35 +08:00
- RTMP[S]
- RTMP[S] 播放服务器支持RTSP/MP4/HLS转RTMP
- RTMP[S] 发布服务器,支持录制发布流
- RTMP[S] 播放器支持RTMP代理支持生成静音音频
- RTMP[S] 推流客户端
2020-01-06 14:19:15 +08:00
- 支持http[s]-flv直播
- 支持websocket-flv直播
2020-08-01 10:32:05 +08:00
- 支持H264/H265/AAC/G711/OPUS编码其他编码能转发但不能转协议
2020-04-04 23:20:42 +08:00
- 支持[RTMP-H265](https://github.com/ksvc/FFmpeg/wiki)
2020-08-01 10:32:05 +08:00
- 支持[RTMP-OPUS](https://github.com/xia-chu/ZLMediaKit/wiki/RTMP%E5%AF%B9H265%E5%92%8COPUS%E7%9A%84%E6%94%AF%E6%8C%81)
2019-12-24 18:35:46 +08:00
2017-04-22 21:45:58 +08:00
- HLS
2020-01-06 14:19:15 +08:00
- 支持HLS文件生成自带HTTP文件服务器
2020-08-01 10:32:05 +08:00
- 通过cookie追踪技术可以模拟HLS播放为长连接可以实现HLS按需拉流、播放统计等业务
2020-05-18 09:10:35 +08:00
- 支持HLS播发器支持拉流HLS转rtsp/rtmp/mp4
2020-08-01 20:56:34 +08:00
- 支持H264/H265/AAC/G711/OPUS编码
2020-09-20 00:21:46 +08:00
- TS
- 支持http[s]-ts直播
- 支持ws[s]-ts直播
2020-09-30 10:30:28 +08:00
- 支持H264/H265/AAC/G711/OPUS编码
- fMP4
- 支持http[s]-fmp4直播
- 支持ws[s]-fmp4直播
2020-09-30 10:30:28 +08:00
- 支持H264/H265/AAC/G711/OPUS编码
2018-12-21 11:09:39 +08:00
2020-08-01 10:32:05 +08:00
- HTTP[S]与WebSocket
2020-01-06 14:19:15 +08:00
- 服务器支持`目录索引生成`,`文件下载`,`表单提交请求`
- 客户端提供`文件下载器(支持断点续传)`,`接口请求器`,`文件上传器`
- 完整HTTP API服务器可以作为web后台开发框架
- 支持跨域访问
2019-12-24 18:35:46 +08:00
- 支持http客户端、服务器cookie
- 支持WebSocket服务器和客户端
- 支持http文件访问鉴权
2020-08-01 10:32:05 +08:00
- GB28181与RTP推流
- 支持UDP/TCP国标RTP(PS或TS)推流服务器可以转换成RTSP/RTMP/HLS等协议
- 支持RTSP/RTMP/HLS转国标推流客户端支持TCP/UDP模式提供相应restful api
2020-08-01 20:56:34 +08:00
- 支持H264/H265/AAC/G711/OPUS编码
2020-10-24 23:33:58 +08:00
- 支持海康ehome推流
2020-04-09 22:47:19 +08:00
2020-08-01 10:32:05 +08:00
- MP4点播与录制
2020-01-06 14:19:15 +08:00
- 支持录制为FLV/HLS/MP4
- RTSP/RTMP/HTTP-FLV/WS-FLV支持MP4文件点播支持seek
2020-08-01 10:32:05 +08:00
- 支持H264/H265/AAC/G711/OPUS编码
2020-05-09 09:59:40 +08:00
2019-12-24 18:35:46 +08:00
- 其他
2020-01-06 14:23:23 +08:00
- 支持丰富的restful api以及web hook事件
2020-01-06 14:19:15 +08:00
- 支持简单的telnet调试
2019-12-24 18:35:46 +08:00
- 支持配置文件热加载
2020-01-06 14:19:15 +08:00
- 支持流量统计、推拉流鉴权等事件
- 支持虚拟主机,可以隔离不同域名
2019-12-24 18:35:46 +08:00
- 支持按需拉流,无人观看自动关断拉流
- 支持先拉流后推流,提高及时推流画面打开率
2020-01-06 14:19:15 +08:00
- 提供c api sdk
2020-05-09 09:59:40 +08:00
- 支持FFmpeg拉流代理任意格式的流
- 支持http api生成并返回实时截图
2020-09-12 22:00:31 +08:00
- 支持按需解复用、转协议,当有人观看时才开启转协议
2020-05-18 09:17:15 +08:00
2019-12-24 18:35:46 +08:00
2020-03-18 15:33:18 +08:00
## 编译以及测试
2020-07-26 20:02:46 +08:00
**编译前务必仔细参考wiki:[快速开始](https://github.com/xia-chu/ZLMediaKit/wiki/%E5%BF%AB%E9%80%9F%E5%BC%80%E5%A7%8B)操作!!!**
2019-12-24 18:35:46 +08:00
2020-04-09 22:34:39 +08:00
## 怎么使用
2020-04-09 22:47:19 +08:00
2020-04-09 22:34:39 +08:00
你有三种方法使用ZLMediaKit分别是
2020-04-09 22:47:19 +08:00
2020-07-26 20:02:46 +08:00
- 1、使用c api作为sdk使用请参考[这里](https://github.com/xia-chu/ZLMediaKit/tree/master/api/include).
- 2、作为独立的流媒体服务器使用不想做c/c++开发的,可以参考[restful api](https://github.com/xia-chu/ZLMediaKit/wiki/MediaServer%E6%94%AF%E6%8C%81%E7%9A%84HTTP-API)和[web hook](https://github.com/xia-chu/ZLMediaKit/wiki/MediaServer%E6%94%AF%E6%8C%81%E7%9A%84HTTP-HOOK-API).
- 3、如果想做c/c++开发,添加业务逻辑增加功能,可以参考这里的[测试程序](https://github.com/xia-chu/ZLMediaKit/tree/master/tests).
2020-04-09 22:34:39 +08:00
2020-03-18 15:33:18 +08:00
## Docker 镜像
2020-04-09 22:47:19 +08:00
2020-03-18 15:33:18 +08:00
你可以从Docker Hub下载已经编译好的镜像并启动它
2020-04-09 22:47:19 +08:00
2020-02-05 23:34:51 +08:00
```bash
2020-09-20 10:09:13 +08:00
docker run -id -p 1935:1935 -p 8080:80 -p 8554:554 -p 10000:10000 -p 10000:10000/udp panjjo/zlmediakit
2020-02-05 23:34:51 +08:00
```
2020-04-09 22:47:19 +08:00
2020-04-06 23:52:45 +08:00
你也可以根据Dockerfile编译镜像
2020-04-09 22:47:19 +08:00
2020-02-05 23:34:51 +08:00
```bash
2020-04-06 23:52:45 +08:00
bash build_docker_images.sh
2020-02-05 23:34:51 +08:00
```
2020-09-30 10:30:28 +08:00
## 合作项目
- 可视化管理网站
- [一个非常漂亮的可视化后台管理系统](https://github.com/MingZhuLiu/ZLMediaServerManagent)
- [基于ZLMediaKit主线的管理WEB网站](https://gitee.com/kkkkk5G/MediaServerUI)
- [基于ZLMediaKit分支的管理WEB网站](https://github.com/chenxiaolei/ZLMediaKit_NVR_UI)
- 流媒体管理平台
- [功能强大的流媒体控制管理接口平台,支持GB28181](https://github.com/chatop2020/StreamNode)
2020-12-19 20:31:35 +08:00
- [GB28181-2016网络视频平台](https://github.com/648540858/wvp-GB28181-pro)
2020-09-30 10:30:28 +08:00
- [node-js版本的GB28181平台](https://gitee.com/hfwudao/GB28181_Node_Http)
- [Go实现的海康ehome服务器](https://github.com/tsingeye/FreeEhome)
- 客户端
- [基于C SDK实现的推流客户端](https://github.com/hctym1995/ZLM_ApiDemo)
- [C#版本的Http API与Hook](https://github.com/chengxiaosheng/ZLMediaKit.HttpApi)
- [DotNetCore的RESTful客户端](https://github.com/MingZhuLiu/ZLMediaKit.DotNetCore.Sdk)
2020-04-09 22:47:19 +08:00
2019-12-24 18:35:46 +08:00
## 授权协议
本项目自有代码使用宽松的MIT协议在保留版权信息的情况下可以自由应用于各自商用、非商业的项目。
但是本项目也零碎的使用了一些其他的开源代码,在商用的情况下请自行替代或剔除;
2020-09-30 10:30:28 +08:00
由于使用本项目而产生的商业纠纷或侵权行为一概与本项目及开发者无关,请自行承担法律风险。
在使用本项目代码时,也应该在授权协议中同时表明本项目依赖的第三方库的协议。
2019-12-24 18:35:46 +08:00
## 联系方式
2020-04-09 22:47:19 +08:00
2020-04-24 10:11:45 +08:00
- 邮箱:<1213642868@qq.com>(本项目相关或流媒体相关问题请走issue流程否则恕不邮件答复)
2020-01-07 15:16:01 +08:00
- QQ群542509000
2020-04-09 22:47:19 +08:00
2019-12-24 18:35:46 +08:00
## 怎么提问?
2020-04-09 22:47:19 +08:00
2019-12-24 18:35:46 +08:00
如果要对项目有相关疑问,建议您这么做:
2020-04-09 22:47:19 +08:00
2019-12-24 18:35:46 +08:00
- 1、仔细看下readme、wiki如果有必要可以查看下issue.
- 2、如果您的问题还没解决可以提issue.
- 3、有些问题如果不具备参考性的无需在issue提的可以在qq群提.
2020-07-26 20:02:46 +08:00
- 4、QQ私聊一般不接受无偿技术咨询和支持([为什么不提倡QQ私聊](https://github.com/xia-chu/ZLMediaKit/wiki/%E4%B8%BA%E4%BB%80%E4%B9%88%E4%B8%8D%E5%BB%BA%E8%AE%AEQQ%E7%A7%81%E8%81%8A%E5%92%A8%E8%AF%A2%E9%97%AE%E9%A2%98%EF%BC%9F)).
2020-04-09 22:47:19 +08:00
2020-09-30 10:30:28 +08:00
## 特别感谢
本项目采用了[老陈](https://github.com/ireader) 的 [media-server](https://github.com/ireader/media-server) 库,
本项目的 ts/fmp4/mp4/ps 容器格式的复用解复用都依赖media-server库。在实现本项目诸多功能时老陈多次给予了无私热情关键的帮助
特此对他表示诚挚的感谢!
2020-01-09 10:06:30 +08:00
## 致谢
2020-04-09 22:47:19 +08:00
2020-01-09 10:06:30 +08:00
感谢以下各位对本项目包括但不限于代码贡献、问题反馈、资金捐赠等各种方式的支持!以下排名不分先后:
[老陈](https://github.com/ireader)
[Gemfield](https://github.com/gemfield)
[南冠彤](https://github.com/nanguantong2)
[凹凸慢](https://github.com/tsingeye)
[chenxiaolei](https://github.com/chenxiaolei)
[史前小虫](https://github.com/zqsong)
[清涩绿茶](https://github.com/baiyfcu)
[3503207480](https://github.com/3503207480)
[DroidChow](https://github.com/DroidChow)
[阿塞](https://github.com/HuoQiShuai)
[火宣](https://github.com/ChinaCCF)
[γ瑞γミ](https://github.com/JerryLinGd)
[linkingvision](https://www.linkingvision.com/)
[茄子](https://github.com/taotaobujue2008)
[好心情](<409257224@qq.com>)
2020-04-09 22:17:58 +08:00
[浮沉](https://github.com/MingZhuLiu)
2020-09-20 23:05:13 +08:00
[Xiaofeng Wang](https://github.com/wasphin)
[doodoocoder](https://github.com/doodoocoder)
[qingci](https://github.com/Colibrow)
[swwheihei](https://github.com/swwheihei)
[KKKKK5G](https://gitee.com/kkkkk5G)
2020-09-21 10:29:51 +08:00
[Zhou Weimin](<zhouweimin@supremind.com>)
2020-09-30 10:30:28 +08:00
[Jim Jin](https://github.com/jim-king-2000)
[西瓜丶](<392293307@qq.com>)
[MingZhuLiu](https://github.com/MingZhuLiu)
[chengxiaosheng](https://github.com/chengxiaosheng)
[big panda](<2381267071@qq.com>)
[tanningzhong](https://github.com/tanningzhong)
[hctym1995](https://github.com/hctym1995)
2020-12-27 21:14:46 +08:00
[hewenyuan](https://gitee.com/kingyuanyuan)
[sunhui](<sunhui200475@163.com>)
[mirs](fangpengcheng@bilibili.com>)
[Kevin Cheng](kevin__cheng@outlook.com>)
[Liu Jiang](root@oopy.org>)
[along](alongl@users.noreply.github.com>)
[qingci](xpy66swsry@gmail.com>)
[lyg1949](zh.ghlong@qq.com>)
[zhlong](zh.ghlong@qq.com>)
[Luke](automan@easydarwin.org>)
[大裤衩](3503207480@qq.com>)
[droid.chow](droid.chow@gmail.com>)
2020-09-30 10:30:28 +08:00
## 使用案例
本项目已经得到不少公司和个人开发者的认可,据作者不完全统计,
使用本项目的公司包括知名的互联网巨头、国内排名前列的云服务公司、多家知名的AI独角兽公司
以及一系列中小型公司。使用者可以通过在 [issue](https://github.com/xia-chu/ZLMediaKit/issues/511) 上粘贴公司的大名和相关项目介绍为本项目背书,感谢支持!
2020-09-20 23:05:13 +08:00
2019-12-24 18:35:46 +08:00
2020-01-07 15:16:01 +08:00
## 捐赠
2020-04-09 22:47:19 +08:00
2020-09-30 10:30:28 +08:00
您的捐赠将用于支付该项目的一些费用支出以及激励开发者,
2020-01-07 15:16:01 +08:00
欢迎捐赠以便更好的推动项目的发展,谢谢您的支持!
2020-09-30 10:30:28 +08:00
同时欢迎捐赠公网服务器用于在线展示效果。
2020-01-07 15:16:01 +08:00
2020-07-26 19:58:59 +08:00
[支付宝](https://gitee.com/xia-chu/other/raw/master/IMG_3919.JPG)
2020-01-07 15:16:01 +08:00
2020-07-26 19:58:59 +08:00
[微信](https://gitee.com/xia-chu/other/raw/master/IMG_3920.JPG)