![logo](https://raw.githubusercontent.com/zlmediakit/ZLMediaKit/master/logo.png)
# A lightweight ,high performance and stable stream server and client framework based on C++11.
[![Build Status](https://travis-ci.org/xiongziliang/ZLMediaKit.svg?branch=master)](https://travis-ci.org/xiongziliang/ZLMediaKit)
[中文](https://github.com/xiongziliang/ZLMediaKit/blob/master/README_CN.md)
## Why ZLMediaKit?
- Developed based on C++ 11, the code is stable and reliable, avoiding the use of raw pointers, cross-platform porting is simple and convenient, and the code is clear and concise.
- Support rich streaming media protocols(`RTSP/RTMP/HLS/HTTP-FLV/Websocket-flv`),and support Inter-protocol conversion.
- Multiplexing asynchronous network IO based on epoll and multi thread,extreme performance.
- Well performance and stable test,can be used commercially.
- Support linux, macos, ios, android, Windows Platforms.
- Very low latency(lower then one second), video opened immediately.
## Features
- RTSP
- RTSP[S] server,support rtsp push.
- RTSP player and pusher.
- RTP Transport : `rtp over udp` `rtp over tcp` `rtp over http` `rtp udp multicast` .
- Basic/Digest/Url Authentication.
- H265/H264/AAC codec.
- Recorded as mp4.
- Vod of mp4.
- RTMP
- RTMP server,support player and pusher.
- RTMP player and pusher.
- Support HTTP-FLV player.
- H264/AAC codec.
- Recorded as flv or mp4.
- Vod of mp4.
- HLS
- RTSP RTMP can be converted into HLS,built-in HTTP server.
- Play authentication based on cookie.
- HTTP[S]
- HTTP server,suppor directory meun、RESTful http api.
- HTTP client,downloader,uploader,and http api requester.
- Cookie supported.
- WebSocket Server and Client.
- File access authentication.
- Others
- Support stream proxy by ffmpeg.
- RESTful http api and http hook event api.
- Config file hot loading.
- Vhost supported.
- Auto close stream when nobody played.
- Play and push authentication.
- Pull stream on Demand.
- Protocol conversion:
| protocol/codec | H264 | H265 | AAC | other |
| :------------------------------: | :--: | :--: | :--: | :---: |
| RTSP[S] --> RTMP/HTTP[S]-FLV/FLV | Y | N | Y | N |
| RTMP --> RTSP[S] | Y | N | Y | N |
| RTSP[S] --> HLS | Y | Y | Y | N |
| RTMP --> HLS | Y | N | Y | N |
| RTSP[S] --> MP4 | Y | Y | Y | N |
| RTMP --> MP4 | Y | N | Y | N |
| MP4 --> RTSP[S] | Y | N | Y | N |
| MP4 --> RTMP | Y | N | Y | N |
- Stream generation:
| feature/codec | H264 | H265 | AAC | other |
| :-----------: | :--: | :--: | :--: | :---: |
| RTSP[S] push | Y | Y | Y | Y |
| RTSP proxy | Y | Y | Y | Y |
| RTMP push | Y | Y | Y | Y |
| RTMP proxy | Y | Y | Y | Y |
- RTP transport:
| feature/transport | tcp | udp | http | udp_multicast |
| :-----------------: | :--: | :--: | :--: | :-----------: |
| RTSP[S] Play Server | Y | Y | Y | Y |
| RTSP[S] Push Server | Y | Y | N | N |
| RTSP Player | Y | Y | N | Y |
| RTSP Pusher | Y | Y | N | N |
- Server supported:
| Server | Y/N |
| :-----------------: | :--: |
| RTSP[S] Play Server | Y |
| RTSP[S] Push Server | Y |
| RTMP | Y |
| HTTP[S]/WebSocket[S] | Y |
- Client supported:
| Client | Y/N |
| :---------: | :--: |
| RTSP Player | Y |
| RTSP Pusher | Y |
| RTMP Player | Y |
| RTMP Pusher | Y |
| HTTP[S] | Y |
| WebSocket[S] | Y |
## System Requirements
- Compiler support c++11,GCC4.8/Clang3.3/VC2015 or above.
- cmake3.1 or above.
- All Linux , both 32 and 64 bits
- Apple OSX(Darwin), both 32 and 64bits.
- All hardware with x86/x86_64/arm/mips cpu.
- Windows.
## How to build
It is recommended to compile on Ubuntu or MacOS,compiling on windows is cumbersome, and some features are not compiled by default.
### Before build
- **You must use git to clone the complete code. Do not download the source code by downloading zip package. Otherwise, the sub-module code will not be downloaded by default.You can do it like this:**
```
git clone https://github.com/zlmediakit/ZLMediaKit.git
cd ZLMediaKit
git submodule update --init
```
### Build on linux
- My environment
- Ubuntu16.04 64 bit and gcc5.4
- cmake 3.5.1
- Guidance
```
# If it is on centos6.x, you need to install the newer version of GCC and cmake first,
# and then compile manually according to the script "build_for_linux.sh".
# If it is on a newer version of a system such as Ubuntu or Debain,
# step 4 can be manipulated directly.
# 1、Install GCC5.2 (this step can be skipped if the GCC version is higher than 4.7)
sudo yum install centos-release-scl -y
sudo yum install devtoolset-4-toolchain -y
scl enable devtoolset-4 bash
# 2、Install cmake (this step can be skipped if the cmake version is higher than 3.1)
tar -xvf cmake-3.10.0-rc4.tar.gz #you need download cmake source file manually
cd cmake-3.10.0-rc4
./configure
make -j4
sudo make install
# 3、Switch to high version GCC
scl enable devtoolset-4 bash
# 4、build
cd ZLMediaKit
./build_for_linux.sh
```
### Build on macOS
- My environment
- macOS Sierra(10.12.1) + xcode8.3.1
- Homebrew 1.1.3
- cmake 3.8.0
- Guidance
```
cd ZLMediaKit
./build_for_mac.sh
```
### Build on iOS
This build method is no longer recommended.It is recommended that make Xcode project by yourself.
- My environment
Same with Build on macOS
- Guidance
```
cd ZLMediaKit
./build_for_ios.sh
```
- You can also generate Xcode projects and recompile them:
```
cd ZLMediaKit
mkdir -p build
cd build
# Generate Xcode project, project file is in build directory
cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/iOS.cmake -DIOS_PLATFORM=SIMULATOR64 -G "Xcode"
```
### Build on Android
Now you can open android sudio project in `Android` folder,this is a `aar library` and damo project.
- My environment
- macOS Sierra(10.12.1) + xcode8.3.1
- Homebrew 1.1.3
- cmake 3.8.0
- [android-ndk-r14b](https://dl.google.com/android/repository/android-ndk-r14b-darwin-x86_64.zip)
- Guidance
```
cd ZLMediaKit
export ANDROID_NDK_ROOT=/path/to/ndk
./build_for_android.sh
```
### Build on Windows
- My environment
- windows 10
- visual studio 2017
- [cmake-gui](https://cmake.org/files/v3.10/cmake-3.10.0-rc1-win32-x86.msi)
- Guidance
```
1 Enter the ZLMediaKit directory and execute git submodule update -- init downloads the code for ZLToolKit
2 Open the project with cmake-gui and generate the vs project file.
3 Find the project file (ZLMediaKit.sln), double-click to open it with vs2017.
4 Choose to compile Release version. Find the target file and run the test case.
```
## Usage
- As server:
```cpp
TcpServer::Ptr rtspSrv(new TcpServer());
TcpServer::Ptr rtmpSrv(new TcpServer());
TcpServer::Ptr httpSrv(new TcpServer());
TcpServer::Ptr httpsSrv(new TcpServer());
rtspSrv->start<RtspSession>(mINI::Instance()[Config::Rtsp::kPort]);
rtmpSrv->start<RtmpSession>(mINI::Instance()[Config::Rtmp::kPort]);
httpSrv->start<HttpSession>(mINI::Instance()[Config::Http::kPort]);
httpsSrv->start<HttpsSession>(mINI::Instance()[Config::Http::kSSLPort]);
```
- As player:
```cpp
MediaPlayer::Ptr player(new MediaPlayer());
weak_ptr<MediaPlayer> weakPlayer = player;
player->setOnPlayResult([weakPlayer](const SockException &ex) {
InfoL << "OnPlayResult:" << ex.what();
auto strongPlayer = weakPlayer.lock();
if (ex || !strongPlayer) {
return;
}
auto viedoTrack = strongPlayer->getTrack(TrackVideo);
if (!viedoT
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
ZLMediaKit运营级流媒体服务框架 v2.0.zip (667个子文件)
libcrypto.a 4.39MB
libcrypto.a 4.18MB
libcrypto.a 3.96MB
libcrypto.a 3.02MB
libcrypto.a 3.02MB
libssl.a 763KB
libssl.a 666KB
libssl.a 634KB
libssl.a 501KB
libssl.a 501KB
gradlew.bat 2KB
SPSParser.c 73KB
android.toolchain.cmake 80KB
iOS.cmake 9KB
AndroidNdkGdb.cmake 4KB
FindMYSQL.cmake 4KB
AndroidNdkModules.cmake 3KB
FindX264.cmake 2KB
FindZLTOOLKIT.cmake 511B
FindMP4V2.cmake 411B
FindSDL2.cmake 376B
FindJEMALLOC.cmake 348B
FindAVCODEC.cmake 331B
FindAVUTIL.cmake 319B
FindFAAC.cmake 291B
json_reader.cpp 54KB
RtspSession.cpp 44KB
json_value.cpp 42KB
json_writer.cpp 33KB
WebApi.cpp 33KB
RtspPlayer.cpp 27KB
RtmpProtocol.cpp 24KB
RtmpSession.cpp 21KB
HttpSession.cpp 20KB
WebHook.cpp 19KB
HttpFileManager.cpp 19KB
test_server.cpp 16KB
amf.cpp 15KB
RtspPusher.cpp 15KB
MediaSource.cpp 14KB
main.cpp 14KB
H264Encoder.cpp 14KB
System.cpp 13KB
MP4Reader.cpp 12KB
RtmpPlayer.cpp 12KB
Recorder.cpp 12KB
PlayerProxy.cpp 11KB
HttpClient.cpp 11KB
config.cpp 10KB
H264Rtp.cpp 10KB
HttpCookieManager.cpp 10KB
test_httpClient.cpp 10KB
MP4Muxer.cpp 10KB
RtpProcess.cpp 9KB
RtmpPusher.cpp 9KB
native-lib.cpp 9KB
FFmpegSource.cpp 9KB
DeviceHK.cpp 9KB
H265Rtp.cpp 8KB
Factory.cpp 8KB
H264Rtmp.cpp 8KB
HttpBody.cpp 8KB
WebSocketSplitter.cpp 7KB
FlvMuxer.cpp 7KB
RtpReceiver.cpp 7KB
RtpMultiCaster.cpp 7KB
test_player.cpp 6KB
Process.cpp 6KB
Device.cpp 6KB
AACRtp.cpp 6KB
Rtsp.cpp 6KB
ShellSession.cpp 5KB
bom.cpp 5KB
test_pusher.cpp 5KB
AACRtmp.cpp 5KB
TsMuxer.cpp 5KB
MP4Recorder.cpp 5KB
test_httpApi.cpp 5KB
test_pusherMp4.cpp 5KB
AAC.cpp 5KB
strCoding.cpp 5KB
HttpRequestSplitter.cpp 4KB
HlsMaker.cpp 4KB
MediaSink.cpp 4KB
RtmpDemuxer.cpp 4KB
UDPServer.cpp 4KB
HttpCookie.cpp 4KB
AACEncoder.cpp 3KB
HlsMakerImp.cpp 3KB
test_rtp.cpp 3KB
PlayerBase.cpp 3KB
RtspDemuxer.cpp 3KB
HttpDownloader.cpp 3KB
test_benchmark.cpp 3KB
RtpSelector.cpp 3KB
H264.cpp 3KB
RtmpMuxer.cpp 3KB
test_wsServer.cpp 3KB
H265.cpp 3KB
RtpDecoder.cpp 3KB
共 667 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7
资源评论
小小姑娘很大
- 粉丝: 4078
- 资源: 2321
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功