简体中文 | English
RTSP[S]
rtp over udp rtp over tcp rtp over http rtp multicastrtp over udp and rtp over tcp)RTMP[S]
HLS
TS
fMP4
HTTP[S] and WebSocket
directory index generation, file download, form submission requestsfile downloader (supports resume breakpoint), interface requestor, file uploaderGB28181 and RTP Streaming
MP4 VOD and Recording
WebRTC
Others
It is recommended to compile on Ubuntu or macOS. Compiling on Windows is cumbersome, and some features are not compiled by default.
You must use Git to clone the complete code. Do not download the source code by downloading the ZIP package. Otherwise, the submodule 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
Guidance
# If it is on CentOS 6.x, you need to install a newer version of GCC and CMake first,
# and then compile manually according to the "build_for_linux.sh" script.
# If it is on a newer version of a system such as Ubuntu or Debian,
# step 4 can be manipulated directly.
# 1. Install GCC 5.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 to download the CMake source file manually
cd cmake-3.10.0-rc4
./configure
make -j4
sudo make install
# 3. Switch to a higher version of GCC.
scl enable devtoolset-4 bash
# 4. Build.
cd ZLMediaKit
./build_for_linux.sh
Guidance
cd ZLMediaKit
./build_for_mac.sh
You can generate Xcode projects and recompile them , learn more:
cd ZLMediaKit
mkdir -p build
cd build
# Generate Xcode project, project file is in build directory
cmake .. -G Xcode -DCMAKE_TOOLCHAIN_FILE=../cmake/ios.toolchain.cmake -DPLATFORM=OS64COMBINED
Now you can open the Android Studio project in the Android folder. This is an AAR library and demo project.
My environment
Guidance
cd ZLMediaKit
export ANDROID_NDK_ROOT=/path/to/ndk
./build_for_android.sh
My environment
Guidance
1. Enter the ZLMediaKit directory and execute `git submodule update --init` to download the code for ZLToolKit.
2. Open the project with CMake GUI and generate the Visual Studio project file.
3. Find the project file (ZLMediaKit.sln), double-click to open it with VS2017.
4. Choose to compile the Release version. Find the target file and run the test cases.
As a server:
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 a player: ```cpp MediaPlayer::Ptr player(new MediaPlayer()); weak_ptr weakPlayer = player; player->setOnPlayResult(weakPlayer { InfoL << "OnPlayResult:" << ex.what(); auto strongPlayer = weakPlayer.lock(); if (ex || !strongPlayer) {
return;
}
auto videoTrack = strongPlayer->getTrack(TrackVideo); if (!videoTrack) {
WarnL << "No video Track!";
return;
} videoTrack->addDelegate([](const Frame::Ptr &frame) {
//please decode video here
}); });
player->setOnShutdown([](const SockException &ex) {
ErrorL << "OnShutdown:" << ex.what();
});
//RTP transport over TCP (*player)[Client::kRtpType] = Rtsp::RTP_TCP; player->play("rtsp://admin:jzan123456@192.168.0.122/"); ```
As a proxy server:
//Support RTMP and RTSP URLs, but only H264 + AAC codec is supported
auto urlList = {"rtmp://live.hkstv.hk.lxdns.com/live/hks",
"rtsp://184.72.239.149/vod/mp4://BigBuckBunny_175k.mov"};
map<string , PlayerProxy::Ptr> proxyMap;
int i=0;
for(auto url : urlList){
PlayerProxy::Ptr player(new PlayerProxy("live",to_string(i++).data()));
player->play(url);
proxyMap.emplace(string(url),player);
}
RtmpPusher::Ptr pusher; NoticeCenter::Instance().addListener(nullptr,Config::Broadcast::kBroadcastRtmpSrcRegisted,
[&pusher](BroadcastRtmpSrcRegistedArgs){
const_cast<RtmpPusher::Ptr &>(pusher).reset(new RtmpPusher(app,stream));
pusher->publish("rtmp://jizan.iok.la/live/test");
});
```
zlmediakit uses github action to continuously integrate automatic compilation package and upload the compilation output package. Please download the latest sdk library file and executable file at issue list.
You can download the pre-compiled image from Docker Hub and start it:
#This image is pushed by the GitHub continuous integration automatic compilation to keep up with the latest code (master branch)
docker run -id -p 1935:1935 -p 8080:80 -p 8443:443 -p 8554:554 -p 10000:10000 -p 10000:10000/udp -p 8000:8000/udp -p 9000:9000/udp zlmediakit/zlmediakit:master
You can also compile the image based on the Dockerfile:
bash build_docker_images.sh
Visual management website
Media management platform
Client
Player
The self-owned code of this project is licensed under the permissive MIT License and can be freely applied to commercial and non-commercial projects while retaining copyright information. However, this project also uses some scattered open source code , please replace or remove it for commercial use. Any commercial disputes or infringement caused by using this project have nothing to do with the project and developers and shall be at your own legal risk. When using the code of this project, the license agreement should also indicate the license of the third-party libraries that this project depends on.

If you have any questions about the project, we recommend that you:
This project uses the media-server library developed by Lao Chen. The reuse and de-multiplexing of ts/fmp4/mp4/ps container formats in this project depend on the media-server library. Lao Chen has provided invaluable help and support multiple times in implementing many functions of this project, and we would like to express our sincere gratitude to him!
Thanks to all those who have supported this project in various ways, including but not limited to code contributions, problem feedback, and donations. The following list is not in any particular order:
老陈 Gemfield 南冠彤 凹凸慢 chenxiaolei 史前小虫 清涩绿茶 3503207480 DroidChow 阿塞 火宣 γ瑞γミ linkingvision 茄子 好心情 浮沉 Xiaofeng Wang doodoocoder qingci swwheihei KKKKK5G Zhou Weimin Jim Jin 西瓜丶 MingZhuLiu chengxiaosheng big panda tanningzhong hctym1995 hewenyuan sunhui mirs Kevin Cheng Liu Jiang along qingci lyg1949 zhlong 大裤衩 droid.chow 陈晓林 CharleyWangHZ Johnny DoubleX69 lawrencehj yangkun Xinghua Zhao hejilin rqb500 Alex Dw9 明月惊鹊 cgm hejilin alexliyu7352 cgm haorui wang joshuafc JayChen0519 zx wangcker WuPeng starry mtdxc 胡刚风 zhao85 dreamisdream dingcan Haibo Chen Leon custompal PioLing KevinZang gongluck a-ucontrol TalusL ahaooahaz TempoTian Derek Liu ljx0305 朱如洪 lijin PioLing BackT0TheFuture perara codeRATny dengjfzh 百鸣 fruit Juice tbago Luosh linxiaoyan87 waken Deepslient imp_rayjay ArmstrongCN leibnewton 1002victor Grin xbpeng121 lvchenyun Fummowo Jovial Young yujitai KisChang zjx94 LeiZhi.Mai JiaHao chdahuzi snysmtx SetoKaiba sandro-qiang Paul Philippov 张传峰 lidaofu-hub huangcaichun jamesZHANG500 weidelong 小强先生 李之阳
Also thank to JetBrains for their support for open source project, we developed and debugged zlmediakit with CLion:
This project has gained recognition from many companies and individual developers. According to the author's incomplete statistics, companies using this project include well-known Internet giants, leading cloud service companies in China, several well-known AI unicorn companies, as well as a series of small and medium-sized companies. Users can endorse this project by pasting their company name and relevant project information on the issue page. Thank you for your support!